$(document).ready(function(){

	xOffset = 100;
	yOffset = -50;
	
  //hide toolbar and make visible the 'show' button
	$("span.downarr a").click(function() {
    $("#toolBar").slideToggle("slow"); 
    $("#adImageLeft").slideToggle("slow"); 
	$("#adImage").slideToggle("slow"); 
    $("#showBar").fadeIn("slow");    
  });
  
  //show toolbar and hide the 'show' button
  $("span.showbar a").click(function() {
    $("#toolBar").slideToggle("slow");
    $("#adImageLeft").slideToggle("slow");
	$("#adImage").slideToggle("slow");
    $("#showBar").fadeOut("slow");    
  });
  
  //show tooltip when the mouse is moved over a list element 
  $("ul#social li").mouseover(function(e) {
		$(this).find("div").fadeIn("fast").show(); //add 'show()'' for IE 
		$(this).mouseleave(function () { //hide tooltip when the mouse moves off of the element
			$(this).find("div").hide();
		});
  });
  
  //show quick menu on click 
	$("span.menu_title a").click(function() {
		if($(".quickmenu").is(':hidden')){ //if quick menu isn't visible 
			$(".quickmenu").fadeIn("fast"); //show menu on click
		}
		else if ($(".quickmenu").is(':visible')) { //if quick menu is visible 
      $(".quickmenu").fadeOut("fast"); //hide menu on click
    }
	});
	
	//hide menu on casual click on the page
	$(document).click(function() {
			$(".quickmenu").fadeOut("fast");
			$(".quickmenu").css({'vivibility': 'hidden'});
	});
	$('.quickmenu').click(function(event) { 
		event.stopPropagation(); //use .stopPropagation() method to avoid the closing of quick menu panel clicking on its elements 
	});

	//Select all anchor tag with rel set to tooltip
	$('.tooltip').mouseover(function(e) {
		
		//Grab the title attribute's value and assign it to a variable
		var tip = $(this).attr('title');	 
		
		var tipHTML = '<ul><li>'+tip+'</li></ul>'
		$("#tooltip").html(tipHTML);		
		
		jQuery(".tip").pngFix(); 
		
		$("#tooltip").css("top",(e.pageY - xOffset) + "px").css("left",(e.pageX + yOffset) + "px").fadeIn("fast");
		
		
	}).mousemove(function(e) {
		$("#tooltip").css("top",(e.pageY - xOffset) + "px").css("left",(e.pageX + yOffset) + "px");
	}).mouseout(function() {
		$("#tooltip").html("<div></div>");
		$("#tooltip").hide();		
	});

 	jQuery(function(){jQuery(document).pngFix();});
	
	$("span.downarr a").click();
	
});

