<!--//--><![CDATA[//><!--

var dropDowns = false;
var textResizing = false;
var currentItemOpen = '';

// Highlights the currently selected page
Event.observe(window, 'load', function() {
    $$('div#hNav li').each(function(sel){
        if (location.href.indexOf(sel.down('span').innerHTML.toLowerCase().replace(/ /g,'-')) != -1)
            sel.down('a').addClassName("selected");
    });
});

// Highlights the currently selected category
Event.observe(window, 'load', function() {
    $$('ul#nav a[href="' + location.href.substring(location.href.lastIndexOf('/')) + '"]').each(function(sel){
        if (sel.up('ul').id.endsWith('_1')) {
            sel.up('ul').toggle();
            
            sel.addClassName('open');
            sel.up('ul').previous('a').addClassName('open');
        } else if (sel.up('ul').id.endsWith('_2')) {
            sel.up('ul').up('ul').toggle();

            sel.addClassName('open');
            sel.up('ul').previous('a').addClassName('open');
            sel.up('ul').up('ul').previous('a').addClassName('open');
        } else if (sel.up('ul').id.endsWith('_3')) {
            sel.up('ul').up('ul').up('ul').toggle();

            sel.addClassName('open');
            sel.up('ul').previous('a').addClassName('open');
            sel.up('ul').up('ul').previous('a').addClassName('open');
            sel.up('ul').up('ul').up('ul').previous('a').addClassName('open');
        }            
    });
});

sfHover = function() {
	var sfEls = document.getElementById("hNav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
		}
	}
	
	var sfEls = document.getElementById("nav-prod").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
		}
	}
}

mcAccessible = function() {
	var mcEls = document.getElementById("hNav").getElementsByTagName("A");
	for (var i=0; i<mcEls.length; i++) {
		mcEls[i].onfocus=function() {
			this.className+=(this.className.length>0? " ": "") + "sffocus"; //a:focus
			this.parentNode.className+=(this.parentNode.className.length>0? " ": "") + "sfhover"; //li < a:focus
			if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
				this.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < a:focus
				if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
					this.parentNode.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < ul < li < a:focus
				}
			}
		}
		mcEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp("( ?|^)sffocus\\b"), "");
			this.parentNode.className=this.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
			if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
				this.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
				if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
					this.parentNode.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
				}
			}
		}
	}
}

addOnloads = function() {
	var sfEls = document.getElementById("widgets").getElementsByTagName("a");
	for (var i=0; i<sfEls.length; i++) {
		if(sfEls[i].id == "printToolbar") {
			sfEls[i].onclick=function() {
				return printPage();
			}		
		}
		if(sfEls[i].id == "smallTxtToolbar") {
			sfEls[i].onclick=function() {
				return changeTextSize('smallText');
			}		
		}
		if(sfEls[i].id == "mediumTxtToolbar") {
			sfEls[i].onclick=function() {
				return changeTextSize('mediumText');
			}		
		}
		if(sfEls[i].id == "largeTxtToolbar") {
			sfEls[i].onclick=function() {
				return changeTextSize('largeText');
			}		
		}		
	}
}

// thanks http://www.brothercake.com/site/resources/scripts/onload/
if(window.addEventListener) {
	if(dropDowns) window.addEventListener('load', mcAccessible, false); 		// gecko, safari, konqueror and standard
	if(textResizing) window.addEventListener('load', addOnloads, false); 
} else if(document.addEventListener) {
	if(dropDowns) document.addEventListener('load', mcAccessible, false); 		// opera 7
	if(textResizing) document.addEventListener('load', addOnloads, false); 
} else if(window.attachEvent) { 							                    // win/ie
	if(dropDowns) window.attachEvent('onload', sfHover);
	if(dropDowns) window.attachEvent('onload', mcAccessible);
	if(textResizing) window.attachEvent('onload', addOnloads);
} else { 										                                // mac/ie5
	if(typeof window.onload == 'function') {
		var existing = onload;
		window.onload = function() {
			if(dropDowns) sfHover();
			if(dropDowns) mcAccessible();
			if(textResizing) addOnloads();
		}
	} else {
		window.onload = function() {
			if(dropDowns) sfHover();
			if(dropDowns) mcAccessible();
			if(textResizing) addOnloads();
		}
	}
}

//--><!]]>