
$(document).ready(function(){

/* Hide the menu on page load */

	//$("#menuholder #mainmenu").animate({width:"0px"},1);
	$("#menuholder #mainmenu").animate({marginLeft:"-340px"},1);
	$("#menuholder .menutab").animate({marginLeft:"0px"},1);

/* Menu - mouseover based animation */

	var n = 0;
	    $("#menuholder .menutab").bind("mouseenter",function(){
	      	//$("#mainmenu").animate({width:"340px"},450);
			$("#menuholder #mainmenu").animate({marginLeft:"0px"},450,'linear');
			$("#menuholder .menutab").hide();
			$("#menuholder .menutab").animate({marginLeft:"-30px"},0,'linear');
	    }).bind("mouseleave",function(){
	      // do nothing
	    });

/* Menu - capture the mouseout event */

	$("#menuholder #mainmenu").hover(
	      function () {
	        // do nothing on mouseover
	      }, 
	      function () {
			// but do the following on mouseout
	        $("#menuholder #mainmenu").animate({marginLeft:"-340px"},450);
			$("#menuholder .menutab").show();
			$("#menuholder .menutab").animate({marginLeft:"0px"},900);
	      }
	    );

/* Collection Image Gallery */

		$(".linkcollectionthumb").bind("click",
		      function (e) {
				if(e.currentTarget){
					var thesource = e.currentTarget.href;
				}else{
					if(e.srcElement){var thesource = e.srcElement;var theparent = thesource.parentElement; var thesource = theparent.href;}
				}
				$("#largecollectionimage").fadeOut(500,function(){
					$("#largecollectionimage").attr("src",thesource);
				});
				$("#largecollectionimage").fadeIn(1200);
				return false;
		      }
		    );

/* Salons view */	

			$().find(".salonbox").css("cursor","pointer");
			$(".salonbox").bind("click",
			      function (e) {
					if(e.currentTarget){
						var thesource = e.currentTarget;
					    var thehref = $("#"+thesource.id+ " a").attr("href");

					}else if(e.srcElement){
						var thesource = e.srcElement;
						var thehref = $("#".thesource.id+ " a").attr("href");
					}
				  	location.href=thehref;
				  }
			);


			/*$(".salonbox").bind("mouseenter",function(e){
				if(e.currentTarget){var thesource = e.currentTarget;}else{var thesource = e.srcElement;};
				$("#"+thesource.id;).addClass('salonboxover');
	   		}).bind("mouseleave",function(e){
				if(e.currentTarget){var thesource = e.currentTarget;}else{var thesource = e.srcElement;};
 				$("#"+thesource.id).removeClass('salonboxover');
	    	});*/

			$(".salonbox").hover(
			      function () {
					$(this).addClass('salonboxover');
			      },
			      function () {
 					$(this).removeClass('salonboxover');
			      }
			    );

});