/*
* QPR
* Javascript			
*
* Attach various onLoad events to the suckerfish menu
* and show/hide the secondary menu background based
* on content.
* 
* 
*
* 
* 
*
*
*/

<!--//--><![CDATA[//><!--

/* Son of Suckerfish CSS navigation */

sfHover = function() {
	var sfEls = document.getElementById("level1").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"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//--><!]]>

/* Attach onLoad events cross browser fix */

function AttachEvent(obj,evt,fnc,useCapture){
	if (!useCapture) useCapture=false;
	if (obj.addEventListener){
		obj.addEventListener(evt,fnc,useCapture);
		return true;
	} else if (obj.attachEvent) return obj.attachEvent("on"+evt,fnc);
	else{
		MyAttachEvent(obj,evt,fnc);
		obj['on'+evt]=function(){ MyFireEvent(obj,evt) };
	}
} 

//The following are for browsers like NS4 or IE5Mac which don't support either
//attachEvent or addEventListener
function MyAttachEvent(obj,evt,fnc){
	if (!obj.myEvents) obj.myEvents={};
	if (!obj.myEvents[evt]) obj.myEvents[evt]=[];
	var evts = obj.myEvents[evt];
	evts[evts.length]=fnc;
}
function MyFireEvent(obj,evt){
	if (!obj || !obj.myEvents || !obj.myEvents[evt]) return;
	var evts = obj.myEvents[evt];
	for (var i=0,len=evts.length;i<len;i++) evts[i]();
}

/* This shows the secondary navigation on the inner pages, if there actually is a secondary navigation, i.e. search for level3 */
/* This part is not needed with 2010 template
checkObject = function(){
	var skDomain = document.domain;
	if (document.getElementById('menu_2')){
		document.getElementById('subnavblock').style.display="block";
		document.getElementById('subnavblock').style.background = 'url(http://qpr.sitekit.net/template-images/bg-subnav.jpg)';
	}else{
		if (document.getElementById('subnavblock')){
			document.getElementById('subnavblock').style.display="none";
		}		
	}
}

AttachEvent(window,'load',checkObject,false);
*/
