 $(document).ready(function(){
							
		$(".over-link").hover(
			function(){
				
				if(!$(this).hasClass("top-menu-active"))
				{
								   
					var mywidth = 0;
					mywidth = $(this).parent().width();	
					mywidth = mywidth / 2;
					mywidth = 60 - mywidth;
					mywidth = mywidth - 15;
					
					$(".tooltip").css("left",-mywidth);
					$(this).parent().find(".tooltip").fadeIn("normal");
				
				}
		
			},
			function() {
				$(this).parent().find(".tooltip").fadeOut("fast");
			}
		
		);
		
		$(".preview-link").hover(
			function(){
				
				$(this).css("color","#FFF")	
		
			},
			function() {
				$(this).css("color","#CCC")	
			}
		
		);
		
		
		$("#sub-menu li a").hover(
			function(){
				$(this).find("span").fadeIn("normal");
			},
			function() {
				$(this).find("span").hide();
			}
		
		);
		
		$(".catalog-link").bind("click",catalogMenu);
		$(".nextPageCatalog").bind("click",catalogPage);
		$(".prevPageCatalog").bind("click",catalogPage);
		$(".catalog-colors").bind("click",catalogColors);
		$(".closePopup").bind("click",closePopUp);
		$(".bridal-thumb").bind("click",imageSwitch);
		$("#galleryExclusive").bind("click",showGallery);
		$(".mask").click(closePopUp);
		
 });
 
 
 /***********************************************************************/
  
 
function showGallery(){
	
	  $(this).hide();
	  $("#thumbs_Exclusive").fadeIn("normal");
	
}
 
function imageSwitch(){
	
	  var img = new Image();
	  var src = $(this).find('img').attr('src');
	  src = src.replace("thumb-", "")
	  $("#loading").css("width",$(".main-content-img").width());
	  $("#loading").css("height",$(".main-content-img").height() - 130);
	  $("#loader").hide();
	  $("#loading").show();
			
	  $(img).load(function () {
		  // set the image hidden by default    
			$(".main-content-img").attr('src',src);
			$("#loading").hide();
			$("#loader").show();
		  
	   }).attr('src', src);
	  
	 // $("a.thumb").css("border-color","#2d2b2b");
	  //$(this).css("border-color","#FFF");
	
}

 
function closePopUp(){
	
	$(".box-color").fadeOut('normal');
	$(".mask").fadeOut('slow');
	
}


function catalogColors(){
	
		var docWidth = $(window).width();
		var docHeight = $(window).height();
		var elemH = $(".box-color").height();
		var elemW = $(".box-color").width();
		
		docWidth = parseInt (docWidth/2);
		docHeight = parseInt (docHeight/2);
		elemH = parseInt (elemH/2);
		elemW = parseInt (elemW/2);
		
		var posLeft = docWidth - elemW;
		var posTop = docHeight - elemH;
		posTop += 50;
		
		$(".box-color").css("top",posTop).css("left",posLeft);
		$(".mask").css("visibility","visible");
		$(".mask").css("height",$(window).height()).fadeIn('fast');
		$(".box-color").fadeIn('normal');
	 
}


function catalogMenu(){
	 
	 var section = $(this).attr("title")
	 
	 if($(this).hasClass('inactive')){
		 
			$(".box-catalog").hide();
			$(".box-thumbs").hide();
			
			$(this).parent().parent().find('a').removeClass('active').addClass('inactive');
			$(this).removeClass('inactive').addClass('active');
			
			 if(section == "Earrings" ){
				$("#catalog-earrings").fadeIn("normal");
			 }
			 if(section == "Necklaces" ){
				$("#catalog-necklaces").fadeIn("normal");
			 }
			 if(section == "Bracelets" ){
				$("#catalog-bracelets").fadeIn("normal");
			 }
			 if(section == "Bride" ){
				$("#bride").fadeIn("normal");
			 }
			 if(section == "Bridesmaid" ){
				$("#bridesmaid").fadeIn("normal");
			 }
			
	}
	 
}

function catalogPage(){
	$(this).hide();
	if($(this).hasClass('nextPageCatalog'))
	{
		$('.imgCatalog').hide();
		$('.switchImg').fadeIn("fast");
		$('.prevPageCatalog').fadeIn("fast");
	}else{
		$('.switchImg').hide();
		$('.imgCatalog').fadeIn("fast");
		$('.nextPageCatalog').fadeIn("fast");
	}

	
}

