;(function($){$.fn.superfish=function(op){var sf=$.fn.superfish,c=sf.c,$arrow=$([''].join('')),over=function(){var $$=$(this),menu=getMenu($$);clearTimeout(menu.sfTimer);$$.showSuperfishUl().siblings().hideSuperfishUl();},out=function(){var $$=$(this),menu=getMenu($$),o=sf.op;clearTimeout(menu.sfTimer);menu.sfTimer=setTimeout(function(){o.retainPath=($.inArray($$[0],o.$path)>-1);$$.hideSuperfishUl();if(o.$path.length&&$$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}},o.delay);},getMenu=function($menu){var menu=$menu.parents(['ul.',c.menuClass,':first'].join(''))[0];sf.op=sf.o[menu.serial];return menu;},addArrow=function($a){$a.addClass(c.anchorClass).append($arrow.clone());};return this.each(function(){var s=this.serial=sf.o.length;var o=$.extend({},sf.defaults,op);o.$path=$('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){$(this).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass);});sf.o[s]=sf.op=o;$('li:has(ul)',this)[($.fn.hoverIntent&&!o.disableHI)?'hoverIntent':'hover'](over,out).each(function(){if(o.autoArrows)addArrow($('>a:first-child',this));}).not('.'+c.bcClass).hideSuperfishUl();var $a=$('a',this);$a.each(function(i){var $li=$a.eq(i).parents('li');$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});});o.onInit.call(this);}).each(function(){menuClasses=[c.menuClass];if(sf.op.dropShadows&&!($.browser.msie&&$.browser.version<7))menuClasses.push(c.shadowClass);$(this).addClass(menuClasses.join(' '));});};var sf=$.fn.superfish;sf.o=[];sf.op={};sf.IE7fix=function(){var o=sf.op;if($.browser.msie&&$.browser.version>6&&o.dropShadows&&o.animation.opacity!=undefined)
this.toggleClass(sf.c.shadowClass+'-off');};sf.c={bcClass:'sf-breadcrumb',menuClass:'sf-js-enabled',anchorClass:'sf-with-ul',arrowClass:'sf-sub-indicator',shadowClass:'sf-shadow'};sf.defaults={hoverClass:'sfHover',pathClass:'overideThisToUse',pathLevels:1,delay:2500,animation:{opacity:'show'},speed:'normal',autoArrows:true,dropShadows:true,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};$.fn.extend({hideSuperfishUl:function(){var o=sf.op,not=(o.retainPath===true)?o.$path:'';o.retainPath=false;var $ul=$(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass).find('>ul').fadeOut(250);o.onHide.call($ul);return this;},showSuperfishUl:function(){var o=sf.op,sh=sf.c.shadowClass+'-off',$ul=this.addClass(o.hoverClass).find('>ul:hidden').fadeIn(250);sf.IE7fix.call($ul);o.onBeforeShow.call($ul);$ul.animate(o.animation,o.speed,function(){sf.IE7fix.call($ul);o.onShow.call($ul);});return this;}});})(jQuery);jQuery(function(){jQuery('ul.sf-menu').superfish();});function award(x,y){if(document.getElementById(x)!=undefined){$('#'+x+' a').attr('target','_blank');$('#'+x).css('display','block');$('#'+x).hover(function(){$(this).animate({right:'0'},200);},function(){$(this).animate({right:y},400);});};}
function c(elm){if(!elm.base)elm.base=elm.value;if(elm.value==elm.base)elm.value="";else if(elm.value=="")elm.value=elm.base;}
function resizeImg(){if(($(window).width()/$(window).height())>1.6){$('#bg img').css('width',$(window).width()+'px');$('#bg img').css('height','auto');}
else{$('#bg img').css('width','auto');$('#bg img').css('height',$(window).height()+'px');}
$('#bg img').css('margin-left','-'+$(window).width()/2+'px');}
$(window).resize(function(){resizeImg();});$(window).scroll(function(){if($(window).scrollTop()>140)$('#logomini').fadeIn(250);else $('#logomini').fadeOut(250);});function title(nav){if(nav=='./'||nav=='')document.title='Climaplanet';else{var title=nav.substr(0,1).toUpperCase()
for(var i=1;i<nav.length-1;i++){if(nav.substr(i-1,1)=='/'||nav.substr(i-1,1)=='-')
title+=nav.substr(i,1).toUpperCase();else
title+=nav.substr(i,1);}
title=title.replace(/-/g," ").replace(/\//g," - ");document.title='Climaplanet - '+title;}}
function googleMaps(){var map;var myX=43.675709;var myY=10.557218;var myOptions={zoom:12,center:new google.maps.LatLng(myX,myY),mapTypeId:google.maps.MapTypeId.TERRAIN};map=new google.maps.Map(document.getElementById('map'),myOptions);var infoWindow=new google.maps.InfoWindow();var markerBounds=new google.maps.LatLngBounds();var markerArray=[];function makeMarker(options){var pushPin=new google.maps.Marker({map:map});pushPin.setOptions(options);google.maps.event.addListener(pushPin,'click',function(){infoWindow.setOptions(options);infoWindow.open(map,pushPin);});markerArray.push(pushPin);return pushPin;}
google.maps.event.addListener(map,'click',function(){infoWindow.close();});google.maps.event.addListenerOnce(map,'idle',function(){openMarker(0);});function openMarker(i){google.maps.event.trigger(markerArray[i],'click');google.maps.event.trigger(map,'resize');};makeMarker({position:new google.maps.LatLng(myX,myY),content:"<div style='height: 80px; width: 260px; text-align: center; font-size: 10px'><img src='"+base+"img/iqp.gif' style='float: left' alt='' /><b style='font-size: 14px'>Clima-Planet</b><br/><b style='font-size: 11px'>Technology for life</b><br/><br/>Via Tosco Romagnola, 129<br/>56021 Cascina PI</div>"});$('#map').show();}
function gallery(){$('#gallery a').attr('rel','p');$("a[rel=p]").fancybox({'opacity':true,'overlayShow':true,'transitionIn':'fade','transitionOut':'fade','titlePosition':'outside','overlayColor':'#000','overlayOpacity':0.75,'titleFormat':function(){return'';}});$(".fade img").stop().animate({"opacity":"1"},"slow");$(".fade img").hover(function(){$(this).stop().animate({"opacity":"0.4"},"slow");},function(){$(this).stop().animate({"opacity":"1"},"slow");});}
function contatti(){$('#subContatti, #subPreventivo, #subAssistenza').click(function(){mail();return false;});}
function navigation(){$('#navigation a, #content .link').click(function(){var nav=$(this).attr('href');url(nav,1);return false;});}
var ajaxMail=undefined;function mail(){if(ajaxMail!=undefined)return false;var mail_nome=$("[name='nome']").val();var mail_email=$("[name='email']").val();var mail_telefono=$("[name='telefono']").val();var mail_messaggio=$("[name='messaggio']").val();var mail_indirizzo=$("[name='indirizzo']").val();var mail_matricola=$("[name='matricola']").val();var mail_marca=$("[name='marca']").val();var mail_prodotto=$("[name='prodotto']").val();var exp=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;ajaxMail=$.ajax({beforeSend:function(){if($('#navigation').is(":visible")){$('#loader').css('margin-top','50px');$('#logoB').css('margin-top','-60px');}
$('#load').fadeIn(250);},complete:function(){$('#formalert').css('cursor','pointer');$('#formalert').click(function(){$(this).fadeOut(250);return false;});setTimeout(function(){$('#load').fadeOut(250);ajaxMail=undefined;},250);},type:"post",url:'php_send.php',data:{email:mail_email,nome:mail_nome,telefono:mail_telefono,messaggio:mail_messaggio,indirizzo:mail_indirizzo,matricola:mail_matricola,marca:mail_marca,prodotto:mail_prodotto},async:true,success:function(html){if((mail_indirizzo==undefined||(mail_indirizzo!=''&&mail_matricola!=''&&mail_marca!='Selezionare una marca'))&&(mail_prodotto==undefined||mail_prodotto!='Selezionare un prodotto')&&(exp.test(mail_email)&&mail_nome!=''&&mail_telefono!=''&&mail_messaggio!='')){$('#form').fadeOut(250);setTimeout(function(){$('#form').empty();$('#form').append(html).hide().fadeIn(250);},250);}
else{if($('#formalert').is(":visible"))$('#formalert').fadeOut(250);setTimeout(function(){$('#formalert').empty();$('#formalert').append(html).hide().fadeIn(250);},250);}}});return false;}
var ajaxPage=undefined;function url(nav,nn){if(ajaxPage!=undefined)return false;$('#base').text(nav);title(nav);var page=nav.substring(0,nav.length-1).replace(/\//g,"_");var home='azienda';var bg=page.split('_');bg=bg[0];if(bg=='')bg=home;if(nav=='./'){$('#base').text('');location.hash='/';bg=home;page=home;}
else{location.hash='/'+nav;}
var img='<img src="img/bg_'+bg+'.jpg" alt="" />';$(img).load(function(){$(img).appendTo('#bg').hide().fadeIn(500/nn);setTimeout(function(){$('#bg img:first').remove();},500/nn);resizeImg();});ajaxPage=$.ajax({beforeSend:function(){$('#logo, #content').fadeOut(250/nn);if($('#navigation').is(":visible")){$('#loader').css('margin-top','50px');$('#logoB').css('margin-top','-60px');}
$('#load').fadeIn(250/nn);if($('#logomini').is(":visible"))$('#logomini').fadeOut(250/nn);},complete:function(){var navAnalytics=nav;if(nav=='./')navAnalytics='';_gaq.push(['_trackPageview',navAnalytics]);$('#load').fadeOut(250/nn);setTimeout(function(){$('#logo').fadeIn(1000/nn);$('#content').fadeIn(500/nn);},250/nn);setTimeout(function(){ajaxPage=undefined;var history=setInterval(function(){if(location.hash!=('#/'+$('#base').text()))url(location.hash.replace('#/',''),250);},100);},1000/nn);},type:'get',url:'page.php',data:'p='+page,success:function(html){setTimeout(function(){$('#content').empty();$('#content').append(html).hide();if(nav=='dove-siamo/')googleMaps();if(nav=='prodotti/')gallery();if(nav=='galleria/')gallery();if(nav=='contatti/')contatti();if(nav=='contatti/assistenza-post-vendita/')contatti();if(nav=='contatti/preventivo/')contatti();$("a.blank").attr('target','_blank');$('textarea').css('resize','none');navigation();},250/nn);},error:function(){$('#content').empty();$('#content').load('page.php?p=error').hide();},timeout:5000});}
$(document).ready(function(){resizeImg();$("#load").show();$("#container").hide();$("#footer a").attr('target','_blank');$('#logomini').css('cursor','pointer');$('#logomini').click(function(){$('html, body').animate({scrollTop:0},'slow');return false;});$('head').append('<link rel="stylesheet" type="text/css" href="css/css3.css" />');if(location.href!=base&&location.hash!=''){$("#content").hide();var nav=location.hash.replace('#/','');url(nav,1);}
navigation();award('cssdesignawards','-30px');});$(window).load(function(){$('#load').fadeOut('normal',function(){$("#container").fadeIn(2000);});});
