// JavaScript Document
//Erik Ulfeng
$(document).ready(function() 
{
	//Fix Firefox Lineup Error of Top Menu
	if($.browser.mozilla)
	{		
		//Regular Firefox Rules
		$('#master_content_con').css('padding-right','2px');
		$('ul#menu li.about a').css('padding-left','21px');
		
		//Rules for Firefox on XP computers
		if (navigator.userAgent.indexOf("6.1")==-1)  
		{
			//Detects Operating System using userAgent.
			//7  userAgent=Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
			//XP userAgent=Mozilla/5.0(Windows NT 5.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
			//Firefox on XP
			$('ul#menu li.about a').css('padding-left','19px');
		}
		
		//Rules for firefox 3
		if(navigator.userAgent.indexOf("3.6")!=-1)
		{
			$('ul#menu li.about a').css('padding-left','18px');
		}

	}
	
	//Set Selected Subnav to have little arrow thing.
	var yourstring = window.location.pathname;
	var index = yourstring.lastIndexOf("/"); 
	var filename = yourstring.substr(index+1);
	var listItem = $('.subnav li').find('a[href$="' + filename + '"]').parent();
	listItem.css('background-image','url(images/li_point.png)');
	listItem.css('background-repeat','no-repeat');
	listItem.css('background-position','5px 12px');
	
	//About us menu tab thingie
	 if($('#menu_right_image').attr('src') != "images/menu/about_a3.png")
	 {
		 //Hover with About Us.
		$('.about').hover(function(){
			//Hover in
			$('#menu_right_image').attr('src','images/menu/about_a3.png');
		},function(){
			//Hover Out
			$('#menu_right_image').attr('src','images/menu/about_ina3.png');
		});
	 }
	 
	
	//Workforce Reports menu tab prettyness
	 if($('#menu_left_image').attr('src') != "images/menu/workreport_a3.png")
	 {
		/*Hover with Workforce Reports*/
		$('#wr_menu_tab').hover(function(){
			//Hover in
			$('#menu_left_image').attr('src','images/menu/workreport_a3.png');
		},function(){
			//Hover Out
			$('#menu_left_image').attr('src','images/menu/workreport_ina3.png');
		});
	 }
	
	
	//Make Links on pages for partnership_subpages be purple when user is on that page
	//Uses span tag class="emp" as super container
	//Replaces link tags with: <span class="iom_menu"></span> when on correct page.
	if($(".emp").length>0)
	{
		$('a[href$='+filename+']').attr('class','iom_menu');
	}
	
	//Make forum I frame height dynamic
	$('#forum_iframe').load(function()
	{
		this.style.height = this.contentWindow.document.body.scrollHeight + "px";
		//(this.style.height = this.contentWindow.document.body.offsetHeight) + 'px';
	});
	
	
	//Use shadowbox
	//http://www.shadowbox-js.com/usage.html
	Shadowbox.init();
	 Shadowbox.setup("a.shadowbox_link", {
        gallery: "TitleHere",
		slideshowDelay:4  //Seconds
    });
	
}); 

