		var pcount = 0;
		var hcount = 0;
		var imgIndex = 1;
		var btnIndex ="";
		var oldimgIndex = 1;
		var divIndex = "";
		var aIndex = "";
		var btn_url = "";
		var timerID = null;
		var timerRunning = false;
		
						
		function ShowHideLinks(shID)
		{
			if(document.getElementById(shID).style.display == 'block')
			{
				document.getElementById(shID).style.display = 'none';
			}
			else
			{
				document.getElementById(shID).style.display = 'block';
			}
		}
	
		function ShowBtmMenu(shID)
		{
			document.getElementById(shID).style.display = 'block';		
			
		}
		
		function HideBtmMenu(shID)
		{
			document.getElementById(shID).style.display = 'none';		
		
		}

		function SearchSite()
		{
            var keyword = document.getElementById('txtSearchTextBox').value;
            window.location = "/Search/Results.aspx?k=" + keyword + "&s=Document%20Only%20Scope";
            return false;
		} 		
					
			
		function ChangeBg(imgName, imgID, shID)
		{
			if(timerRunning)
			{				
				clearTimeout(timerID);
				timerRunning = false;
				document.getElementById(btnIndex).style.display = 'none';
			}
		
			var imgFolder = "/PublishingImages/ap/";
			//change to unselected image
			document.getElementById('c' + oldimgIndex).src = imgFolder + "no" + oldimgIndex + "_unselected.png";
			

			//selected image
			document.getElementById('c' + imgID).src = imgFolder + "no" + imgID + "_selected.png";	
			document.getElementById(shID).style.display = 'block';
		
			document.getElementById('mastertable').style.background = "url(" + imgFolder  + imgName + ")";	
			document.getElementById('mastertable').style.backgroundRepeat = "no-repeat";
			document.getElementById('mastertable').style.backgroundPosition = "center top";	
						
			
			imgIndex = imgID;	
			btnIndex = shID;
			oldimgIndex = imgID;			
			if (imgIndex == 7) 
			{
				imgIndex = 1;				
			}				
						
			timerRunning = true
			
				
			if (imgIndex == 1)
			{				
				timerID = setTimeout(function(){ChangeBg('bg_panel2.png', '2' ,'button2');}, 10000);
			}
			if (imgIndex == 2)
			{			
				timerID = setTimeout(function(){ChangeBg('bg_panel3.png', '3','button3' );}, 10000);
			}
			if (imgIndex == 3)
			{				
				timerID = setTimeout(function(){ChangeBg('bg_panel4.png', '4' ,'button4');}, 10000);
			}	
			if (imgIndex == 4)
			{				
				timerID = setTimeout(function(){ChangeBg('bg_panel5.png', '5' ,'button5');}, 10000);
			}
			if (imgIndex == 5)
			{			
				timerID = setTimeout(function(){ChangeBg('bg_panel6.png', '6','button6' );}, 10000);
			}
			if (imgIndex == 6)
			{				
				timerID = setTimeout(function(){ChangeBg('bg_panel1.png', '1' ,'button1');}, 10000);
			}	
			
			
			//timerID = setTimeout(function(){ChangeBg('bg_panel'+ imgIndex +'.png', imgIndex ,'button'+ imgIndex);}, 10000);
			
		}			
		
		
		function RedirectSite(siteUrl)
		{
			window.location = siteUrl;
		}
		
		function ClearSetSearch()
		{
			if (document.getElementById('txtSearchTextBox').value == 'Search')
			{
				document.getElementById('txtSearchTextBox').value == ''
			}
			
			if (document.getElementById('txtSearchTextBox').value == '')
			{
				document.getElementById('txtSearchTextBox').value == 'Search'
			}
		}
		
		function showHideHover(aID)
		{
			document.getElementById(aID).style.backgroundImage = "url('/PublishingImages/ap/bnav_bghover.png')";
			document.getElementById(aID).style.backgroundRepeat ="repeat-x";
			document.getElementById(aID).style.color = "white";
		}
		
		function showHideOut(aID)
		{
				document.getElementById(aID).style.background = "none";
				document.getElementById(aID).style.color = "#FC5332";
		}

		
		function showHide(shID, aID)
		{
			
			if (divIndex != "")
			{
				document.getElementById(divIndex).style.display = 'none';
				//document.getElementById(aIndex).style.background = "none";
				//document.getElementById(aIndex).style.color = "#FC5332";					
			}
			
			if(shID == divIndex)
			{
				pcount++;
			}
			else
			{
				pcount = 0;
			}
			
			
			if (pcount % 2)
			{
				document.getElementById(shID).style.display = 'none';
				//document.getElementById(aID).style.background = "none";
				//document.getElementById(aID).style.color = "#FC5332";
			}
			else
			{
				document.getElementById(shID).style.display = 'block';
				//document.getElementById(aID).style.backgroundImage = "url(/PublishingImages/ap/bnav_bghover.png)";
				//document.getElementById(aID).style.backgroundRepeat ="repeat-x";
				//document.getElementById(aID).style.color = "white";
			}
			
			
			divIndex = shID;
			aIndex = aID;
		}	 		
