// jQuery functions for Skills Third Sector
// by M.Hill, August 2009
// for Electric Putty

// Set hover state for sidenav LI (support IE6 by adding .hover class to these LIs)
 $(document).ready(function(){
		$("#sidenav li").hover(function() {
			$(this).addClass("iehover");},
			function() {$(this).removeClass("iehover");}
		);
 });

// Function to swap two classes
$.fn.swapClass = function(c1, c2){
    return this.each(function(){
        var t = $(this);
        (!t.is('.'+c1)) ?
            t.addClass(c1).removeClass(c2) : t.addClass(c2).removeClass(c1);
    });
}

// Hover state for filter button
$(document).ready(function(){
		$("#filtertype").hover(
			function() {
				// Do on mouseover
				$(this).addClass("iehover");
				$(this).swapClass("gradbuttonright","greybuttonright");
			},
				// Undo on mouseout
			function() {
				$(this).removeClass("iehover");
				$(this).swapClass("greybuttonright","gradbuttonright");
			}
		);
 });


// Append page control print button...
// Remove default text from search box...
$(document).ready(function(){

	$("#page-to-top").after(" | <a href=\"#\" onclick=\"window.print();return false;\">Print this page</a>");

	$("#site-keywords").focus(
		function() {
			var $this = $(this);
			if($this.val() == "Search this site") {
				$this.val("");
			}
		}
	);


	$("#flashholder").each(function() {
		var fo = new FlashObject("homepage.swf?xmlFile=homepage-flash.xml", "flashIntro", 486, 300, "6", "#592049");
		fo.addParam("quality", "best");
		fo.addParam("allowScriptAccess", "sameDomain");
		fo.addVariable("movie", "homepage.swf?xmlFile=homepage-flash.xml");
		fo.write("flashholder");
    });

});