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");
	});		
	
};

var z=0;
function fade_prom(z){
	if(typeof(z)=="undefined"){
		var z=0;
	}
	if(typeof(arProm[z])=="undefined"){
		var z=0;
	}
// 	$("#promotions").html($("#"+arProm[z]));
	$("#"+arProm[z]).css("zIndex", "10");
	$("#"+arProm[z]).fadeTo("normal",1, function(){
		setTimeout(function(){
			$("#"+arProm[z]).fadeTo("normal",0, function(){
				$("#"+arProm[z]).css("zIndex", "1");
				z++;
				fade_prom(z);
			});
		}, 3000);
	});
};

$(document).ready(function() {
tooltip();
fade_prom();
  //Get all the LI from the #tab-menu UL
  $('#tab-menu > li').click(function(){
        
    //remove the selected class from all LI    
    $('#tab-menu > li').removeClass('selected');
    
    //Reassign the LI
    $(this).addClass('selected');
    
    //Hide all the DIV in .container
    $('.container div').slideUp('1500');
    
    //Look for the right DIV in container according to the Navigation UL index, therefore, the arrangement is very important.
    $('.container div:eq(' + $('#tab-menu > li').index(this) + ')').slideDown('1500');
    
  })
			   

    $("#options-nav li a").click(function() {
    
        var curList = $("#options-nav li a.current").attr("rel");
        var curListHeight = $("#all-list-wrap").height();
        
        $("#all-list-wrap").height(curListHeight);
    
        $("#options-nav li a").removeClass("current");
        $(this).addClass("current");
        
        var listID = $(this).attr("rel");
        
        if (listID != curList) {
            $("#"+curList).fadeOut(300, function() {
    
                $("#"+listID).fadeIn();
                
                var newHeight = $("#"+listID).height();
                
                $("#all-list-wrap").animate({
                    height: newHeight
                });
            
            });
        }        
        
        return false;
    });

						   
});
