/*
	JAVASCRIPT
	CREATED: 24.02.09
	MODIFIED: 03.05.09
	AUTHOR: ANDY FIELD
*/

$(document).ready(function(){
    
    $(".social").hide();
    $("#textreset").hide();
    //$("#contrastreset").hide();
	$("#cat-nav").hide();
	$("#generalinformation #cat-nav").show();
	$("#finding #cat-nav").show();
	$("#language #cat-nav").show();
	$("#executive #cat-nav").show();
	$("#memory #cat-nav").show();
	$("#attention #cat-nav").show();
	$("#wayfinding #cat-nav").show();

    
    $("#share").click(function () {
      $(".social").toggle();
      return false;
    });
    
    $("li.guides a").click(function () {
		$("#cat-nav").toggle();
		$(this).addClass("active");
		return false;
	});
    
    $("#textresize a").click(function () {
      $("#textresize").hide();
      $("#textreset").show();
      return false;
    });
    
    $("#textreset a").click(function () {
      $("#textresize").show();
      $("#textreset").hide();
      return false;
    });
    
    /* $("#contrastchange a").click(function () {
      $("#contrastchange").hide();
      $("#contrastreset").show();
      return false;
    });
    
    $("#contrastreset a").click(function () {
      $("#contrastchange").show();
      $("#contrastreset").hide();
      return false;
    }); */
    

  });

this.tooltip = function(){	
	/* CONFIG */		
		xOffset = -20;
		yOffset = -60;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("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");
	});			
};



// starting the script on page load
$(document).ready(function(){
	tooltip();
});