if(document.all){document.onhelp=function(){location.href="admin/";return false}}else{document.onkeydown=function(a){if(a.keyCode=="112"){location.href="admin/";return false}}}function isEmail(a){validRegExp=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;if(a.search(validRegExp)==-1){alert("Inserire un indirizzo e-mail valido");return false}return true}function gradient1(c,b,i,e,f,g,a,h){var j={x:0,height:i,width:b,radius:10};c.fillStyle="#eef4e0";$.canvasPaint.roundedRect(c,j);var d=c.createLinearGradient(0,0,0,i-10);d.addColorStop(0,"#ffffff");d.addColorStop(1,"#def4ac");j.border=1;c.fillStyle=d;$.canvasPaint.roundedRect(c,j)}function gradient2(c,b,i,e,f,g,a,h){var j={x:0,height:i,width:b,radius:10};c.fillStyle="#cbbaff";$.canvasPaint.roundedRect(c,j);var d=c.createLinearGradient(0,0,0,i-10);d.addColorStop(0,"#f8f6ff");d.addColorStop(1,"#d5c7ff");j.border=1;c.fillStyle=d;$.canvasPaint.roundedRect(c,j)}function gradient3(c,b,i,e,f,g,a,h){var j={x:0,height:i,width:b,radius:10};c.fillStyle="#D1E1AC";$.canvasPaint.roundedRect(c,j);var d=c.createLinearGradient(0,0,0,i-10);d.addColorStop(0,"#fff");d.addColorStop(1,"#fefefe");j.border=1;c.fillStyle=d;$.canvasPaint.roundedRect(c,j)}function DrawBackground(){$(".box").backgroundCanvasPaint(gradient1);$(".box1").backgroundCanvasPaint(gradient2);$(".bgScategory, #filtriDx").backgroundCanvasPaint(gradient3)}function checkAltAddress(){if($("#indirizzoalternativo").is(":checked")){$("#alternativeFields").slideDown(function(){DrawBackground()});$("#contentright").height()>$("#colSx").height()?$("#colSx").height($("#contentright").height()):$("#contentright").height($("#colSx").height())}else{$("#user_ship_address").val("");$("#user_ship_zip").val("");$("#user_ship_province").val("");$("#user_ship_city").val("");$("#alternativeFields").slideUp(function(){DrawBackground()});$("#contentright").height()>$("#colSx").height()?$("#colSx").height($("#contentright").height()):$("#contentright").height($("#colSx").height())}}function showInFacebox(a){$.facebox($("#"+a));$("#facebox #"+a).show()}function notice(a){$.achtung({message:a,timeout:5})}function noticeSuccess(a){$.achtung({message:a,timeout:5,icon:"ui-icon-check",className:"achtungSuccess"})}function noticeAlert(a){$.achtung({message:a,timeout:0,icon:"ui-icon-alert",className:"achtungFail",zIndex:2000})}function isInteger(b){if(b==null){return false}var a;for(a=0;a<b.length;a++){var d=b.charAt(a);if(((d<"0")||(d>"9"))){return false}}return true}function updateCart(b){var a=b.attr("rel");var c=$("#qty"+a).val();if(isInteger(c)){if(c!="0"){$.ajax({type:"GET",url:"/cart/product_add/"+a,data:"qty="+c+"&is_cart=true",success:function(e){var d=$.json.decode(e);if(d.res=="ok"){location.reload()}else{noticeAlert(d.msg)}}})}else{noticeAlert("Inserire un numero diverso da zero")}}}$(document).ready(function(){$("#contact_subject").change(function(){var a=$(this).val();if(a=="assistenza postvendita"){$("#riga_ordine_id").show()}else{$("#riga_ordine_id").val(" ");$("#riga_ordine_id").hide()}});$("#hotOfferteKitHome .prodotto .bordo, #piuVendutiHome .prodotto .bordo").wrap('<div class="thumbWrapper" />');$("a.resultsPerPage").click(function(){var a=location.search.split("&");if(a.length==1){var b="?"}else{var b=""}for(var c=0;c<a.length;c++){if(!a[c].match(/^per_page/)){b+=a[c]+"&"}}b+="per_page="+$(this).attr("rel");location.href=location.pathname+b});$(".addThemAll").click(function(){$(".toCart").trigger("click")});$("#addSelectedToCart").click(function(){$(".rigaPreferiti").find(":checked").closest("tr").next().find(".toCart").trigger("click")});$("#removeSelected").click(function(){var a="";$(".rigaPreferiti").find(":checkbox:checked").each(function(){a+=$(this).attr("name")+"-"});location.href="/ecomm/favourite_remove?pids="+a});$(".rigaPreferiti :checkbox").click(function(){if($(this).is(":checked")){$(this).closest("tr").next().andSelf().css({background:"#ffa"})}else{$(this).closest("tr").next().andSelf().css({background:""})}});$(".addToFavourites").click(function(){var a=$(this).attr("rel");if(isInteger(a)){$.ajax({type:"GET",url:"/ecomm/favourite_add",data:"product_id="+a,success:function(c){var b=$.json.decode(c);if(b.res=="ok"){noticeSuccess(b.msg)}else{noticeAlert(b.msg)}}})}else{noticeAlert("Non e' un prodotto valido")}});$(".toCart").click(function(){var a=$(this).attr("id");var b=$("#qty"+a).val();if(isInteger(b)){$.ajax({type:"GET",url:"/cart/product_add/"+a,data:"qty="+b,beforeSend:function(){if($("#qty"+a).val().length>=4){noticeAlert("La quantita' non puo' superare un valore a 3 cifre!");return false}},success:function(d){var c=$.json.decode(d);if(c.res=="ok"){$.ajax({type:"GET",url:"/cart/menucart_status",success:function(e){$("#cartOverlay .jbgContentDiv").html(e);noticeSuccess('Prodotto aggiunto al <a href="/cart/step1" style="color: #fff">carrello</a>');DrawBackground()}})}else{noticeAlert(c.msg);$(".updateCartLink").css({visibility:"hidden"})}}})}else{noticeAlert("Non hai inserito un numero")}});$("#buttonGiftCard").click(function(){var a=$("#gift_card").val();$.ajax({type:"GET",url:"/cart/gift_add/"+a,success:function(c){var b=$.json.decode(c);if(b.res=="ok"){noticeSuccess(b.msg);$("#gift_card").attr("disabled","disabled");$("#buttonGiftCard").attr("disabled","disabled");setTimeout("location.reload()",1400)}else{if(b.res=="auth"){$.facebox('<div style="background: #771faf; padding: 20px; margin-bottom: 25px; text-align: center; color: #fff; font-weight: bold; font-size: 16px">Questo codice sconto è valido esclusivamente per utenti registrati e loggati.</div><h3 style="text-align: center; padding: 0 10px">Se sei già registrato al sito ti invitiamo a effetture il login per poi riprendere il percorso di acquisto<br><a href="/ecomm/login"><img style="display: block; margin: 10px auto" src="/images/loggati.gif"></a><br> Se invece è la prima volta che acquisti da noi ti invitiamo a registrarti e a continuare poi il tuo percorso di acquisto <a href="/registrazione"><img style="display: block; margin: 10px auto" src="/images/prosegui2.gif"></a></h3>')}else{noticeAlert(b.msg)}}}})});$(':text[id^="qty"]').focus(function(){$(this).next().next(".updateCartLink").css({visibility:"visible",cursor:"pointer"}).click(function(){$(this).unbind("click");updateCart($(this).prev().prev());$(".updateCartLink").css({visibility:"hidden"})})}).keypress(function(a){if(a.which==13){return false}});$(".buttonRemoveCart").click(function(){var a=$(this).attr("id");if(isInteger(a)){$.ajax({type:"GET",url:"/cart/product_remove/"+a,success:function(c){var b=$.json.decode(c);if(b.res=="ok"){$("#price_cart").html("&euro; "+b.total_cart);$("#vat_cart").html("&euro; "+b.total_cart_vat);$("#totalCart").html("&euro; "+b.total_cart_ship);$("#weight_total").html(b.weight_total);$("#row"+a).fadeOut(1000,function(){$(this).remove()});setTimeout("location.reload()",1000)}else{noticeAlert(b.msg)}}})}else{noticeAlert("Non hai inserito un numero")}});$(".shipCart:radio").click(function(){var a=$(this).val();if(isInteger(a)){$.ajax({type:"GET",url:"/cart/shipment_add/"+a,success:function(c){var b=$.json.decode(c);if(b.res=="ok"){$("#order_data_ship_type").val(b.ship_type);$("#totalCart").html("&euro; "+b.total_cart)}else{noticeAlert(b.msg)}}})}else{noticeAlert("non e' un numero")}});$("#menuSxBarra > div:first").css({marginLeft:0});$(".cluetip").cluetip({width:202,height:202,showTitle:false,local:true,dropShadowSteps:3,positionBy:"auto",clickThrough:true,onShow:function(){$(".cluetipped").show()}});$("#menuSxBarra").buildMenu({menuSelector:".overlayMenu",menuWidth:180,openOnRight:false,containment:".wrapper:first",iconPath:"ico/",hasImages:false,fadeInTime:100,fadeOutTime:200,menuTop:2,menuLeft:2,submenuTop:0,submenuLeft:0,opacity:1,shadow:false,shadowColor:"#000",shadowOpacity:1,openOnClick:false,closeOnMouseOut:true,closeAfter:500,minZindex:"auto"});$("#menuDxBarra").buildMenu({menuSelector:".overlayMenu2",menuWidth:180,openOnRight:false,containment:".wrapper:first",iconPath:"ico/",hasImages:false,fadeInTime:100,fadeOutTime:200,menuTop:2,menuLeft:2,submenuTop:0,submenuLeft:0,opacity:1,shadow:false,shadowColor:"#000",shadowOpacity:1,openOnClick:false,closeOnMouseOut:true,closeAfter:500,minZindex:"auto"});$("#cartButton").toggle(function(){$("#cartOverlay").slideDown();$(this).css({backgroundImage:"url(/images/carrello-over.gif)"})},function(){$("#cartOverlay").slideUp();$(this).css({backgroundImage:"url(/images/carrello.gif)"})}).find("a").click(function(){location.href="/cart/step1";return false});$("#tabsHome").tabs("#tabsHomeContent > a",{current:"selected",tabs:"div",effect:"fade",rotate:true,autoplay:true,clickable:false}).slideshow();$("#tabsHome2").tabs("#tabsHome2Content > div",{current:"selected",tabs:"div",effect:"fade",fadeInSpeed:500});$("#tabsHome3").tabs("#tabsHome3Content > div",{current:"selected",tabs:"div",effect:"fade",fadeInSpeed:500});$("#loginFacebox").click(function(){showInFacebox("loginRegister")});$("#goTo1").click(function(){location.href="/cart/step2"});$("#fotoDetail .scrollable").scrollable({size:1,loop:true});$("#fotoDetail .scrollable .items > div > img").mouseover(function(){$("#fotoDetail img:first").attr({src:$(this).attr("detail")}).parent().attr({href:$(this).attr("rel")})});$("img[src*=.png]").ifixpng();$(".box, .box1, .bgScategory, #filtriDx").backgroundCanvas();$(window).load(function(){DrawBackground()});$(window).resize(function(){DrawBackground()});if(location.href.indexOf("/cart/")==-1){$("#contentright").height()>$("#colSx").height()?$("#colSx").height($("#contentright").height()):$("#contentright").height($("#colSx").height());$("#contentleft").height()>$("#colDx").height()?$("#colDx").height($("#contentleft").height()):$("#contentleft").height($("#colDx").height())}$("a[rel*='facebox']").facebox();$("#simple_captcha").children().andSelf().css({border:"0"});$("a.tipTrigger").tooltip();$("form.showTip :input").tooltip();$("input[name='q']").focus(function(){$("input[name='q'][value*='cerca']").val("")});$("input[name='email']").focus(function(){$("input[name='email'][value*='qui la tua email...']").val("")});adesso=new Date();stringaAdesso=(adesso.getFullYear()+"-"+adesso.getMonth()+"-"+adesso.getDay()+"-"+adesso.getHours()+"-"+adesso.getMinutes());if(!$.cookies.get("firstVisit")){$.ajax({url:"/ecomm/ajax_cart_sid",success:function(a){ritorno=$.json.decode(a);storedSession=ritorno.sid;$.cookies.set("firstVisit",storedSession,{hoursToLive:720});$.cookies.set("storedDate",stringaAdesso,{hoursToLive:720})}})}else{if($.cookies.get("storedDate")!=stringaAdesso){$.ajax({url:"/ecomm/ajax_cart_sid",data:{session_id:$.cookies.get("firstVisit")},success:function(a){ritorno=$.json.decode(a);storedSession=ritorno.sid;$.cookies.set("firstVisit",storedSession,{hoursToLive:720});$.cookies.set("storedDate",stringaAdesso,{hoursToLive:720});$.ajax({type:"GET",url:"/cart/menucart_status",success:function(b){$("#cartOverlay .jbgContentDiv").html(b);DrawBackground()}})}})}}});