function modal_show(d,c,a){try{if(typeof document.body.style.maxHeight==="undefined"){$("body","html").css({height:"100%",width:"100%"});$("html").css({overflow:"hidden"});if(document.getElementById("MODAL_HideSelect")===null){$("body").append('<iframe id="MODAL_HideSelect"></iframe><div id="MODAL_overlay"></div><div id="MODAL_window"></div>')}}else{if(document.getElementById("MODAL_overlay")===null){$("body").append('<div id="MODAL_overlay"></div><div id="MODAL_window"></div>')}}if(modal_detectMacXFF()){$("#MODAL_overlay").addClass("MODAL_overlayMacFFBGHack")}else{$("#MODAL_overlay").addClass("MODAL_overlayBG")}a=a||null;d=d||"";$("body").append('<div id="MODAL_load"></div>');$("#MODAL_load").show();MODAL_WIDTH=(a!==null)?((a.width!=undefined)?a.width:350):350;MODAL_HEIGHT=parseInt($("#"+c).outerHeight(),10)+32;$("#MODAL_window").append('<div id="MODAL_title"><div id="MODAL_ajaxWindowTitle">'+d+'</div><div id="MODAL_closeAjaxWindow"><a href="#" id="MODAL_closeWindowButton"></a></div></div><div id="MODAL_ajaxContent" style="width:'+MODAL_WIDTH+'px;"></div>');$("#MODAL_closeWindowButton").click(modal_remove);$("#MODAL_ajaxContent").append($("#"+c).children());$("#MODAL_window").unload(function(){$("#"+c).append($("#MODAL_ajaxContent").children())});modal_position();$("#MODAL_load").remove();$("#MODAL_window").css({display:"block"});$("#MODAL_btnbar button").focus()}catch(b){}}function modal_remove(callback){callback=callback||"";$("#MODAL_closeWindowButton").unbind("click");$("#MODAL_window").fadeOut("fast",function(){$("#MODAL_window, #MODAL_overlay, #MODAL_HideSelect").trigger("unload").unbind().remove()});$("#MODAL_load").remove();if(typeof document.body.style.maxHeight=="undefined"){$("body","html").css({height:"auto",width:"auto"});$("html").css({overflow:""})}eval(callback);return false}function modal_position(){$("#MODAL_window").css({marginLeft:"-"+parseInt((MODAL_WIDTH/2),10)+"px",width:MODAL_WIDTH+"px"});if(!($.browser.msie&&$.browser.version<7)){$("#MODAL_window").css({marginTop:"-"+parseInt((MODAL_HEIGHT/2),10)+"px"})}}function modal_detectMacXFF(){var a=navigator.userAgent.toLowerCase();if(a.indexOf("mac")!=-1&&a.indexOf("firefox")!=-1){return true}}function updateServicesForm(){$("#serviceform").empty().addClass("updating");$.ajax({type:"post",url:"../common/services-form.php",data:"service="+$("#serviceselect option:selected").val(),error:function(){updateServicesForm()},success:function(a){$("#serviceform").removeClass("updating").append(a)}})}function setupHome(){$("#boxlist").jcarousel({scroll:1,visible:4,wrap:"circular",auto:10});var a=0;$("#cloud li").each(function(){a=Math.floor(Math.random()*11+9);$(this).css({fontSize:a+"px"});if(a>12&&a<16){$(this).css({color:"#9CF"})}if(a>16){$(this).css({color:"#036"})}});$("#cloud").fadeIn()}function setupHeader(a){var b=new Array();b[0]=new Image();b[0].src=a+"logo_hover.png";b[1]=new Image();b[1].src=a+"searchbtn_over.png";b[2]=new Image();b[2].src=a+"searchbtn_down.png";b[3]=new Image();b[3].src=a+"modal_loading.gif";b[4]=new Image();b[4].src=a+"updating.gif";$("#logo").hover(function(){$(this).attr("src",a+"logo_hover.png")},function(){$(this).attr("src",a+"logo.png")});$(".searchbtn").hover(function(){$(this).attr("src",a+"searchbtn_over.png")},function(){$(this).attr("src",a+"searchbtn_up.png")}).mousedown(function(){$(this).attr("src",a+"searchbtn_down.png")}).mouseup(function(){$(this).attr("src",a+"searchbtn_up.png")})}function setupFooter(){var a=$("#sitemap").outerWidth()-40;$("#sitemap div").each(function(){a-=$(this).outerWidth()});a=a/3;$("#sitemap div").each(function(b,c){switch(b){case 0:$(this).css("marginLeft",20);$(this).css("marginRight",a);break;case 1:$(this).css("marginRight",a+10);break;case 2:$(this).css("marginRight",a-10);break}})}function checkSearchInput(a){if($("#"+a).val()==""){$("#MODAL_body").text($("#search_error_msg").val()).removeClass().addClass("MODAL_ko");modal_show($("#error_title").val(),"popup");return false}return true}function checkRinnovo(){var b=false;if($("#unome").val()==""||$("#cognome").val()==""||$("#tel").val()==""||$("#subtype").val()==""){b=false}else{if($("#new_sub").is(":checked")&&$("#sublogin").val()==""){b=false}else{if($("#pay_cc").is(":checked")){if($("#cc_type").val()==""||$("#cc_num").val()==""||$("#cc_cv2").val()==""||$("#cc_exp_m").val()==""||$("#cc_exp_y").val()==""||$("#cc_owner").val()==""){b=false}else{b=true}}else{b=true}}}if(b){var a=$("#form_rinnovo").serializeArray();$.ajax({type:"post",url:"../common/form-rinnovo.php",data:a,dataType:"json",error:function(){$("#MODAL_body").text($("#server_error_msg").val()).removeClass().addClass("MODAL_ko");modal_show($("#error_title").val(),"popup")},success:function(c){if(c.result){$("#MODAL_body").text($("#success_msg").val()).removeClass().addClass("MODAL_ok");modal_show($("#success_title").val(),"popup");$("#form_rinnovo")[0].reset()}else{$("#MODAL_body").text($("#server_error_msg").val()).removeClass().addClass("MODAL_ko");modal_show($("#error_title").val(),"popup")}}})}else{$("#MODAL_body").text($("#validation_error_msg").val()).removeClass().addClass("MODAL_ko");modal_show($("#error_title").val(),"popup")}return false}function toggleNewSub(){if($("#new_sub").is(":checked")){$("#newsub_info").slideDown("fast")}else{$("#newsub_info").slideUp("fast")}}function togglePayInfo(a){if(a=="bb"){$("#cc_info").slideUp();$("#bb_info").slideDown()}else{$("#bb_info").slideUp();$("#cc_info").slideDown()}}function demoRequest(c){var b=$.Event(c);b.preventDefault();target=$("#demo-request");if($("#company").val()!=""&&$("#demo_mail").val()!=""){var a=target.serializeArray();$.ajax({type:"post",url:target.attr("action"),data:a,dataType:"json",error:function(){$("#MODAL_body").text($("#server_error_msg").val()).removeClass().addClass("MODAL_ko");modal_show($("#error_title").val(),"popup")},success:function(d){if(d.result){$("#MODAL_body").text($("#success_msg").val()).removeClass().addClass("MODAL_ok");modal_show($("#success_title").val(),"popup");$("#form_rinnovo")[0].reset()}else{$("#MODAL_body").text($("#server_error_msg").val()).removeClass().addClass("MODAL_ko");modal_show($("#error_title").val(),"popup")}}})}else{$("#MODAL_body").text($("#validation_error_msg").val()).removeClass().addClass("MODAL_ko");modal_show($("#error_title").val(),"popup")}};
