﻿function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
    }
}

function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
    }

	$("a[rel='pop-up']").click(function () {   
			var caracteristicas = "height=300,width=350,scrollTo,resizable=1,scrollbars=1,location=0";   
			nueva=window.open(this.href, '_blank', caracteristicas);   
					        	
			return false;   
		});

    $(document).ready(function() {
    	        $('#mycarousel').jcarousel({
            vertical: true,
            scroll: 5,
            visible: 9            
        });
    	    	    	
    	    	
        $("#mycarousel > li > img")
     .live("click", function(event) {
         var imgContainer = $("#photoViewer > img");
         var photoLabel = $("#photoLabel");
         var prodDescContainer = $("#prodDesc");         
                                             
         var photoLabel = $("#photoLabel");
         var thumb = $(this);
         var linkRecomendar = $("#linkRecomendar");
         var linkConsulta = $("#linkConsulta");
         


         $("#mycarousel > li > img").removeClass('selectedThumbnail', 100);
         thumb.addClass('selectedThumbnail', 500, function() { });

         if (imgContainer.attr("src") != thumb.attr("big")) {
             photoLabel.fadeOut("fast");

             imgContainer.fadeOut("fast",
		        function() {
						imgContainer.attr("src", thumb.attr("big"));
						imgContainer.attr("title", thumb.attr("title"));
						imgContainer.fadeIn("slow", function() {		            			            	
						var prodDescHtml = ($('#' + thumb.attr("s1"))).html();						
						prodDescContainer.html(prodDescHtml);	     
						photoLabel.html(thumb.attr("photoLabel"));
						photoLabel.fadeIn("fast");
						
						$("#confeccionBerlin").hide();
						$("#confeccionTitu").hide();
						$("#confeccionFlorencia").hide();	
						$("#confeccionIbiza").hide();	
						$("#confeccionVerona").hide(); 
	 					$("#confeccionTitu").hide();           				
						
						var idP = thumb.attr("s1").replace("Prod", "");
						linkConsulta.attr("href","contacto_hotel.php?ProductoId="+idP);
												
						linkRecomendar.attr("href","recomendar_amigo.php?ProductoId="+idP);
												
						
						if( thumb.attr("s1") == "Prod3" || thumb.attr("s1") == "Prod7" || thumb.attr("s1") == "Prod13" || thumb.attr("s1") == "Prod1" ||  thumb.attr("s1") == "Prod2")
						{
							$("#preLavado").hide();
						}
						else
						{
							$("#preLavado").show();
						}

						if( thumb.attr("s1") == "Prod304" ) //candela
						{
							$("#confeccionIbiza").show();
          						$("#confeccionTitu").show();							
						}
						
						if( thumb.attr("s1") == "Prod307" ) //dinamic
						{
							$("#confeccionBerlin").show();
          						$("#confeccionTitu").show();							
						}
						if( thumb.attr("s1") == "Prod484" ) 
						{
							$("#confeccionBerlin").show();
          						$("#confeccionTitu").show();							
						}
						if( thumb.attr("s1") == "Prod485" ) 
						{
							$("#confeccionBerlin").show();
          						$("#confeccionTitu").show();							
						}						
						if( thumb.attr("s1") == "Prod486" ) 
						{
							$("#confeccionBerlin").show();
          						$("#confeccionTitu").show();							
						}				
						if( thumb.attr("s1") == "Prod487" ) 
						{
							$("#confeccionBerlin").show();
          						$("#confeccionTitu").show();							
						}																				
						if( thumb.attr("s1") == "Prod306" ) 
						{
							$("#confeccionIbiza").show();
          						$("#confeccionTitu").show();							
						}
						
						if( thumb.attr("s1") == "Prod305" ) //dinamic
						{
							$("#confeccionIbiza").show();
          						$("#confeccionTitu").show();							
						}
						
						if( thumb.attr("s1") == "Prod303" ) //purpura
						{
							$("#confeccionBerlin").show();
          						$("#confeccionTitu").show();							
						}
						if( thumb.attr("s1") == "Prod302" ) //ghana
						{
							$("#confeccionIbiza").show();
          						$("#confeccionTitu").show();							
						}
						
						if( thumb.attr("s1") == "Prod8" ) //florecina
						{
							$("#confeccionFlorencia").show();
          						$("#confeccionTitu").show();							
						}
						if( thumb.attr("s1") == "Prod26" ) //ibiza
						{
							$("#confeccionIbiza").show();
          						$("#confeccionTitu").show();							
						}
						
						if( thumb.attr("s1") == "Prod2" || thumb.attr("s1") == "Prod1") 
						{
							$("#confeccionTitu").show();	
							$("#confeccionVerona").show();          									
						}
						
						if( thumb.attr("s1") == "Prod13" || thumb.attr("s1") == "Prod7") //berlin
						{
							$("#confeccionBerlin").show();
          						$("#confeccionTitu").show();
						}

						//SELLOS
						if ( $("#rubro").val() == 2)
						{
							$("#preLavado").hide();         
						}
												
						if ($("#rubro").val() == 27)
						{
							$("#preLavado").hide();
						}
						
						if ( $("#rubro").val() == 3)
        					{
					          	$("#preLavado").hide();                            
					          	$("#inti").show();          	
					          	$("#hipo").hide();         
					        } 
					        
						if ( $("#rubro").val() == 7)
        					{
							$("#preLavado").hide();                            
							$("#inti").hide();          	
							$("#hipo").show();         
							$("#garantia").show();
					        } 
						if ( $("#rubro").val() == 22)
						{
							$("#preLavado").hide();                            
							$("#inti").show();          	
							$("#hipo").hide();         
						}		
						if ( $("#rubro").val() == 5)
						{
							$("#preLavado").hide();                            
							$("#inti").show();          	
							$("#hipo").hide();         
						}									        
						if ( $("#rubro").val() == 23)
						{
							$("#preLavado").hide();                            
							$("#inti").show();          	
							$("#hipo").show();         
						}						
						if ($("#photoLabel").html() =="Toallas Oregon York" )
						{
							$("#preLavado").hide();                            
							$("#inti").show();          	
							$("#hipo").hide();   		
						}
						
							if ( $("#rubro").val() == 29)
							{
								$("#lavado").show();
								$("#preLavado").show();
								$("#inti").show();     
								$("#garantia").hide();     	
								$("#hipo").hide();         
							}
						
						var leyendas = $("#leyenda"); 
					        if (thumb.attr("s1") == "Prod254")
					        {
					        	leyendas.html('Una personalidad importante que invita a seducir espacios.<br>Imposible resistirse a su poder y a su naturaleza majestuosa. ');
					        } 
						if (thumb.attr("s1") == "Prod255")
					        {
					        	leyendas.html('Un misterio de tierras lejanas se actualiza en cada espacio-tiempo.<br> Sus curvas y contra-curvas contienen y expanden un sinfín de ilusiones que cada uno apropiará en el momento adecuado');
					        } 
						if (thumb.attr("s1") == "Prod253")
					        {
					        	leyendas.html('Un sueño cálido y  envolvente invade el ambiente donde Ghana se presenta.<br>Sus huellas penetran en  un  espacio donde todo es posible');
					        } 
						
						
					});

		        });
         }
     });
    });

