function goToProductSearch(origin) { var searchInput = $("#top_search").val(); if(searchInput!="") { //console.log("SEARCH: "+searchInput+"!"); searchInput = searchInput.replace("/","_"); var help = searchInput.split(" "); searchInput = help[0]; window.location.href = "/product-search/"+searchInput+"££"+origin; } } var fixButton1 = 0; var fixButton2 = 0; var fixButton3 = 0; var fixButton1Move = 0; var fixButton2Move = 0; var fixButton3Move = 0; function activateButtonDetail1(state) { if(state && fixButton1==0 && fixButton1Move==0) { fixButton1Move = 1; $('#homeslide_up').stop().animate({right:"-50px"},400,function(){ $('#slide_hover_1').stop().animate({right:"0px"},400); fixButton1Move = 0; }); fixButton1 = 1; } else if(state==0 && fixButton1==1 && fixButton1Move==0) { fixButton1Move = 1; var bowW = $('#slide_hover_1').width(); $('#slide_hover_1').stop().animate({right:-bowW+"px"},400,function(){ $('#homeslide_up').stop().animate({right:"0px"},400); fixButton1Move = 0; }); fixButton1 = 0; } } function activateButtonDetail2(state) { if(state && fixButton2==0 && fixButton2Move==0) { fixButton2Move = 1; $('#homeslide_num').stop().animate({right:"-50px"},400,function(){ $('#slide_hover_2').stop().animate({right:"0px"},400); fixButton2Move = 0; }); fixButton2 = 1; } else if(state==0 && fixButton2==1 && fixButton2Move==0) { fixButton2Move = 1; var bowW = $('#slide_hover_2').width(); $('#slide_hover_2').stop().animate({right:-bowW+"px"},400,function(){ $('#homeslide_num').stop().animate({right:"0px"},400); fixButton2Move = 0; }); fixButton2 = 0; } } function activateButtonDetail3(state) { if(state && fixButton3==0 && fixButton3Move==0) { fixButton3Move=1; $('#homeslide_down').stop().animate({right:"-50px"},400,function(){ $('#slide_hover_3').stop().animate({right:"0px"},400); fixButton3Move=0; }); fixButton3 = 1; } else if(state==0 && fixButton3==1 && fixButton3Move==0) { fixButton3Move=1; var bowW = $('#slide_hover_3').width(); $('#slide_hover_3').stop().animate({right:-bowW+"px"},400,function(){ $('#homeslide_down').stop().animate({right:"0px"},400); fixButton3Move=0; }); fixButton3 = 0; } } function menuSocial(state){ if ((state) && (menu_social_state == 0) && (menu_social_move == 0)){ menu_social_move = 1; $("#black_social").animate({height: "0px", top: "215px"}, 300, function(){ $("#social_container").animate({top: "80px", height: "135px"}, 300, function(){ menu_social_move = 0; }); }); menu_social_state = 1; } else if ((state == 0) && (menu_social_state == 1) && (menu_social_move == 0)){ menu_social_move = 1; $("#social_container").animate({height: "0px", top: "215px"}, 300, function(){ $("#black_social").animate({top: "165px", height: "50px"}, 300, function(){ menu_social_move = 0; }); }); menu_social_state = 0; } } function get_top_slider(){ //var prova = $(window).height(); TOP_SLIDER = (($(window).height())/2)-250; var help = TOP_SLIDER+"px"; $('#slide_menu').css("top", help); } function init_bind_bottom(){ for(var i=1; i<5; i++){ $('#bottom_'+i).hover(function(event){ $(this).stop(true, true).animate({bottom: "0px"}, 900, 'easeInOutQuint'); }, function(event){ $(this).animate({bottom: "-136px"}, 900, 'easeInOutQuint'); }); } } function searchtopmenu(){ $('#toptxtsearch,#topimgsearch').bind("mousedown touchstart MozTouchDown", function(event) { event.preventDefault(); event.stopPropagation(); $('#toptxtsearch').animate({right: "-50px"},500,function(){ $('#searchform').css("display","block"); $('#searchform').animate({width: "180px"}),500; $('#searchform input').focus(); }); }); } function init_bottom_news(){ var index = bottomTotNews; for(var i=1; i<=bottomTotNews; i++) { $("#bottom_new_"+i).css({visibility:"visible",opacity:"1.0"}); $("#bottom_new_"+i).css("z-index", index); index--; } } function openFilter(){ $('#filter_img1,#filter_img2').bind("mousedown touchstart MozTouchDown", function(event){ event.preventDefault(); var new_width = (parseInt(window_Width)-370)+"px"; if (filterStatus == 0){ $('#filter').animate({left:"0px"},800); $('#filter_img1').css("opacity",0.0); $('#filter_img1').animate({left:"250px"},800); $('#filter_img2').animate({left:"250px"},800); $('#allslider_container').animate({left:"250px",width: new_width},800,function(){ filterStatus = 1; adjustWindow(); }); } else { $('#filter').animate({left:"-250px"},800); $('#filter_img1').css("opacity",1.0); $('#filter_img1').animate({left:"0px"},800); $('#filter_img2').animate({left:"0px"},800); $('#allslider_container').animate({left:"0px",width:(window_Width-120)+"px"},800,function(){ filterStatus = 0; adjustWindow(); }); } }); } function flip_IE(){ if ($.browser.msie && parseInt($.browser.version, 10) <= 10){ $('.go_to_product').css("display","none"); $('.zoom_category').css("display","none"); $('.section_opacity').css("display","none"); $('.section_back').css("margin-left", 0+"px"); $('.flip_container').hover( function() { $('.go_to_product', this).css("display","block"); $('.zoom_category', this).css("display","block"); $('.section_opacity', this).css("display","block"); $('.section', this).fadeOut(400); }, function() { $('.go_to_product', this).css("display","none"); $('.zoom_category', this).css("display","none"); $('.section_opacity', this).css("display","none"); $('.section', this).stop(true, true).fadeIn(400); } ); } }; function dropdown_IE(){ if ($.browser.msie && parseInt($.browser.version, 10) === 7){ $('.styled-select select').css("width",169+"px").css("margin-left",0+"px"); $('.styled-select').css("border","none"); $('label').css("background-image","none"); } }; function price_slider(){ $( ".slider" ).slider({ animate: true, range: "min", value: 500, min: 0, max: 1000, step: 10, //this gets a live reading of the value and prints it on the page slide: function( event, ui ) { $( "#slider-result" ).html( ui.value+" euro" ); }, //this updates the hidden form field so we can submit the data using a form change: function(event, ui) { $('#hidden').attr('value', ui.value); } }); } function adjust_bottom(){ var windowWidth = parseInt($(window).width()); /*if(windowWidth>=1124){ var div_slide_width = 100-(parseInt((72*100)/windowWidth)); var div_slide_final = parseInt((100-60)/3); $('#slide_bottom').css({left:"100px",width:(div_slide_width)+"%"}); var left = (15+div_slide_final)+"%"; $('#bottom_2').css("left",left); var left = (15+div_slide_final+15+div_slide_final)+"%"; $('#bottom_3').css("left",left); var left = (15+div_slide_final+15+div_slide_final+15+div_slide_final)+"%"; $('#bottom_4').css("left",left); }else{ var div_slide_width = 100-(parseInt((72*100)/windowWidth)); var div_slide_final = parseInt((100-82)/3); $('#slide_bottom').css({left:"36px",width:div_slide_width+"%"}); var left = (20.5+div_slide_final)+"%"; $('#bottom_2').css("left",left); var left = (20.5+div_slide_final+20.5+div_slide_final)+"%"; $('#bottom_3').css("left",left); var left = (20.5+div_slide_final+20.5+div_slide_final+20.5+div_slide_final)+"%"; $('#bottom_4').css("left",left); }*/ } /*------------------IPAD SLIDE----------------*/ function isTouchDevice(){ try{ document.createEvent("TouchEvent"); return true; }catch(e){ return false; } } function touchScroll(id){ if(isTouchDevice()){ //if touch events exist... var el=document.getElementById(id); var scrollStartPos=0; document.getElementById(id).addEventListener("touchstart", function(event) { scrollStartPos=this.scrollTop+event.touches[0].pageY; event.preventDefault(); },false); document.getElementById(id).addEventListener("touchmove", function(event) { this.scrollTop=scrollStartPos-event.touches[0].pageY; event.preventDefault(); },false); } } /*------------------ADJUST CAROUSEL PRODUCT-------------*/ function adjustCarousel(){ var n_famiglia = $("#carousel_famiglia > div").size(); var n_simili = $("#carousel_simili > div").size(); var n_abbinati = $("#carousel_abbinati > div").size(); var carouselSingleDivWidth = ($('.carousel').width()); var totalWidth = n_famiglia*carouselSingleDivWidth; $('#carousel_famiglia').css("width",totalWidth+"px"); $('#carousel_simili').css("width",totalWidth+"px"); $('#carousel_abbinati').css("width",totalWidth+"px"); /*----------MOVE CAROUSEL---------*/ //famiglia $('#next_famiglia').bind("mousedown touchstart MozTouchDown", function(event) { event.preventDefault(); var n_famiglia = $("#carousel_famiglia > div").size(); var carouselSingleDivWidth = ($('.carousel').width()); var W = n_famiglia*carouselSingleDivWidth; var w = $('#wrapper_carousel_famiglia').width(); var leftFamiglia = $('#carousel_famiglia').position().left; if((W-w)-(-1*leftFamiglia) div").size(); var carouselSingleDivWidth = ($('.carousel').width()); var W = n_famiglia*carouselSingleDivWidth; var w = $('#wrapper_carousel_famiglia').width(); var leftFamiglia = $('#carousel_famiglia').position().left; if((-1*leftFamiglia)<=carouselSingleDivWidth){ $('#prev_famiglia').css("visibility","hidden"); $('#carousel_famiglia').animate({left:0+"px"},300); }else{ var incr = leftFamiglia+carouselSingleDivWidth; $('#next_famiglia').css("visibility","visible"); $('#carousel_famiglia').animate({left:incr+"px"},300); } }); //simili $('#next_simili').bind("mousedown touchstart MozTouchDown", function(event) { event.preventDefault(); var n_simili = $("#carousel_simili > div").size(); var carouselSingleDivWidth = ($('.carousel').width()); var W = n_simili*carouselSingleDivWidth; var w = $('#wrapper_carousel_simili').width(); var leftSimili = $('#carousel_simili').position().left; if((W-w)-(-1*leftSimili) div").size(); var carouselSingleDivWidth = ($('.carousel').width()); var W = n_simili*carouselSingleDivWidth; var w = $('#wrapper_carousel_simili').width(); var leftSimili = $('#carousel_simili').position().left; if((-1*leftSimili)<=carouselSingleDivWidth){ $('#prev_simili').css("visibility","hidden"); $('#carousel_simili').animate({left:0+"px"},300); }else{ var incr = leftSimili+carouselSingleDivWidth; $('#next_simili').css("visibility","visible"); $('#carousel_simili').animate({left:incr+"px"},300); } }); //abbinati $('#next_abbinati').bind("mousedown touchstart MozTouchDown", function(event) { event.preventDefault(); var n_abbinati = $("#carousel_abbinati > div").size(); var carouselSingleDivWidth = ($('.carousel').width()); var W = n_abbinati*carouselSingleDivWidth; var w = $('#wrapper_carousel_abbinati').width(); var leftAbbinati = $('#carousel_abbinati').position().left; if((W-w)-(-1*leftAbbinati) div").size(); var carouselSingleDivWidth = ($('.carousel').width()); var W = n_abbinati*carouselSingleDivWidth; var w = $('#wrapper_carousel_abbinati').width(); var leftAbbinati = $('#carousel_abbinati').position().left; if((-1*leftAbbinati)<=carouselSingleDivWidth){ $('#prev_abbinati').css("visibility","hidden"); $('#carousel_abbinati').animate({left:0+"px"},300); }else{ var incr = leftAbbinati+carouselSingleDivWidth; $('#next_abbinati').css("visibility","visible"); $('#carousel_abbinati').animate({left:incr+"px"},300); } }); //$('#carousel_simili,#carousel_abbinati,#carousel_famiglia').css("left",0+"px"); //$('#prev_simili,#prev_abbinati,#prev_famiglia').css("visibility","hidden"); } /*function viewLang(){ $('#open_lang,#language_selection').hover( function() { $('#language_selection').stop(true, true).css("display","block"); }, function() { $('#language_selection').css("display","none"); } )}*/ function dropStaticMenu(){ var isiPhone = navigator.platform.indexOf("iPhone") != -1; var isiPod = navigator.platform.indexOf("iPod") != -1; var isiPad = navigator.userAgent.match(/iPad/i) != null; var isAndroid = /android/i.test(navigator.userAgent.toLowerCase()); if(isiPad || isiPhone || isiPod || isAndroid) { var timeoutUs = 0 ; var timeoutMedia = 0 ; $('#top_menu_us').bind("touchstart MozTouchDown", function(event) { event.preventDefault(); if(dropMenuUs == 0) { dropMenuUs = 1; dropMenuMedia = 0; $('#top_menu_us').css("color","black"); if($('#static_page_header').height()>0) $('#static_page_header').css("height",0+"px"); $('#static_page_header').css("z-index","5000").css("display","block"); $('#press_top_bar').css("z-index","2000").css("display","none").css("height",0+"px"); $('#static_page_header').stop(true, true).animate({height:"30px"},500); $('#mediaroom_link').css("color","white"); clearTimeout(timeoutMedia); clearTimeout(timeoutUs); timeoutUs = setTimeout(function(){ $('#static_page_header').stop(true, true).animate({height:"0px"},500,function(){ $('#static_page_header').css("z-index","2000").css("display","none"); $('#top_menu_us').css("color","white"); }); $('#press_top_bar').stop(true, true).animate({height:"0px"},500,function(){ $('#press_top_bar').css("z-index","3000").css("display","none"); }); dropMenuUs = 0; },5000); } }); $('#mediaroom_link').bind("touchstart MozTouchDown", function(event) { event.preventDefault(); if(dropMenuMedia == 0) { dropMenuUs = 0; dropMenuMedia = 1; $('#mediaroom_link').css("color","black"); if($('#press_top_bar').height()>0) $('#press_top_bar').css("height",0+"px"); $('#press_top_bar').css("z-index","5000").css("display","block"); $('#static_page_header').css("z-index","2000").css("display","none").css("height",0+"px"); $('#press_top_bar').stop(true, true).animate({height:"30px"},500); $('#top_menu_us').css("color","white"); clearTimeout(timeoutUs); clearTimeout(timeoutMedia); timeoutMedia = setTimeout(function(){ $('#static_page_header').stop(true, true).animate({height:"0px"},500,function(){ $('#static_page_header').css("z-index","2000").css("display","none"); }); $('#press_top_bar').stop(true, true).animate({height:"0px"},500,function(){ $('#press_top_bar').css("z-index","3000").css("display","none"); $('#mediaroom_link').css("color","white"); }); dropMenuMedia = 0; },5000) } }); } else { $('#top_menu_us,#dropmenu_mediaroom').hover( function() { if(dropMenuUs == 0) { dropMenuUs = 1; dropMenuMedia = 0; if($('#static_page_header').height()>0) $('#static_page_header').css("height",0+"px"); $('#static_page_header').css("z-index","5000").css("display","block"); $('#press_top_bar').css("z-index","2000").css("display","none").css("height",0+"px"); $('#static_page_header').stop(true, true).animate({height:"30px"},500); } }, function() { } ); $('#static_page_header').hover( function() { $('#static_page_header').css("z-index","5000").css("display","block"); $('#press_top_bar').css("z-index","2000").css("display","none").css("height",0+"px"); $('#static_page_header').stop(true, true).animate({height:"30px"},500); }, function() { $('#static_page_header').stop(true, true).animate({height:"0px"},500,function(){ $('#static_page_header').css("z-index","2000").css("display","none"); dropMenuUs = 0; }); } ) $('#mediaroom_link,#dropmenu_mediaroom').hover( function() { if(dropMenuMedia == 0) { dropMenuMedia = 1; dropMenuUs = 0; if($('#press_top_bar').height()>0) $('#press_top_bar').css("height",0+"px"); $('#press_top_bar').css("z-index","5000").css("display","block"); $('#static_page_header').css("z-index","2000").css("display","none").css("height",0+"px"); $('#press_top_bar').stop(true, true).animate({height:"30px"},500); } }, function() { } ); $('#press_top_bar').hover( function() { $ $('#press_top_bar').css("z-index","5000").css("display","block"); $('#static_page_header').css("z-index","2000").css("display","none").css("height",0+"px"); $('#press_top_bar').stop(true, true).animate({height:"30px"},500); }, function() { $('#press_top_bar').stop(true, true).animate({height:"0px"},500,function(){ $('#press_top_bar').css("z-index","2000").css("display","none"); dropMenuMedia = 0; }); } ) } }; /*function dropStaticMenu2(){ $('#dropmenu,#static_page_header').hover( function() { $('#header').animate({top:"0px"},500,function(){ $('#static_page_header').stop(true, true).animate({top:"45px"},500); }); }, function() { $('#static_page_header').animate({top:"8px"},500,function(){ $('#header').animate({top:"45px"},500); }); } )}*/ /*------------------IPAD SLIDE FORM PRIVACY----------------*/ function isTouchDevice(){ try{ document.createEvent("TouchEvent"); return true; }catch(e){ return false; } } function touchScroll(id){ if(isTouchDevice()){ //if touch events exist... var el=document.getElementById(id); var scrollStartPos=0; document.getElementById(id).addEventListener("touchstart", function(event) { scrollStartPos=this.scrollTop+event.touches[0].pageY; event.preventDefault(); },false); document.getElementById(id).addEventListener("touchmove", function(event) { this.scrollTop=scrollStartPos-event.touches[0].pageY; event.preventDefault(); },false); } } function switchView() { $('#view1').css("display","none"); $('#view2').css("display","block"); } function viewDate(){ $('#ribbon_hr').css("display","block"); $('#choose_month').css("display","block"); $('#month').css("display","block"); } function showErrors(){ $('.errors').css("display","block"); $('.errors').animate({opacity:"1"},400); $('#open_menu_opacity').css("visibility","visible"); } /*---------------DOC READY---------------------*/ $(document).ready(function(){ if ($.browser.msie && parseInt($.browser.version, 10) <= 8){ $('#myhome_link').remove(); } $('#carrelloHover,#cart_popup').hover( function() { }, function() { } ); });