// SWPR - JQuery Code
// Developed by Public-Media


//TOOL TIP SETUP - DONT TOUCH
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */
	$("a.tooltip").click(function(e){
		return false;		  
	});						  
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

//MAIN NAV
$.fn.hoverClass = function(c) {
    return this.each(function(){
        $(this).hover( 
            function() { $(this).addClass(c);  },
            function() { $(this).removeClass(c); }
        );
    });
};  

$(document).ready(function(){
//sets up the tooltip functions
	tooltip();
						  
//sets up the shadowbox
	//window.onload = Shadowbox.init;


//MAIN NAV
	$("#nav-one li").hover(
        function(){ $("ul", this).fadeIn("slow"); }, 
        function() { } 
    );
    if (document.all) {
        $("#nav-one li").hoverClass ("sfHover");
    }
	
	/* --------------------------------------- */
	/* --( Expander Code)-- */
	/* --------------------------------------- */
		$(".expander").hide();
		//SHOWS THE FIRST HIDDEN FIELD
		$(this).find(".open").next().slideToggle();
		
		$(".accord").click(function () {

			if($(this).hasClass("open")){
				//Toggle it off
				//$(this).removeClass("open").next().slideToggle();
				//DO NOTHING IF ITS OPEN AND YOU CLICK IT
				null;
			} else {
				//FIND THE ONE THATS OPEN, CLOSE IT, THEN OPEN THIS ONE
				$(this).parents().find(".open").removeClass("open").next().slideToggle();
				$(this).addClass("open").next().slideToggle();
			}
			

			return false;
		});
		
});