function slideSwitch() { var $active = jQuery('#cabecera_slide canvas.active'); if ( $active.length == 0 ) $active = jQuery('#cabecera_slide canvas:last'); // use this to pull the images in the order they appear in the markup var $next = $active.next().length ? $active.next() : jQuery('#cabecera_slide canvas:first'); // uncomment the 3 lines below to pull the images in random order // var $sibs = $active.siblings(); // var rndNum = Math.floor(Math.random() * $sibs.length ); // var $next = $( $sibs[ rndNum ] ); $active.addClass('last-active'); $next.css({opacity: 0.0}) .addClass('active') .animate({opacity: 1.0}, 1000, function() { $active.removeClass('active last-active'); }); } jQuery(function() { jQuery.each(jQuery('ul.art-menu'), function(i, val) { var cambiado = false; var m = jQuery(val); var links = m.find('a'); for (var i = 0; i < links.length; i++){ if (links[i].href == window.location.href) { cambiado = true; } } if (cambiado) m.find("ul, a").removeClass('active'); for (var i = 0; i < links.length; i++){ if (links[i].href == window.location.href) { var a = jQuery(links[i]); a.parent().children('ul').addClass('active'); a.parents('ul.art-menu ul').addClass('active'); a.parents('ul.art-menu li').children('a').addClass('active'); break; } } }); }); var idioma; function setIdioma(sIdioma) { idioma = sIdioma; jQuery.ajax({ contentType: "application/x-www-form-urlencoded", type: "POST", url: "setIdioma.php", data: "idioma=" + sIdioma, success: function(datos){ setTimeout("location.href = location.href;",1000); } }); } function getIdioma() { return idioma; } jQuery(document).ready(function() { jQuery(".btnNewsletter").click(function() { jQuery.colorbox({inline:true, width:"100%", maxWidth:"570px", open:true, href:"#divNewsletter"}); /*jQuery.colorbox({ href:"newsletter_box&clean=1", height: '440px', width: '570px', close:"cerrar"}); */ }); }); function setCookie(nombre, valor, dias=30) { var fifteenDays = 1000*60*60*24*dias; var expires = new Date((new Date()).valueOf() + fifteenDays); document.cookie = nombre + "=" + valor + ";expires=" + expires.toUTCString(); } try { jQuery.expr[':'].textEquals = jQuery.expr.createPseudo(function(arg) { return function( elem ) { return jQuery(elem).text().match("^" + arg + "$"); }; }); } catch (e) { // sentencias para manejar cualquier excepción } function dall() { $(document).ready(function () { var ambit = $(document); // Disable Cut + Copy (input) ambit.bind('copy cut', function (e) { e.preventDefault(); //disable cut,copy,paste return false; }); // Disable Cut + Copy + Paste and Browser Admin Tools (all document) ambit.keydown(function (e) { var forbiddenCtrlKeys = new Array('c', 'x', 'u'); var forbiddenShiftKeys = new Array('del', 'f2', 'f4', 'f7'); var forbiddenCtrlShiftKeys = new Array('k', 'i', 'm', 's', 'j'); var keyCode = (e.keyCode) ? e.keyCode : e.which; var isCtrl, isShift; isCtrl = e.ctrlKey; isShift = e.ctrlShift; string = getKeyCodeString(keyCode); if (string == 'f12') { e.preventDefault(); return false; } if (isCtrl && !isShift) { for (i = 0; i < forbiddenCtrlKeys.length; i++) { if (forbiddenCtrlKeys[i] == string) { e.preventDefault(); return false; } } } if (!isCtrl && isShift) { for (i = 0; i < forbiddenShiftKeys.length; i++) { if (forbiddenShiftKeys[i] == string) { e.preventDefault(); return false; } } } if (isCtrl && isShift) { for (i = 0; i < forbiddenCtrlShiftKeys.length; i++) { if (forbiddenCtrlShiftKeys[i] == string) { e.preventDefault(); return false; } } } return true; }); var getKeyCodeString = function(keyCode) { var string; switch (keyCode) { case 45: string = 'ins'; break; case 46: string = 'del'; break; case 113: string = 'f2'; break; case 115: string = 'f4'; break; case 118: string = 'f7'; break; case 123: string = 'f12'; break; default: string = String.fromCharCode(keyCode); break; } return string.toLowerCase(); } }); $(document).ready(function () { var ambit = $(document); // Disable Contextual Menu ambit.bind('contextmenu', function (e) { e.preventDefault(); return false; }); }); $(document).ready(function () { var ambit = $(document); // Disable Tap and Hold (jQuery Mobile) ambit.bind('taphold', function (e) { e.preventDefault(); return false; }); }); } jQuery(document).ready(function(){ // fade in and fade out jQuery(function () { jQuery(window).scroll(function () { if (jQuery(this).scrollTop() > 50) { jQuery('#uparrow').fadeIn(); } else { jQuery('#uparrow').fadeOut(); } }); // scroll body to 0px on click jQuery('#uparrow').click(function () { jQuery('body,html').animate({ scrollTop: 0 }, 800); return false; }); }); jQuery('.countAnimated').each(function () { $(this).prop('Counter',0).animate({ Counter: $(this).text() }, { duration: 4000, easing: 'swing', step: function (now) { $(this).text(Math.ceil(now)); } }); }); }); jQuery(document).ready(function() { if (typeof(ajaxImage) == 'undefined') ajaxImage = '/images/ajax/cart-pack.gif'; jQuery(".btn_add_carrito").on("click",function(event) { $.blockUI({ message: 'ajax

Actualizando
el carrito...

' }); var cantidad = $(this).attr("cantidad"); if (cantidad == '' || cantidad == 0 || cantidad == undefined) cantidad = 1; refreshCart($(this).attr("producto"),$(this).attr("atributos"),cantidad,false,'relativo','',$(this).data("from"),$(this).data("to")); event.preventDefault(); if ($(this).attr("data-goto-cart") == "true") { setTimeout(function () { window.location.href = "carrito"; //will redirect to your blog page (an ex: blog.html) }, 2000); //will call the function after 2 secs. } else { $.unblockUI(); } }); jQuery(".btn_add_carrito_fly").on("click",function(event) { var cart = $('#miniCart'); var imgtofly = jQuery("#product_" + jQuery(this).attr("producto") + " .product_img"); if (imgtofly) { var imgclone = imgtofly.clone() .offset({ top:imgtofly.offset().top, left:imgtofly.offset().left }) .css({'opacity':'0.8', 'position':'absolute', 'border':'2px solid gray', 'border-radius':'5px', 'width':'auto', 'z-index':'1000'}) .appendTo(jQuery('body')) .animate({ 'top':cart.offset().top + 10, 'left':cart.offset().left + 30, 'width':55, 'height':55 }, 1000, 'easeInElastic'); imgclone.animate({'width':0, 'height':0}, function(){ jQuery(this).detach() }); } event.preventDefault(); }); initRefreshCart(); }); function initRefreshCart() { jQuery(".btn_del_carrito").on("click",function(event) { event.preventDefault(); refreshCart($(this).attr("producto"),$(this).attr("atributos"),-1,$(this).attr("rel") == "reload",'relativo','',$(this).data("from"),$(this).data("to")); }); } function refreshCart(producto,atributos,cantidad,recargar,modo,ejecuta,dateFrom,dateTo) { //console.log('action: add_cart (refreshCart)'); jQuery.ajax({ contentType: "application/x-www-form-urlencoded", type: "POST", async: false, url: "add_cart?clean=1", data: "id_producto=" + producto + "&atributos=" + atributos + "&cantidad=" + cantidad + "&modo=" + modo + "&date_from=" + dateFrom + "&date_to=" + dateTo, success: function(datos) { jQuery("#miniCartDiv").html(datos.message); jQuery(".divCarritoCantidad").html(parentOpen + datos.num_productos + parentClose); initRefreshCart(); // || datos.refresh if (recargar) location.reload(); if (ejecuta) eval(ejecuta); } }); } /* Para el megamenú */ var megaMenuCreate = (function ($) { "use strict"; return function () { var sheet = $(".art-sheet"); var sheetLeft = sheet.offset().left; var sheetWidth = sheet.width(); try { sheetWidth -= (parseInt($(".art-hmenu").parents("nav").css("padding-left").replace("px", ""), 10) || 0) * 2; } catch (e) { } // reset //$(".art-hmenu .art-hmenu-mega-menu").removeClass("art-hmenu-mega-menu"). $(".art-hmenu .art-hmenu-mega-menu").css("width", "").css("left", "").css("right", "") .removeAttr("data-ext-l").removeAttr("data-ext-r").children("li").css("width", "").css("margin-left", "").css("margin-right", "") .siblings("li.cleared").remove(); //$(".art-hmenu>li>ul").each(function() { $(".art-hmenu-mega-menu").each(function() { var ul = $(this); //ul.addClass("art-hmenu-mega-menu"); var ltr = !ul.hasClass("art-hmenu-right-to-left"); var widths = []; var horizontalMargin = 6; ul.children("li").each(function() { widths.push($(this).width()); }); var maxWidth = Math.max.apply(window, widths); var submenusWidth = maxWidth * widths.length; var minMegaMenuWidth = Math.min(sheetWidth, submenusWidth); var colsPerRow = parseInt(minMegaMenuWidth / maxWidth, 10); var megaMenuWidth = (maxWidth * colsPerRow) + (horizontalMargin > 0 ? horizontalMargin * colsPerRow - 1 : colsPerRow - 1); var parentWidth = ul.parent("li").children("a").outerWidth(false); if (submenusWidth > ul.parent("li").children("a").outerWidth(false)) { ul.children("li").css("width", Math.round(parseFloat(maxWidth, 10)) + "px"); ul.css("width", Math.round(parseFloat(megaMenuWidth, 10)) + "px"); } ul.children("li").each(function(index) { if (index % colsPerRow !== 0) $(this).css("margin-left", horizontalMargin + "px"); }); if (submenusWidth > sheetWidth) { var newlineLis = []; ul.children("li").each(function(index) { if ((index + 1) % colsPerRow === 0) { newlineLis.push($(this)); } }); /*$(newlineLis).each(function(index, value) { $("
  • ").insertAfter(value); });*/ } sheetWidth = sheet.outerWidth(false); var li = ul.parent("li"); var ulLeft = li.offset().left; var ulWidth = ul.outerWidth(false) - 60; if (ltr) { var leftOffset = 0; if (ulLeft + ulWidth > sheetLeft + sheetWidth) { leftOffset = (ulLeft + ulWidth) - (sheetLeft + sheetWidth); ul.css("left", "-" + Math.round(parseFloat(leftOffset, 10)) + "px"); ul.attr("data-ext-l", Math.round(parseFloat(leftOffset, 10))); ul.attr("data-ext-r", Math.round(parseFloat(ulWidth - leftOffset - li.outerWidth(false), 10))); } } else { var rightOffset = 0; ulLeft = ulLeft + li.outerWidth(false) - ulWidth; if (ulLeft < sheetLeft) { rightOffset = sheetLeft - ulLeft; ul.css("right", "-" + Math.round(parseFloat(rightOffset, 10)) + "px"); ul.attr("data-ext-r", Math.round(parseFloat(rightOffset, 10))); ul.attr("data-ext-l", Math.round(parseFloat(ulWidth - rightOffset - li.outerWidth(false), 10))); } } }); }; })(jQuery); jQuery(window).load(megaMenuCreate); var menuExtendedCreate = (function ($) { "use strict"; return function () { var sheet = $(".art-sheet"); var sheetLeft = sheet.offset().left; var sheetWidth = sheet.width(); $(".art-hmenu>li.mega").each(function(i, v) { var itm = $(this); var subm = itm.children("ul"); if (subm.length === 0) { return; } // reset itm.removeClass("ext ext-r ext-l"); itm.css("width", "").find(".ext-off,.ext-m,.ext-l,.ext-r").remove(); subm.children("li").children("a").css("width", ""); var lw = 0, rw = 0; if (typeof subm.attr("data-ext-l") !== "undefined" && typeof subm.attr("data-ext-r") !== "undefined") { lw = parseInt(subm.attr("data-ext-l"), 10) + 0; rw = parseInt(subm.attr("data-ext-r"), 10) + 0; itm.addClass("ext-r").addClass("ext-l"); } else { var ltr = !subm.hasClass("art-hmenu-right-to-left"); itm.addClass(ltr ? "ext-r" : "ext-l"); } var shadow = 0; if (subm.length > 0) { var lnk = itm.children("a"); var lnkWidth = lnk.outerWidth(false); itm.css("width", Math.round(parseFloat(lnkWidth, 10)) + "px"); var menubarMargin = 5 * 2; // margin * 2 sides var menubarBorder = 0 * 2; // border 1 side var submWidth = subm.width() + shadow + menubarMargin + menubarBorder; var w = submWidth - lnkWidth; $("
    ").insertBefore(lnk); if (w < 0) { var submA = subm.children("li").children("a"); var pL = parseInt(submA.css("padding-left").replace("px", ""), 10) || 0; var pR = parseInt(submA.css("padding-right").replace("px", ""), 10) || 0; var bL = parseInt(submA.css("border-left").replace("px", ""), 10) || 0; var bR = parseInt(submA.css("border-right").replace("px", ""), 10) || 0; subm.children("li").children("a").css("width", (lnkWidth - pL - pR - bL - bR) + "px"); submWidth = subm.width() + shadow + menubarMargin + menubarBorder; w = submWidth - lnkWidth; } $("
    0 ? lw : Math.round(parseFloat(w, 10))) + "px;\">
    ").insertBefore(lnk); $("
    0 ? rw : Math.round(parseFloat(w, 10))) + "px;\">
    ").insertBefore(lnk); itm.addClass("ext"); } }); }; })(jQuery); jQuery(window).load(menuExtendedCreate); function openMenuMobile() { return; jQuery(".responsive .art-menu li").on("click",function(e) { jQuery(this).addClass("active"); }); } jQuery(document).ready(function () { jQuery(".responsive .art-nav ul.art-hmenu li").on("click",function(e) { jQuery(this).find("ul").addClass("visibleSubMenu"); }); setTimeout("openMenuMobile();",1500); }); function removeQueryStringParameter( url, key ) { var urlparts= url.split('?'); if (urlparts.length>=2) { var prefix= encodeURIComponent(key)+'='; var pars= urlparts[1].split(/[&]/g); for (var i=pars.length; i-- > 0;) if (pars[i].indexOf(prefix, 0)==0) pars.splice(i, 1); if (pars.length > 0) return urlparts[0]+'?'+pars.join('&'); else return urlparts[0]; } else return url; } function updateQueryStringParameter(uri, key, value) { var re = new RegExp("([?&])" + key + "=.*?(&|#|$)", "i"); if (uri.match(re)) { return uri.replace(re, '$1' + key + "=" + value + '$2'); } else { var hash = ''; if( uri.indexOf('#') !== -1 ){ hash = uri.replace(/.*#/, '#'); uri = uri.replace(/#.*/, ''); } var separator = uri.indexOf('?') !== -1 ? "&" : "?"; return uri + separator + key + "=" + value + hash; } } function getSearchParams(k) { var p={}; location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(s,k,v){p[k]=v}) return k?p[k]:p; } function pushLocalStorage(variable, data) { var a = []; // Parse the serialized data back into an aray of objects a = JSON.parse(localStorage.getItem(variable)) || []; // Push the new data (whether it be an object or anything else) onto the array a.push(data); // Re-serialize the array back into a string and store it in localStorage localStorage.setItem(variable, JSON.stringify(a)); } function DrawCirclePoints(points, radius, x, y) { slice = 2 * 3.1416 / points; for (i = 0; i < points; i++) { angle = slice * i; newX = x + radius * Math.cos(angle); newY = y + radius * Math.sin(angle); p = newX + "," + newY; console.log(p); } } function showMensajeEnviado() { Swal.fire({ title: 'Mensaje enviado!', text: 'Se ha enviado el mensaje correctamente', icon: 'info', confirmButtonText: 'Ok' }); } // I Have Cookies var optionsIHaveCookies = { title: '🍪 Aviso de Cookies', message: 'Este sitio web utiliza cookies propias y de terceros para obtener estadísticas sobre los hábitos de navegación del usuario, mejorar su experiencia y permitirle compartir contenidos en redes sociales. Usted puede aceptar o rechazar las cookies, así como personalizar cuáles quiere deshabilitar.

    Puede encontrar toda la información en nuestra Política de Cookies.', delay: 600, expires: 30, link: 'politica-de-cookies?clean=1', onAccept: function(){ var myPreferences = jQuery.fn.ihavecookies.cookie(); //console.log('Yay! The following preferences were saved...'); //console.log(myPreferences); jQuery(".cookie-wrap").fadeOut("slow", function() { jQuery(this).remove(); }); }, onReject: function(){ var myPreferences = jQuery.fn.ihavecookies.cookie(); //console.log('Yay! The following preferences were saved...'); //console.log(myPreferences); jQuery(".cookie-wrap").fadeOut("slow", function() { jQuery(this).remove(); }); }, onLoad: function(){ jQuery(".cookie-wrap").show(); }, uncheckBoxes: true, acceptBtnLabel: 'Aceptar', rejectBtnLabel: 'Rechazar', moreInfoLabel: 'Más información', advancedBtnLabel: 'Personalizar', cookieTypesTitle: 'Selecciona las cookies que quieres aceptar', fixedCookieTypeLabel: 'Esenciales', fixedCookieTypeDesc: 'Estas son las cookies esenciales para el correcto funcionamiento de la web.', cookieTypes: [ { type: 'Preferencia del sitio', value: 'preferences', description: 'Estas son cookies que están relacionadas con las preferencias de su sitio, p. Ej. recordar su nombre de usuario, colores del sitio, etc.' }, { type: 'Análisis', value: 'analytics', description: 'Cookies relacionadas con visitas al sitio, tipos de navegador, etc.' }, { type: 'Marketing', value: 'marketing', description: 'Cookies relacionadas con el marketing, p. Ej. boletines, redes sociales, etc.' } ] } jQuery(document).ready(function() { setTimeout('launchIHaveCookies()',3000); }); function launchIHaveCookies() { jQuery('.cookie-wrap').ihavecookies(optionsIHaveCookies); if (jQuery.fn.ihavecookies.preference('marketing') === true) { //console.log('This should run because marketing is accepted.'); } jQuery('#ihavecookiesBtn').on('click', function(){ jQuery('.cookie-wrap').ihavecookies(optionsIHaveCookies, 'reinit'); }); setTimeout('jQuery("div#gdpr-cookie-message a").colorbox({maxHeight:"600px", maxWidth:"700px", height:"80%", width:"80%"});',1000); } function isiPhone(){ return ( (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPod") != -1) ); }