// Author:              Matt Rossi
// Website:             ifohdesigns.com
// Article Source:      http://ifohdesigns.com/blog/tutorials/
// Last Modified:       August 26, 2008


// IF YOU WISH TO USE THIS SCRIPT I WOULD APPRECIATE A BACKLINK

$(document).ready(function() {
   
 	
	$("#panel").hide();

 var a = $("<a>Ver todos</a>").attr('href','#').addClass("btn-slide");
 $('#wrapper').before(a);


   $(".btn-slide").click(function(){

      if ($("#panel").is(":hidden")) {
        $("#panel").slideDown("slow");
	$(this).addClass("active");
         $.cookie('showTop', 'collapsed');
	return false;
	
      } else {
        $("#panel").slideUp("slow");
	$(this).removeClass("active");
        $.cookie('showTop', 'expanded');
	return false;

      }
	
   });

// COOKIES
    // Header State
    var showTop = $.cookie('showTop');

    // Set the user's selection for the Header State
    if (showTop == 'collapsed') {
	$("#panel").show();
	$(".btn-slide").addClass("active");
	
    };
 
});


/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */



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").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();
});