 $(document).ready(function(){
				
				
		$(".pic-menu").hover(
			function(){
					$(this).find("span.under").slideDown("fast");
			},
			function() {
					$(this).find("span.under").slideUp("fast");
			}
		);
		
		
		/*$("#sub-menu li a").hover(
			function(){
				$(this).find("span").fadeIn("normal");
			},
			function() {
				$(this).find("span").hide();
			}
		);*/
		
		$("a.thumb").hover(
			function(){
				$(this).find("img").css("border-color","#FFF");
				$(this).find("span").fadeIn("fast");
			},
			function() {
				$(this).find("img").css("border-color","#000");
				$(this).find("span").fadeOut("fast");
			}
		);
		
		$(".tab-link").bind("click",tabMenu);
		$(".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);
		
		setTimeout ('pestana()',800);  
		
		
 });
 
 
 /***********************************************************************/
  
function pestana(){
	var pestanaW = $("#pestana img").width() + 100;
		$("#pestana").hide().css({
								width : pestanaW, 
								visibility : "visible"
								}).fadeIn("normal");
}

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","277px");
	  $("#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);
	  
	
}

 
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 tabMenu(){
	 
	 var section = $(this).attr("title")
	 
	 if($(this).hasClass('inactive')){
		 
			$(".box-thumbs").css("display","none");
			
			$("#tab-catalog a").removeClass('active').addClass('inactive');
			$(this).removeClass('inactive').addClass('active');
			$("#" + section).fadeIn("normal");
			
			$(".col_desc").hide();
			$("#" + section + "_text").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");
	}

	
}

