jQuery(init); function init(){ menumovil(); submenu(); filtros(); if((typeof(cargamapa)!='undefined')&&(cargamapa)) { elmapa(); } if((typeof(cargagaleria)!='undefined')&&(cargagaleria)) { elfotorama(); } tabs(); } function filtros(){ jQuery(".filtro > .titulo").click(function(){ if (jQuery(this).next("ul").css("max-height")!="0px") { jQuery(this).next("ul").css("max-height","0px"); jQuery(this).parent().addClass("cerrado"); jQuery(this).parent().removeClass("abierto"); }else{ jQuery(this).next("ul").css("max-height","500px"); jQuery(this).parent().removeClass("cerrado"); jQuery(this).parent().addClass("abierto"); } }); } function menumovil(){ jQuery(".boton_menu").click(function(){ if (jQuery("#menu-principal").css("display")=="none") { jQuery("#menu-principal").css("display","block"); }else{ jQuery("#menu-principal").css("display","none"); } }); } function submenu(){ jQuery(".menu-item.padre").after().click(function(){ if (jQuery(this).children(".submenu").css("display")=="none") { jQuery(this).children(".submenu").css("display","block"); }else{ jQuery(this).children(".submenu").css("display","none"); } }); } function elmapa(){ var map; function initialize() { var myLatlng = new google.maps.LatLng(39.4536419,-0.3608697); var mapOptions = { zoom:14, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROAD, disableDefaultUI: true, scrollwheel: true, mapTypeControl: true, streetViewControl: true, panControl: true, zoomControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.SMALL }, styles: [ ] }; map = new google.maps.Map(document.getElementById('elmapa'), mapOptions); var customIcon ={ }; var marker = new google.maps.Marker({ position: myLatlng, map: map, title: 'Centro Óptico Las Artes', icon: {url:'img/marker.png',} }); }//initialize google.maps.event.addDomListener(window, 'load', initialize); }//elmapa function actualizafotorama(antiguosfotoramas,fotoramaobj){ //jQuery("#caja-fotos-producto .datos .descargar").attr("href",fotoramaobj.img); var url = jQuery(antiguosfotoramas[fotoramaobj.i-1]).attr("rel"); var titulo = jQuery(antiguosfotoramas[fotoramaobj.i-1]).attr("title"); if(url){ jQuery("#caja-fotos-producto .datos .descargar").attr("href",url); jQuery("#caja-fotos-producto .datos .descargar").css("display","block"); }else{ jQuery("#caja-fotos-producto .datos .descargar").attr("href",""); jQuery("#caja-fotos-producto .datos .descargar").css("display","none"); } if(titulo){ jQuery("#caja-fotos-producto .datos p").html(titulo); jQuery("#caja-fotos-producto .datos p").css("display","block"); }else{ jQuery("#caja-fotos-producto .datos p").html(""); jQuery("#caja-fotos-producto .datos p").css("display","none"); } } function elfotorama(){ var antiguosfotoramas = jQuery("#fotos-producto img"); var fotoramaDiv = jQuery('#fotos-producto').fotorama(); var fotorama = fotoramaDiv.data('fotorama'); actualizafotorama(antiguosfotoramas,fotorama.activeFrame); fotoramaDiv.on('fotorama:ready ' + 'fotorama:show',function(e, fotorama, extra) { actualizafotorama(antiguosfotoramas,fotorama.activeFrame); }); } function tabs(){ jQuery(".tabs .tab h5").click(function(){ console.log("s"); jQuery(this).parent().toggleClass("active"); }); } function decision(message, url){ if(confirm(message)) location.href = url; } function calculaGastos() { if (document.getElementById("ubicacion").value=="1") { if (total_pedido<100) { gastos_envio=7; } else { gastos_envio=0;} } if (document.getElementById("ubicacion").value=="5") { gastos_envio=20; } if (document.getElementById("ubicacion").value=="2") { gastos_envio=22; } if (document.getElementById("ubicacion").value=="6") { gastos_envio=40; } if (document.getElementById("ubicacion").value=="7") { gastos_envio=35; } if (document.getElementById("ubicacion").value=="8") { gastos_envio=50; } if (document.getElementById("ubicacion").value=="3") { gastos_envio=50; } if (document.getElementById("ubicacion").value=="4") { gastos_envio=90; } if (document.getElementById("ubicacion").value=="9") { gastos_envio=110; } if (gastos_envio>0) { document.getElementById("strgastos_envio").innerHTML=gastos_envio.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + "€"; } else {document.getElementById("strgastos_envio").innerHTML="GRATIS";} if (envio_internacional==1) { gastos_envio=0; document.getElementById("strgastos_envio").innerHTML="INCLUIDOS"; } document.getElementById("gastos_envio").value=gastos_envio; if (document.getElementById("ubicacion").value=="3" || document.getElementById("ubicacion").value=="4" || document.getElementById("ubicacion").value=="9") { var totalpedido=total_pedido/1.1; var totalcongastos=gastos_envio+totalpedido; document.getElementById("total_pedido").value=totalcongastos; document.getElementById("total").innerHTML=totalpedido.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + "€" document.getElementById("strtotal_pedido").innerHTML=totalcongastos.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + "€ (IVA NO Incluido)" } else { var totalcongastos=gastos_envio+total_pedido; document.getElementById("total_pedido").value=totalcongastos; document.getElementById("total").innerHTML=total_pedido.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + "€" document.getElementById("strtotal_pedido").innerHTML=totalcongastos.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + "€ (IVA Incluido)" } var comisionpaypal=totalcongastos*0.035 + 0.7; document.getElementById("comisionpaypal").innerHTML="(+ "+comisionpaypal.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + "€ de comisión de pago)"; } function copiaDatos() { document.getElementById("factura_nombre").value=document.getElementById("nombre").value; document.getElementById("factura_apellidos").value=document.getElementById("apellidos").value; document.getElementById("factura_direccion").value=document.getElementById("direccion").value; document.getElementById("factura_poblacion").value=document.getElementById("poblacion").value; document.getElementById("factura_provincia").value=document.getElementById("provincia").value; document.getElementById("factura_cpostal").value=document.getElementById("cpostal").value; document.getElementById("factura_nif").value=document.getElementById("nif").value; }