// JavaScript Document var pathImg = '/uploads/images/' var pathProductos = '/productos/' var urlAux = "http://localhost/trilamp" var urlAux = "http://nueva.trilamp.com" var secuenciador = 1 if(urlAux=="http://nueva.trilamp.com") secuenciador = 1 var codProducto = document.location.href.split("#")[secuenciador] var viewProducto = false //alert(parseInt(codProducto)) if(isNaN(parseInt(codProducto))){ codProducto = document.location.href.split("#")[(secuenciador + 1)] } /* if(parseInt(codProducto)>100){ viewFamilia = true codFamilia = codProducto } */ if(parseInt(codProducto)>2100){ viewProducto = true viewFamilia = false viewTipos = false } //alert(urlAux) jQuery( document ).ready(function() { // Handler for .ready() called. setPlt() if (viewTipos) jQuery('#searcht' ).val("Tip") loadScriptAux("/producto/slider/jquery.bxslider/jquery.bxslider.min.js", setSlider, "js", "jsSlider") loadScriptAux("/producto/slider/jquery.bxslider/jquery.bxslider.css", null, "css", "cssSlider") loadScriptAux("/wp-content/themes/shoppica/js/prettyphoto/js/jquery.prettyPhoto.js?ver=4.0", null, "js", "jsPrettyPhoto") loadScriptAux("/wp-content/themes/shoppica/js/prettyphoto/css/prettyPhoto.css?ver=4.0", null, "css", "cssPrettyPhoto") getSelects() getTraduccion() jQuery('#site_search' ).hide() }); function setEmail(){ dialog = jQuery( "#dialog-form" ).dialog({ autoOpen: false, height: 300, width: 350, modal: true, buttons: { "Ok": function() { setPdf('email'); alert("ok") }, Cancel: function() { dialog.dialog( "close" ); jQuery('#ajax-loader').hide() } }, close: function() { } }); } function setEmail2(filePdf){ jQuery.post( urlAux + '/producto/producto.server.php', {action : "setEmail",filePdf:filePdf,semail:jQuery("#semail").val(),comentario:jQuery("#comentario").val()} ,function( data ) { dialog.dialog( "close" ); jQuery('#ajax-loader').hide() if(data.res!="ok") alert("error") //alert(arrLng["etqEmailError"]) },'json'); } function setPdf(opt){ jQuery('#ajax-loader').show() var dtsJson ={} dtsJson["lngPDF"] = cod_idioma dtsJson["urlAux"] = urlAux dtsJson["pathImg"] = pathImg jQuery.each(dataPdf, function(key, value) { dtsJson[key] = value }); // dtsJson["descripcion"] = 'Lorem Ipsum es simplemente el texto de relleno de las imprentas y archivos de texto. Lorem Ipsum ha sido el texto de relleno estándar de las industrias desde el año 1500, cuando un impresor (N. del T. persona que se dedica a la imprenta) desconocido usó una galería de textos y los mezcló de tal manera que logró hacer un libro de textos especimen. No sólo sobrevivió 500 años, sino que tambien ingresó como texto de relleno en documentos electrónicos, quedando esencialmente igual al original. Fue popularizado en los 60s con la creación de las hojas "Letraset", las cuales contenian pasajes de Lorem Ipsum, y más recientemente con software de autoedición, como por ejemplo Aldus PageMaker, el cual incluye versiones de Lorem Ipsum.' jQuery.post( urlAux + '/producto/pdf.php', dtsJson ,function( data ) { if (data.res == "ok"){ switch(opt){ case "pdf": jQuery('#ajax-loader').hide() //alert(urlAux + data.filePdf) window.open(urlAux + data.filePdf,"_top") break; case "email": setEmail2(data.filePdf) break; } }else{ //alert(arrLng["etqEmailError"]) alert("error") jQuery('#ajax-loader').hide() } },'json'); } var QueryString = function () { // This function is anonymous, is executed immediately and // the return value is assigned to QueryString! var query_string = {}; var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i', { value : value.value }) .text(value.text)); }); },'json'); } function getTraduccion(){ jQuery.post( urlAux + '/producto/producto.server.php', {action : "getTraduccion", cod_idioma: cod_idioma} ,function( data ) { jQuery.each(data, function(key, value) { switch(value.tipo){ case "title": jQuery('#' + value.id ).attr("title",value.value) break; case "placeholder": jQuery('#' + value.id ).attr("placeholder",value.value) break; default: jQuery('#' + value.id ).html(value.value) break; } }); },'json'); } setSlider= function (){ loadScriptAux("//code.jquery.com/ui/1.11.2/jquery-ui.js", getCntFichaInit, "jsExt", "jsJqueryUi") loadScriptAux("//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css", null, "cssExt", "cssJqueryUi") switch(jQuery('#searcht' ).val() ){ case "Fam": setSliderFam() break; case "Tip": setSliderTipos() break; case "Sch": setSliderFam() jQuery('#searcht' ).val("Sch") break; } } setSliderFam= function (){ jQuery('#cntSlider1' ).html('
') jQuery('#searcht' ).val("Fam") var dtsJson ={} dtsJson["cod_idioma"] = cod_idioma dtsJson["action"] = "getFamilias" if(viewFamilia){ viewFamilia=false dtsJson["codFamilia"] = codFamilia } var url = urlAux + '/producto/producto.server.php' //alert(url) jQuery.post(url , dtsJson ,function( data ) { var i=0 var auxTxt='' var x="" var nom ="" jQuery.each(data, function(key, value) { auxTxt += '
' auxTxt += '
' i++; }); jQuery('#slider1' ).html(auxTxt) jQuery('.slider1').bxSlider({ slideWidth: 800, minSlides: 6, maxSlides: 6, slideMargin: 10, pager: false }); if(!viewProducto) getCntSubFamilia(x) },'json'); } setSliderTipos= function (){ jQuery('#cntSlider1' ).html('
') jQuery('#searcht' ).val("Tip") var dtsJson ={} dtsJson["cod_idioma"] = cod_idioma dtsJson["action"] = "getTipos" if(viewTipos){ viewTipos=false dtsJson["codTipo"] = codTipo } jQuery.post( urlAux + '/producto/producto.server.php', dtsJson ,function( data ) { var i=0 var auxTxt='' var x="" var nom ="" jQuery.each(data, function(key, value) { auxTxt += '
' auxTxt += '
' i++; }); jQuery('#slider1' ).html(auxTxt) jQuery('.slider1').bxSlider({ slideWidth: 800, minSlides: 6, maxSlides: 6, slideMargin: 10, pager: false }); if(!viewProducto) getCntProd(x,"2") },'json'); } function showImg(imgId,titId){ jQuery('#' + titId ).css('height', "40px") jQuery('#' + titId ).show() //jQuery('#' + imgId ).css('top', "-40px") } function hideImg(imgId,titId){ jQuery('#' + titId ).css('height', "0px") jQuery('#' + titId ).hide() //jQuery('#' + imgId ).css('top', "0px") } function goToUrlProd (modelo6){ var pagWeb = '' idio= '/' + document.location.href.split("/")[(secuenciador + 2)] if(cod_idioma=="1") pagWeb = '/productos#' else pagWeb = '/' + document.location.href.split("/")[(secuenciador + 2)] + '/' + document.location.href.split("/")[(secuenciador + 3)]+'#' var auxUrl2 = urlAux + pagWeb + modelo6 //var auxUrl2 = urlAux + pagWeb + modelo6 +"/?" //jQuery(".searchProd").each( function(index) { //auxUrl2+= jQuery( this ).attr("id") +"=" + jQuery( this ).val() + "&" //}); //var auxUrl2 = 'productos/104305' if(idio == "/ca" || idio == "/en" || idio == "/fr" || idio == "/de" || idio == "/nl"){ location.href = auxUrl2 location.reload(); } else{ location.href = auxUrl2 } } function setCntProd(codigo,tipo){ jQuery('#cntProd' ).html("") var dtsJson ={} dtsJson["cod_idioma"] = cod_idioma switch(tipo){ case "1": dtsJson["action"] = "getProductosSF" dtsJson["codigo"] = codigo break; case "2": dtsJson["action"] = "getProductosST" dtsJson["codigo"] = codigo break; case "3": jQuery('#searcht' ).val("Sch") dtsJson["action"] = "getProductosSCH" jQuery(".searchProd").each( function(index) { dtsJson[jQuery( this ).attr("id")] = jQuery( this ).val() }); break; } jQuery.post( urlAux + '/producto/producto.server.php', dtsJson ,function( data ) { var i=0 var auxTxt='
' var nom="" jQuery.each(data, function(key, value) { if (i==0 ) nom = value.nombre_pad if (value.id){ auxTxt += '
' auxTxt += '
' auxTxt += '
' +value.nombre + '
' auxTxt += '
' auxTxt += ' ' auxTxt += '
' auxTxt += '
' auxTxt += '
' i++; }else{ auxTxt += value.sinarticulo } }); auxTxt += '
' jQuery('#cntProd' ).html(auxTxt) switch (tipo){ case "1": jQuery('#selSubFamilia').attr('flecha'," > ") setNavGen('setCntProd',nom) break; case "2": setImgSld(nom) jQuery('#selSubFamilia').attr('flecha',"") setNavGen('setCntProd2',nom) break; case "3": jQuery('#selSubFamilia').attr('flecha',"") setNavGen('setCntProd3',nom) break; } viewProducto =false },'json'); } function getCntProd(codigo,tipo){ showView('Prod') setCntProd(codigo,tipo) } function showView(x){ switch (x){ case "Subfam": jQuery('.subfam' ).show(); jQuery('.prod' ).hide(); jQuery('.ficha' ).hide(); break; case "Prod": jQuery('.subfam' ).hide(); jQuery('.prod' ).show(); jQuery('.ficha' ).hide(); break; case "Ficha": jQuery('.subfam' ).hide(); jQuery('.prod' ).hide(); jQuery('.ficha' ).show(); break; } } function setCntFicha(modelo6){ jQuery('#cntFicha' ).html("") jQuery.post( urlAux + '/producto/producto.server.php', {action : "getProductosId", modelo6: modelo6, cod_idioma: cod_idioma} ,function( value ) { dataPdf = value var auxTxt= '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += ' ' + value.titfacebook +'' auxTxt += ' ' + value.tittwitter +'' auxTxt += ' ' + value.titmail +'' auxTxt += ' ' + value.titpdf +'' auxTxt += ' ' + value.titcargando +'' auxTxt += '
' auxTxt += '
' + value.titcerrarficha +'
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' var tit = "" if(value.img2title) tit = value.img2title auxTxt += ' ' auxTxt += ' ' +tit + '' auxTxt += ' ' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += ' ' +value.img3title + '' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' //auxTxt += '
' auxTxt += '
' +value.subfamilia auxTxt += '
' auxTxt += '
' +value.modelo auxTxt += '
' //auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' if(value.descripcion) auxTxt += value.descripcion auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += ' ' +value.img4title + '' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += ' Características Técnicas' auxTxt += ' Etiqueta Energética' auxTxt += '
' auxTxt += '
' auxTxt += '
    ' if (value.sellos) jQuery.each(value.sellos, function(key, data) { auxTxt += '
  • ' +data.title + '
  • ' }); auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += ' ' auxTxt += ' ' auxTxt += ' ' auxTxt += ' ' auxTxt += ' ' if (value.carac) jQuery.each(value.carac, function(key, data) { auxTxt += ' ' auxTxt += ' ' auxTxt += ' ' auxTxt += ' ' auxTxt += ' ' }); auxTxt += '
