/*! WOW - v0.1.9 - 2014-05-10
* Copyright (c) 2014 Matthieu Aussaguel; Licensed MIT */(function(){var a,b,c=function(a,b){return function(){return a.apply(b,arguments)}};a=function(){function a(){}return a.prototype.extend=function(a,b){var c,d;for(c in a)d=a[c],null!=d&&(b[c]=d);return b},a.prototype.isMobile=function(a){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(a)},a}(),b=this.WeakMap||(b=function(){function a(){this.keys=[],this.values=[]}return a.prototype.get=function(a){var b,c,d,e,f;for(f=this.keys,b=d=0,e=f.length;e>d;b=++d)if(c=f[b],c===a)return this.values[b]},a.prototype.set=function(a,b){var c,d,e,f,g;for(g=this.keys,c=e=0,f=g.length;f>e;c=++e)if(d=g[c],d===a)return void(this.values[c]=b);return this.keys.push(a),this.values.push(b)},a}()),this.WOW=function(){function d(a){null==a&&(a={}),this.scrollCallback=c(this.scrollCallback,this),this.scrollHandler=c(this.scrollHandler,this),this.start=c(this.start,this),this.scrolled=!0,this.config=this.util().extend(a,this.defaults),this.animationNameCache=new b}return d.prototype.defaults={boxClass:"wow",animateClass:"animated",offset:0,mobile:!0},d.prototype.init=function(){var a;return this.element=window.document.documentElement,"interactive"===(a=document.readyState)||"complete"===a?this.start():document.addEventListener("DOMContentLoaded",this.start)},d.prototype.start=function(){var a,b,c,d;if(this.boxes=this.element.getElementsByClassName(this.config.boxClass),this.boxes.length){if(this.disabled())return this.resetStyle();for(d=this.boxes,b=0,c=d.length;c>b;b++)a=d[b],this.applyStyle(a,!0);return window.addEventListener("scroll",this.scrollHandler,!1),window.addEventListener("resize",this.scrollHandler,!1),this.interval=setInterval(this.scrollCallback,50)}},d.prototype.stop=function(){return window.removeEventListener("scroll",this.scrollHandler,!1),window.removeEventListener("resize",this.scrollHandler,!1),null!=this.interval?clearInterval(this.interval):void 0},d.prototype.show=function(a){return this.applyStyle(a),a.className=""+a.className+" "+this.config.animateClass},d.prototype.applyStyle=function(a,b){var c,d,e;return d=a.getAttribute("data-wow-duration"),c=a.getAttribute("data-wow-delay"),e=a.getAttribute("data-wow-iteration"),this.animate(function(f){return function(){return f.customStyle(a,b,d,c,e)}}(this))},d.prototype.animate=function(){return"requestAnimationFrame"in window?function(a){return window.requestAnimationFrame(a)}:function(a){return a()}}(),d.prototype.resetStyle=function(){var a,b,c,d,e;for(d=this.boxes,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.setAttribute("style","visibility: visible;"));return e},d.prototype.customStyle=function(a,b,c,d,e){return b&&this.cacheAnimationName(a),a.style.visibility=b?"hidden":"visible",c&&this.vendorSet(a.style,{animationDuration:c}),d&&this.vendorSet(a.style,{animationDelay:d}),e&&this.vendorSet(a.style,{animationIterationCount:e}),this.vendorSet(a.style,{animationName:b?"none":this.cachedAnimationName(a)}),a},d.prototype.vendors=["moz","webkit"],d.prototype.vendorSet=function(a,b){var c,d,e,f;f=[];for(c in b)d=b[c],a[""+c]=d,f.push(function(){var b,f,g,h;for(g=this.vendors,h=[],b=0,f=g.length;f>b;b++)e=g[b],h.push(a[""+e+c.charAt(0).toUpperCase()+c.substr(1)]=d);return h}.call(this));return f},d.prototype.vendorCSS=function(a,b){var c,d,e,f,g,h;for(d=window.getComputedStyle(a),c=d.getPropertyCSSValue(b),h=this.vendors,f=0,g=h.length;g>f;f++)e=h[f],c=c||d.getPropertyCSSValue("-"+e+"-"+b);return c},d.prototype.animationName=function(a){var b;try{b=this.vendorCSS(a,"animation-name").cssText}catch(c){b=window.getComputedStyle(a).getPropertyValue("animation-name")}return"none"===b?"":b},d.prototype.cacheAnimationName=function(a){return this.animationNameCache.set(a,this.animationName(a))},d.prototype.cachedAnimationName=function(a){return this.animationNameCache.get(a)},d.prototype.scrollHandler=function(){return this.scrolled=!0},d.prototype.scrollCallback=function(){var a;return this.scrolled&&(this.scrolled=!1,this.boxes=function(){var b,c,d,e;for(d=this.boxes,e=[],b=0,c=d.length;c>b;b++)a=d[b],a&&(this.isVisible(a)?this.show(a):e.push(a));return e}.call(this),!this.boxes.length)?this.stop():void 0},d.prototype.offsetTop=function(a){for(var b;void 0===a.offsetTop;)a=a.parentNode;for(b=a.offsetTop;a=a.offsetParent;)b+=a.offsetTop;return b},d.prototype.isVisible=function(a){var b,c,d,e,f;return c=a.getAttribute("data-wow-offset")||this.config.offset,f=window.pageYOffset,e=f+this.element.clientHeight-c,d=this.offsetTop(a),b=d+a.clientHeight,e>=d&&b>=f},d.prototype.util=function(){return this._util||(this._util=new a)},d.prototype.disabled=function(){return!this.config.mobile&&this.util().isMobile(navigator.userAgent)},d}()}).call(this);
//breakpoint
!function(t){t.breakpoint={els:t(),init:!1},t.fn.breakpoint=function(){return t.breakpoint.els=t.breakpoint.els.add(this),t.breakpoint.init||t(window).on("resize.breakpoint",function(){t.breakpoint.els.trigger("swapres.breakpoint")}),this.each(function(){var n=t(this),e=[],o=[];n.data("m1src",n.attr("src")),t.each(n.data(),function(t){if(t&&(0===t.toLowerCase().indexOf("maxwidth")||0===t.toLowerCase().indexOf("minwidth"))){var n=t.substring(3).match(/\d+/g);if(1===n.length){var i={key:t,type:0===t.toLowerCase().indexOf("max")?"max":"min",width:n[0]};"max"===i.type?e.push(i):o.push(i)}}}),console.log(o),o.sort(function(t,n){return t.width-n.width}),console.log(o),console.log(e),e.sort(function(t,n){return n.width-t.width}),console.log(e),n.on("swapres.breakpoint",function(){if(console.log("swapres"),e.length>0||o.length>0){var i=t(window).width(),a=null;t.each(e,function(t,n){i<=n.width&&(console.log("matched breakpoint: "+n.key),a=n)}),t.each(o,function(t,n){i>=n.width&&(console.log("matched breakpoint: "+n.key),a=n)}),null!=a?(console.log("using breakpoint: "+a.key),n.attr("src",n.data(a.key))):(console.log("using mobile1st"),n.attr("src",n.data("m1src")))}else console.log("using mobile1st"),n.attr("src",n.data("m1src"))}).trigger("swapres.breakpoint")})}}(jQuery),$(function(){$(".breakpoint img").breakpoint()});


