$(document).ready(function(){	
	
	$(".dismiss").click(function(){
		$(this.parentNode).slideUp("normal");
		return false;
	});
	
	$("#beautyfix_trig").click(function(){
		$("#beautyfix_movie").toggle();
		return false;
	});
	
	$(".bf_reviews_trig").click(function(){
		$("#bf_top_trig").slideToggle();
		$("#bf_reviews").slideToggle();
		return false;
	});
	
	
	
	$(".beautyfix_trig2").click(function(){
		$("#beautyfix_movie").toggle();
		return false;
	});


    // setup ul.tabs to work as tabs for each div directly under div.panes 
    $("ul.tabs").tabs("div.panes > div");
    
    $("#trigger_forgot_pass").click(function() {
		var forgot_form = this.id.replace('trigger_','#form_');
		$(forgot_form).slideToggle("normal");
	});


	$("#welcome").load(site_url+"cart/welcome");
	
	$(document).pngFix();
	
	$("#splash_menu li").click(function(){
		
		$("#splash_menu li").removeClass("active");
		$(this).addClass("active");
		
		var section = this.id.replace('splash_trig_', '#splash_item_');
		
		$("#splash .section").fadeOut("fast");
		$(".splash-ps").hide();
		$(section).fadeIn("fast");
		$(section+" .firstitem").show();
		
		return false;
	});
	 
	
	$(".splash-p").click(function(){
		
		$(".splash-ps").hide();		

		var item = this.id.replace('-trig', '');

		$("#"+item).fadeIn("fast");
		
		return false;
	});
	
	
	
		$(function () {
		$('.bubbleInfo').each(function () {
		// options
		var distance = 10;
		var time = 250;
		var hideDelay = 250;
		
		var hideDelayTimer = null;
		
		// tracker
		var beingShown = false;
		var shown = false;
		
		var trigger = $('.trigger', this);
		var popup = $('.popup', this).css('opacity', 0);
		
		// set the mouseover and mouseout on both element
		$([trigger.get(0), popup.get(0)]).mouseover(function () {
		// stops the hide event if we move from the trigger to the popup element
		if (hideDelayTimer) clearTimeout(hideDelayTimer);
		
		// don't trigger the animation again if we're being shown, or already visible
		if (beingShown || shown) {
		return;
		} else {
		beingShown = true;
		
		// reset position of popup box
		popup.css({
		  top: -85,
		  left: -34,
		  display: 'block' // brings the popup back in to view
		})
		
		// (we're using chaining on the popup) now animate it's opacity and position
		.animate({
		  top: '-=' + distance + 'px',
		  opacity: 1
		}, time, 'swing', function() {
		  // once the animation is complete, set the tracker variables
		  beingShown = false;
		  shown = true;
		});
		}
		}).mouseout(function () {
		// reset the timer if we get fired again - avoids double animations
		if (hideDelayTimer) clearTimeout(hideDelayTimer);
		
		// store the timer so that it can be cleared in the mouseover if required
		hideDelayTimer = setTimeout(function () {
		hideDelayTimer = null;
		popup.animate({
		  top: '-=' + distance + 'px',
		  opacity: 0
		}, time, 'swing', function () {
		  // once the animate is complete, set the tracker variables
		  shown = false;
		  // hide the popup entirely after the effect (opacity alone doesn't do the job)
		  popup.css('display', 'none');
		});
		}, hideDelay);
		});
		});
	});

	
	
});

jQuery(function($) {
var timer;
function OnMouseHover0(event)
{
     $("#main_navigation li ul").css("visibility","hidden");
     $("#subNav0").css("visibility","visible");
}

function OnMouseOut0(event)
{
     $("#subNav0").css("visibility","hidden");
}

function OnMouseHover1(event)
{
     $("#main_navigation li ul").css("visibility","hidden");
     $("#subNav1").css("visibility","visible");
}

function OnMouseOut1(event)
{
     $("#subNav1").css("visibility","hidden");
}

function OnMouseHover2(event)
{
     $("#main_navigation li ul").css("visibility","hidden");
     $("#subNav2").css("visibility","visible");
}

function OnMouseOut2(event)
{
     $("#subNav2").css("visibility","hidden");
}

function OnMouseOut3(event)
{
     $("#subNav3").css("visibility","hidden");
}

function OnMouseHover3(event)
{
     $("#main_navigation li ul").css("visibility","hidden");
     $("#subNav3").css("visibility","visible");
}

function OnMouseOut4(event)
{
     $("#subNav4").css("visibility","hidden");
}

function OnMouseHover4(event)
{
     $("#main_navigation li ul").css("visibility","hidden");
     $("#subNav4").css("visibility","visible");
}



$('#trigger0').bind('mouseover', OnMouseHover0);

$('#trigger0').bind('mouseout', OnMouseOut0);

$('#trigger1').bind('mouseover', OnMouseHover1);

$('#trigger1').bind('mouseout', OnMouseOut1);

$('#trigger2').bind('mouseover', OnMouseHover2);

$('#trigger2').bind('mouseout', OnMouseOut2);

$('#trigger3').bind('mouseover', OnMouseHover3);

$('#trigger3').bind('mouseout', OnMouseOut3);

$('#trigger4').bind('mouseover', OnMouseHover4);

$('#trigger4').bind('mouseout', OnMouseOut4);

});