' + value.tittbl + '
' +data.nombre + '' +data.descripcion + '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' jQuery('#cntFicha' ).html(auxTxt) jQuery("a[rel^='prettyPhoto']").prettyPhoto(); if(viewProducto) { setCntSubFamilia(value.id_padre) //alert(jQuery('#searcht' ).val()) switch(jQuery('#searcht' ).val() ){ case "Fam": setCntProd(value.id_familia,"1") setNavGenVP(value.familia,value.subfamilia,value.modelo," > ") break; case "Tip": setCntProd(value.id_subtipo,"2") setNavGenVP("",value.subtipo,value.modelo,"") break; case "Sch": setCntProd(value.id_subtipo,"3") setNavGenVP("",value.resbsq,value.modelo,"") break; } } setNavGen('setCntFicha',value.modelo) if(value.novedad=="1")jQuery( "#novedad" ).show() jQuery( ".toolTipClass" ).tooltip(); },'json'); } function getCntFicha(id){ showView('Ficha') setCntFicha(id) } function setCntSubFamilia(cod_familia){ jQuery('#cntSubFamilia' ).html("") jQuery.post( urlAux + '/producto/producto.server.php', {action : "getSubFamilia", cod_familia: cod_familia, cod_idioma: cod_idioma} ,function( data ) { var i=0 var nom ="" var auxTxt='
' jQuery.each(data, function(key, value) { if (i==0) nom = value.nombre_pad auxTxt += '
' auxTxt += '
' auxTxt += '
' +value.nombre + '
' auxTxt += '
' auxTxt += ' ' auxTxt += '
' auxTxt += '
' auxTxt += '
' i++; }); auxTxt += '
' //alert(auxTxt) jQuery('#cntSubFamilia' ).html(auxTxt) setImgSld(nom) setNavGen('setCntSubFamilia',nom) },'json'); } function setImgSld(nom){ jQuery( ".imgMenuPrp" ).each(function( index ) { if (nom == jQuery( this ).attr('nombre')) jQuery( this ).attr('src',jQuery( this ).attr('img') ) else jQuery( this ).attr('src',jQuery( this ).attr('imgred') ) }); } function getCntSubFamilia(x){ showView("Subfam") setCntSubFamilia(x) } function setNavGenVP(familia,subfamilia,modelo,flecha){ jQuery('#selFamilia').attr('nombre',familia) jQuery('#selSubFamilia').attr('nombre',subfamilia) jQuery('#selSubFamilia').attr('flecha',flecha) if(familia!="") jQuery('#selFamilia').html(' '+jQuery('#selFamilia').attr('nombre')+'') jQuery('#selSubFamilia').html(jQuery('#selSubFamilia').attr('flecha') + ''+jQuery('#selSubFamilia').attr('nombre')+'') jQuery('#selProd').html(" > " + modelo) jQuery('#selProd').attr('nombre',modelo) jQuery('#selFamilia').removeClass('titSeleccionado') jQuery('#selSubFamilia').removeClass('titSeleccionado') jQuery('#selProd').addClass('titSeleccionado') } function setNavGen(tipo,nom){ if(viewProducto) return switch(tipo){ case "setCntSubFamilia": jQuery('#selFamilia').html(nom) jQuery('#selFamilia').attr('nombre',nom) jQuery('#selSubFamilia').html('') jQuery('#selSubFamilia').attr('nombre','') jQuery('#selProd').html('') jQuery('#selProd').attr('nombre','') jQuery('#selFamilia').addClass('titSeleccionado') jQuery('#selSubFamilia').removeClass('titSeleccionado') jQuery('#selProd').removeClass('titSeleccionado') break; case "setCntProd": jQuery('#selFamilia').html(' '+jQuery('#selFamilia').attr('nombre')+'') jQuery('#selSubFamilia').html(jQuery('#selSubFamilia').attr('flecha') + nom) jQuery('#selSubFamilia').attr('nombre',nom) jQuery('#selProd').html('') jQuery('#selProd').attr('nombre','') jQuery('#selFamilia').removeClass('titSeleccionado') jQuery('#selSubFamilia').addClass('titSeleccionado') jQuery('#selProd').removeClass('titSeleccionado') break; case "setCntProd2": jQuery('#selFamilia').html('') jQuery('#selFamilia').attr('nombre','') jQuery('#selSubFamilia').html( nom) jQuery('#selSubFamilia').attr('nombre',nom) jQuery('#selProd').html('') jQuery('#selProd').attr('nombre','') jQuery('#selFamilia').removeClass('titSeleccionado') jQuery('#selSubFamilia').addClass('titSeleccionado') jQuery('#selProd').removeClass('titSeleccionado') break; case "setCntProd3": jQuery('#selFamilia').html('') jQuery('#selFamilia').attr('nombre','') jQuery('#selSubFamilia').html( nom) jQuery('#selSubFamilia').attr('nombre',nom) jQuery('#selProd').html('') jQuery('#selProd').attr('nombre','') jQuery('#selFamilia').removeClass('titSeleccionado') jQuery('#selSubFamilia').addClass('titSeleccionado') jQuery('#selProd').removeClass('titSeleccionado') break; case "setCntFicha": jQuery('#selSubFamilia').html(jQuery('#selSubFamilia').attr('flecha') + ''+jQuery('#selSubFamilia').attr('nombre')+'') jQuery('#selProd').html(" > " + nom) jQuery('#selProd').attr('nombre',nom) jQuery('#selFamilia').removeClass('titSeleccionado') jQuery('#selSubFamilia').removeClass('titSeleccionado') jQuery('#selProd').addClass('titSeleccionado') break; } } function setPlt(){ var auxTxt = '' auxTxt += '' //auxTxt += '
' //auxTxt += '
' //auxTxt += '
' //auxTxt += '
' //auxTxt += '
' //auxTxt += '
' //auxTxt += '
' //auxTxt += ' ' //auxTxt += ' ' //auxTxt += ' ' //auxTxt += '
' //auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '
' auxTxt += '' auxTxt += '' auxTxt += '
' auxTxt += '
' //alert(auxTxt) jQuery("#prodContainer").html(auxTxt) jQuery(".img-caption").hide() } function loadScriptAux(url, callback,typeFile,idFile){ switch (typeFile){ case "js": case "jsExt": var script = document.createElement("script") script.type = "text/javascript"; script.id = idFile; if (script.readyState){ //IE script.onreadystatechange = function(){ if (script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; callback(); } }; } else { //Others script.onload = function(){ callback(); }; } if (typeFile=="js") script.src = urlAux + url; if (typeFile=="jsExt") script.src = url; document.getElementsByTagName("head")[0].appendChild(script); break; case "css": case "cssExt": var head = document.getElementsByTagName("head")[0]; var link = document.createElement('link'); link.id = idFile; link.rel = 'stylesheet'; link.type = 'text/css'; if (typeFile=="css") link.href = urlAux + url; if (typeFile=="cssExt") link.href = url; link.media = 'all'; head.appendChild(link); break; } }