var imgCount = 0, iCurrImg, evt, stopimages;

window.onload = function()
{		
	ApplySifrHeadings();

	if (document.getElementById('slideshowimages'))
	{		
		var ssimages = document.getElementById('slideshowimages').innerHTML;
		ssimages = ssimages.replace(/ddimg/g, "ssimg");
		document.getElementById('ctl00_images').innerHTML = ssimages;
	}		
		
	// If there is a div with an id of masthead, then run the image rotator code.	
	if(document.getElementById('masthead'))
	{
		var images = document.getElementById('masthead').getElementsByTagName("img");
		
		// Get the total number of images
		imgCount = images.length;
		
		// iCurrentImag is the image currently being displayed, as a default, set it to the first image
		iCurrImg = 1;
		
		if(images.length > 1)
		{			
			showAnimation();
		}
		else
		{
			clearTimeout(evt);
		}
	}
	
	var element = document.getElementById('navigation')
	
	//put hassubmenues in navigation menu
	for (var i=0; i < element.childNodes.length; i++ ) 
	{
		if (element.childNodes[i].childNodes[1])
		{
			element.childNodes[i].className = "hassubmenus"; 
		}
	}	
}

function ApplySifrHeadings()
{
	
	if(typeof sIFR == "function")
	{		
		sIFR.bHideBrowserText = true;
		sIFR.setup();
		//sIFR.debug();
		sIFR();
		sIFR.replaceElement(named({sSelector:"h1,h2", sFlashSrc:"/swf/calibri.swf", sColor:"#CA263D", sWmode:"transparent", sFlashVars:"offsetTop=-1&textalign=left"}));
	};	
}


sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