/* COM100023 Add to Cart Remote. Todo Nuevo*/
//
// jquery.alertable.js - Minimal alert, confirmation, and prompt alternatives.
//
// Developed by Cory LaViska for A Beautiful Site, LLC
//
// Licensed under the MIT license: http://opensource.org/licenses/MIT
//
jQuery&&function(e){"use strict";function t(t,u,s){var d=e.Deferred();return i=document.activeElement,i.blur(),e(l).add(r).remove(),s=e.extend({},e.alertable.defaults,s),l=e(s.modal).hide(),r=e(s.overlay).hide(),n=e(s.okButton),o=e(s.cancelButton),s.html?l.find(".alertable-message").html(u):l.find(".alertable-message").text(u),"prompt"===t?l.find(".alertable-prompt").html(s.prompt):l.find(".alertable-prompt").remove(),e(l).find(".alertable-buttons").append("alert"===t?"":o).append(n),e(s.container).append(r).append(l),s.show.call({modal:l,overlay:r}),"prompt"===t?e(l).find(".alertable-prompt :input:first").focus():e(l).find(':input[type="submit"]').focus(),e(l).on("submit.alertable",function(r){var n,o,i=[];if(r.preventDefault(),"prompt"===t)for(o=e(l).serializeArray(),n=0;n<o.length;n++)i[o[n].name]=o[n].value;else i=null;a(s),d.resolve(i)}),o.on("click.alertable",function(){a(s),d.reject()}),e(document).on("keydown.alertable",function(e){27===e.keyCode&&(e.preventDefault(),a(s),d.reject())}),e(document).on("focus.alertable","*",function(t){e(t.target).parents().is(".alertable")||(t.stopPropagation(),t.target.blur(),e(l).find(":input:first").focus())}),d.promise()}function a(t){t.hide.call({modal:l,overlay:r}),e(document).off(".alertable"),l.off(".alertable"),o.off(".alertable"),i.focus()}var l,r,n,o,i;e.alertable={alert:function(e,a){return t("alert",e,a)},confirm:function(e,a){return t("confirm",e,a)},prompt:function(e,a){return t("prompt",e,a)},defaults:{container:"body",html:!1,cancelButton:'<button class="alertable-cancel" type="button">Cancel</button>',okButton:'<button class="alertable-ok" type="submit">OK</button>',overlay:'<div class="alertable-overlay"></div>',prompt:'<input class="alertable-input" type="text" name="value">',modal:'<form class="alertable"><div class="alertable-message"></div><div class="alertable-prompt"></div><div class="alertable-buttons"></div></form>',hide:function(){e(this.modal).add(this.overlay).fadeOut(100)},show:function(){e(this.modal).add(this.overlay).fadeIn(100)}}}}(jQuery);


