// JavaScript Document
function govtoggleMenu(obj){
	if(document.getElementById){
		var get_menu = document.getElementById("gov" + obj);
		var get_sign = document.getElementById("gov_menu_s"+ obj);
		var count_span = document.getElementById("main_menu_middle").getElementsByTagName("span");
		if(get_menu.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<count_span.length; i++){
		       if (count_span[i].className=="gov_m_span") 
				  count_span[i].style.display = "none";
				  document.getElementById("gov_menu_s1").innerHTML ="+";
				  document.getElementById("gov_menu_s2").innerHTML ="+";
				  document.getElementById("gov_menu_s3").innerHTML ="+";
				  document.getElementById("gov_menu_s4").innerHTML ="+";
			      }
		   get_menu.style.display = "block";
		   get_sign.innerHTML = "-";
		 }else{
		   get_menu.style.display = "none";
		   get_sign.innerHTML = "+";
		 }
		}
	}

//SOTN POPUP START
function sotnVideo(){
	var scrollPos = $(window).scrollTop();
	var pageHeight = $('#wrap').height();
	var topPos = scrollPos + 15;
	var siteOverlay = "<div style='height:"+ pageHeight+"px;' id='sotnVideoOverlay'></div><div style='top:"+topPos+"px;' id='sotnVideoMain'></div>";
	var videoCode = "<div id='sotnFlashContent'><div id='sotnCloseBtn' onclick='sotnVideoClose();'></div><div id='videoOverlay'></div><div id='videoPlayer'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' width='740' height='440' id='vodPlayer3' align='middle'><param name='movie' value='videos/SOTN2011/vodPlayer3.swf' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><param name='play' value='true' /><param name='loop' value='true' /><param name='wmode' value='transparent' /><param name='scale' value='showall' /><param name='menu' value='true' /><param name='devicefont' value='false' /><param name='salign' value='' /><param name='allowScriptAccess' value='sameDomain' /><param name='allowFullScreen' value='true' /><!--[if !IE]>--><object type='application/x-shockwave-flash' data='videos/SOTN2011/vodPlayer3.swf' width='740' height='440'><param name='movie' value='videos/SOTN2011/vodPlayer3.swf' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><param name='play' value='true' /><param name='loop' value='true' /><param name='wmode' value='transparent' /><param name='scale' value='showall' /><param name='menu' value='true' /><param name='devicefont' value='false' /><param name='salign' value='' /><param name='allowScriptAccess' value='sameDomain' /><param name='allowFullScreen' value='true' /><!--<![endif]--><a href='http://www.adobe.com/go/getflash'><img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a><!--[if !IE]>--></object><!--<![endif]--></object></div></div>";
	
	$(siteOverlay).appendTo('#wrap');
	$('#sotnVideoMain').html(videoCode);
	
	};
	function sotnVideoClose(){
		 $('#sotnVideoMain').remove();
		 $('#sotnVideoOverlay').remove();
		
		};
//SOTN POPUP END

// PDF LIST MENU
function pdfMenu(obj){
	if(document.getElementById){
		var get_menu = document.getElementById("pdf_list" + obj);
		var get_sign = document.getElementById("pdf_s" + obj);
		var count_span = document.getElementById("pdf_list_section").getElementsByTagName("span");
		var count_spanT = document.getElementById("list_menu_wrap").getElementsByTagName("span");
		if(get_menu.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<count_span.length; i++){
		       if (count_span[i].className=="pdf_span") 
				  count_span[i].style.display = "none";
			      }
			for (var j=0; j<count_spanT.length; j++){
				if (count_spanT[j].className=="title_span")
				   count_spanT[j].innerHTML ="+";
			}
		   get_menu.style.display = "block";
		   get_sign.innerHTML = "-";
		 }else{
		   get_menu.style.display = "none";
		   get_sign.innerHTML = "+";
		 }
		}
	}
// YOUR PATH FUNCTION
function path_change() {

if (document.getElementById("showhide_yp").style.display == "none") {

document.getElementById("showhide_yp").style.display = "block";

document.getElementById("thetext_yp").innerHTML = "Hide Path";

} else {

document.getElementById("showhide_yp").style.display = "none";

document.getElementById("thetext_yp").innerHTML = "Show Path";

}

}

// Nr Switch
function NRswitch(obj){
	if(document.getElementById){
		var get_menu = document.getElementById("nrSwitch" + obj);
		if(get_menu.style.display != "block"){ //DynamicDrive.com change
		  document.getElementById("nrSwitch1").style.display = "none";
		  document.getElementById("nrSwitch2").style.display = "none";
		   get_menu.style.display = "block";
		 }
		}
	}
	function theRotator() {
 //Set the opacity of all images to 0
 $('div#fadeRotator ul li').css({opacity: 0.0});
 //Get the first image and display it (gets set to full opacity)
 $('div#fadeRotator ul li:first').css({opacity: 1.0});
 //Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
 setInterval('rotate()',10000);
}
function rotate() {	
	//Get the first image
	var current = ($('div#fadeRotator ul li.show')?  $('div#fadeRotator ul li.show') : $('div#fadeRotator ul li:first'));

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#fadeRotator ul li:first') :current.next()) : $('div#fadeRotator ul li:first'));	
	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
};
$(document).ready(function() {		
	//Load the slideshow
	theRotator();
});
