// Start IE Navigation Script //
sfHover = function() {
	var sfEls = document.getElementById("navigation").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);

sfHover1 = function() {
	var sfEls1 = document.getElementById("top-navigation").getElementsByTagName("LI");
	for (var i=0; i<sfEls1.length; i++) {
		sfEls1[i].onmouseover=function() {
			this.className+=" sfhover1";
		}
		sfEls1[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover1\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover1);

sfHover2 = function() {
	if(document.getElementById('sidebar')) {
		var sfEls2 = document.getElementById("sidebar").getElementsByTagName("LI");
		for (var i=0; i<sfEls2.length; i++) {
			sfEls2[i].onmouseover=function() {
				this.className+=" sfhover2";
			}
			sfEls2[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover2\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover2);
// End  //

jQuery(document).ready(function(){

// Start cycle/slideshow
	jQuery('.cycle').cycle({ // Automatically apply cycle to anything with a class of .cycle
		timeout:   8000, // Wait 10 sec. before advancing
		speed:     400, // Transition takes .4 sec to complete
		random:    1, // Use random order
		pause:     1, // Pause on mouseover
		next:      '.cycle', // Advance when clicking on .cycle
		cleartype: 1 // enable cleartype corrections
	});
// End cycle/slideshow

// Start table sorting
if(jQuery('table.style').length != 0){ // if exists
	jQuery('table.style').tablesorter(); // Automatically apply tablesorter to all tables with a class of "style"
}
// End table sorting

// Start enable form validation
	jQuery(document).ready(function() {
		jQuery('.formValidate').validationEngine({
			success :  false,
			failure : function() {peekaboo_popups();}
		});
	});
// End enable form validation


// Start fade form tooltips on hover
	function peekaboo_popups(){
		jQuery('.formError').hover(
			function(){
				jQuery(this).stop().fadeTo('fast',0.1);
			},function(){
				jQuery(this).stop().fadeTo('slow',1);
			}
		);
		jQuery('.formError').click(
			function(){
				jQuery(this).remove();
			}
		);
	}
// End fade form tooltips on hover

});