/* COM100023 Add to Cart Remote. Todo Nuevo*/
//Agregar al carrito en pagina
var comercio4 = {
	/* COM100023 Add to Cart Remote. Todo Nuevo*/
	ShowFiltros:function(message,options) {	
		$(".sidebar_section").toggle();
		if($("#showsection").innerHTML()=="Ocultar Filtro") 
			$("#showsection").innerHTML ("Mostrar Filtro");  
		else	
			$("#showsection").innerHTML ("Ocultar Filtro");  
		
	},
	
	ShowSearch:function(message,options) {	
		$(".hideonseach").hide();
		$("#searchlink").hide();  
		$("#search").removeClass('d-none');
	},
	DoSearch:function(searchname) {	
		
		var myForm = $(searchname);
		

		if(myForm[0].checkValidity()) {
			myForm.submit();
		}
		
	},
	Alert4:function(message,options) {	
		$.alertable.alert(message,options);
	},
	gotocart:function() {	
	  window.location.replace("/cart.php");	
	},
	HandleAddtoCartExtra :function(response) {	
		if (response.status=1)
		{window.location.reload(false);}
	
	},
	HandleAddtoCart:function(response) {	
		if(response.status == 1) {	
			if(response.ocultar>0)
			{
				
				$.alertable.confirm(response.msg , 
						{html: true 
						, cancelButton:'<button style="    background-color: gray;color:white" class="alertable-cancel" type="button">Seguir Comprando</button>'
						, okButton: '<button onclick="comercio4.gotocart()" class="alertable-ok" type="button">Terminar Pedido</button>'
						} 
						
						).then(function() {
							alert('');
					  //;				
					} 
					);
									
			}
			else
			{
				comercio4.Alert4(response.msg);	
			}
			$("#finalizarboton").show('slide');
			
			$("#checkout_items").hide();
			$("#checkout_items").show('highlight');
			$('#checkout_items').text(response.items,''); 
			$("#cantidaddeitemsencart").hide();
			$("#cantidaddeitemsencart").show('highlight');
			$('#cantidaddeitemsencart').text(response.items,'');
							
			
			
		}
		else {
			comercio4.Alert4(response.msg,'');
			
		}
		
		
	},
	ClickThumbImage: function(itemid ) {	
	
	
		var thumbs = $('.single_product_thumbnails ul li');
		var singleImage = $('#single_product_image_img');
		var item=$('#thumbli-'+itemid);
		
		thumbs.removeClass('active');
		
		item.addClass('active');
		var img = item.find('img').data('image');
		console.log(img);
		singleImage.attr('src', img);
		
	
	},

		
	ChangeImage: function(productid,thumb,zoom ) {	
		if (thumb!="" && (thumb.includes('jpg') || thumb.includes('png')) )
		{
			$(productid  ).attr('src', thumb);
		}
	},
	HandleSelectVariation: function(response) {	
	   if(response.status == 1) {
		   
			//$("#single_product_image_background").css("background-image", "url("+response.imagenprincipal+")");  	
			$("#single_product_image_img").attr('src',response.imagenprincipal);  	
			
			$("#single_product_thumbnails ul").html(response.thumbs)
		}
		
	},
	SelectVariation: function(variationid,titulo ) {	
		$(".mlvariationitemli").removeClass('Selected');
		$("#li-"+variationid).addClass('Selected');
		$("#mlvariationselected").html(titulo);
		
		$("#mlvariationid").val(variationid);
		
		
		$.ajax({
			url: 'remote.php',
			type: 'post',
			dataType: 'json',
			data: 'w=mlvariationsimages&variationid='+ variationid,			
			success: comercio4.HandleSelectVariation
		});
		return false;
		
	},
	
	ChangeDesc: function(productid,descripcion,id) {	
	
		if (descripcion!='')
		{						
			$(productid).html(descripcion);		
		}
		var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform)
		if (iOS==true)
			comercio4.AddToCart(id);
		
	},
	HandleConfirmarReview: function(response) {	
	   if(response.status == 1) {
			window.location.replace("/reviews-gracias?rcm="+response.redirect);				
		}
		else
		{
			comercio4.Alert4("<b>"+response.error+"</b>", {html: true});
		}
	},
	
	HandleConfirmarPedido: function(response) {	
	    if(response.status == 1) {
			window.location.replace("/finishorder.php?provider="+response.provider);				
		}
		else
		{
			comercio4.Alert4("<b>Revisá tu Pedido ya que no pudo ser enviado</b>", {html: true});
		}
	},


	cambiarvalor: function (productid,maximo)
	{
		
		objeto=$('#qty_'+productid)
		var value = $(objeto).val();
		var x = parseInt(value);
		
		if (!isNaN(x))
		{
			if (maximo>x)
			{
				
				cantidad=x;
			}
			else
				comercio4.Alert4("Ya llegaste a la cantidad máxima (" + maximo+ ") que podes agregar de este producto");	 
		}

	},
	sumar: function (productid,maximo)
	{
		
		objeto=$('#qty_'+productid)
		var value = $(objeto).val();
		var x = parseInt(value);
		
		if (maximo>x)
		{
			
			$(objeto).val(x +1);
			cantidad=x +1;
			
			//comercio4.seleccionarRow(productid,x,cantidad);
		}
		else
			comercio4.Alert4("Ya llegaste a la cantidad máxima que podes agregar de este producto");	 
		

	},
	
	restar:  function (productid,minimo)
	{
		objeto=$('#qty_'+productid)
		var value = $(objeto).val();
		
		var x = parseInt(value);
		
		if (x>minimo)
		{
	
	
			$(objeto).val(x -1);
			cantidad=x -1;
		
			//comercio4.seleccionarRow(productid,x,cantidad);
		}
	},
	
	
	AddToCartDirectoPrefix: function(prefix,productid) {	
		gtag('event', 'add_to_cart', {
			"items": [
			  {
				"id": productid,
				"list_position": 1,
				"quantity":  1, 
			  }
			]
		  });
		  fbq('track', 'AddToCart', { 
		  content_type: 'product',
		  content_ids: productid,
		  currency: 'ARS',
		  value: 100});

		$.ajax({
	url: '/remote.php',
	type: 'post',
	dataType: 'json',
	data: 'w=comercio4AddtoCart&'+$('#'+prefix+productid).serialize(),	
	success:  comercio4.HandleAddtoCart
	});
},

	AddToCartDirecto: function(productid) {	
		gtag('event', 'add_to_cart', {
			"items": [
			  {
				"id": productid,
				"list_position": 1,
				"quantity":  1, 
			  }
			]
		  });
		  fbq('track', 'AddToCart', { 
		  content_type: 'product',
		  content_ids: productid,
		  currency: 'ARS',value: 100});	
			$.ajax({
		url: '/remote.php',
		type: 'post',
		dataType: 'json',
		data: 'w=comercio4AddtoCart&'+$('#productDetailsAddToCartForm_'+productid).serialize(),	
		success:  comercio4.HandleAddtoCart
		});
	},
	
	
}
/* COM100023 Add to Cart Remote. Todo Nuevo*/


