var baseReccUrl="";if(typeof (recsHostname)=="undefined"){baseReccUrl="http://recs.virgilio.it/fe/Service/";}else{baseReccUrl=recsHostname+"/fe/Service/";}var _data="";var _nomediv="";var timeout_recs=500;var timeout_saz_recs=10000;var defaultSettings={url:baseReccUrl,id:-1,categoria:"",voto:0,div:"",idxMessaggio:0,data:"",error:function(){defaultError(defaultSettings.div,defaultSettings.idxMessaggio);},success:function(){votoEseguito(defaultSettings.data,defaultSettings.div,defaultSettings.idxMessaggio);},src:"virgilio",a_tag_istat:"",a_tag_from:"local",timeout_recs:timeout_recs};var vettoreVoti=new Array();vettoreVoti[0]="ratePoor";vettoreVoti[1]="ratePoor";vettoreVoti[2]="rateMediumPoor";vettoreVoti[3]="rateAverage";vettoreVoti[4]="rateGood";vettoreVoti[5]="rateExcellent";var vettoreDescrizioneVoto=new Array();vettoreDescrizioneVoto[0]="scarso";vettoreDescrizioneVoto[1]="Scarso";vettoreDescrizioneVoto[2]="Mediocre";vettoreDescrizioneVoto[3]="Sufficiente";vettoreDescrizioneVoto[4]="Buono";vettoreDescrizioneVoto[5]="Ottimo";var vettoreMessaggiVoti=new Array();vettoreMessaggiVoti[0]="<span>GRAZIE PER AVER VOTATO</span>";vettoreMessaggiVoti[1]="<span>GRAZIE PER AVER VOTATO! IL TUO VOTO SAR&Agrave; PRESTO VISIBILE.</span>";function eseguiVoto(id,_2,_3,_4,_5){_nomediv_nomediv=_4;if(_5==null){_5=0;}_idxMessaggio=_5;eseguiVotoExt(id,_2,_3,function(){votoEseguito(_data,_nomediv,_idxMessaggio);},function(){defaultError(_nomediv,_idxMessaggio);});}function callVoting(_6){_6=$.extend(defaultSettings,_6);urlToCall=_6.url+"user/vote/"+_6.categoria+_6.id+"?vote="+vettoreVoti[_6.voto]+"&src="+_6.src+"&a_tag_istat="+_6.a_tag_istat+"&a_tag_from="+_6.a_tag_from;var _7="";$.ajax({dataType:"jsonp",data:"id=1",jsonp:"cb",url:urlToCall,success:function(_8){_6.data=_8;_data=_8;},complete:function(){},error:function(){}});setTimeout("checkf("+_6.success+", "+_6.error+", true)",_6.timeout_recs);}function eseguiVotoExt(id,_a,_b,_c,_d){urlToCall=baseReccUrl+"user/vote/"+_a+id+"?vote="+vettoreVoti[_b];var _e="";$.ajax({dataType:"jsonp",data:"id=1",jsonp:"cb",url:urlToCall,success:function(_f){_data=_f;},complete:function(){},error:function(){}});setTimeout("checkf("+_c+", "+_d+", true)",timeout_recs);}function eseguiView(id,_11){urlToCall=baseReccUrl+"track/send?item="+id+"&action=view";var _12="";$.ajax({dataType:"jsonp",data:"id=1",jsonp:"cb",url:urlToCall,success:function(_13){_data=_13;},complete:function(){},error:function(){}});}function checkf(_14,_15,_16){if(_data!=null&&_data!=""&&_data!="undefined"){_14(_data);}else{if(_16){setTimeout("checkf("+_14+", "+_15+", false)",(timeout_recs*2));if(_data!=null&&_data!=""&&_data!="undefined"){_14(_data);}else{setTimeout("checkf("+_14+", "+_15+", false)",(timeout_recs*3));}}else{_15();}}}function nascondiDescrizioneVoto(_17,_18){document.getElementById(_18).style.display="none";document.getElementById(_17).style.display="block";}function descrizioneVoto(_19,_1a,_1b){document.getElementById(_1a).innerHTML=vettoreDescrizioneVoto[_1b];document.getElementById(_19).style.display="none";document.getElementById(_1a).style.display="block";}function votoEseguito(_1c,_1d,_1e){if(_1e==null){_1e=0;}if(_1c==200){document.getElementById(_1d).innerHTML=vettoreMessaggiVoti[_1e];}else{if(_1c==501){document.getElementById(_1d).innerHTML="<span>HAI GI&Agrave; VOTATO!</span>";}else{if(_1c==201){document.getElementById(_1d).innerHTML=vettoreMessaggiVoti[_1e];}else{document.getElementById(_1d).innerHTML="<span>"+vettoreMessaggiVoti[_1e]+"</span>";}}}}function defaultError(_1f,_20){if(_20==null){_20=0;}document.getElementById(_1f).innerHTML="<span>"+vettoreMessaggiVoti[_20]+"</span>";}function roundVoto(_21){valVoto=Math.round(_21*2)/2;return valVoto;}var global_url="/recs/voti/";function getAZN_Ratings(ide,f,_24){var url=global_url;if(ide.substring(ide.length-3,ide.length)==""){url=url+"voti_LAZ_"+ide+".js";}else{url=url+ide.substring(ide.length-3,ide.length)+"/voti_"+ide+".js";}$.ajax({dataType:"json",timeout:timeout_saz_recs,url:url,error:function(_26,_27,_28){_f_error(_24,_27,_26.status);},cache:false,success:function(_29){f(_29.lista[0].n_ratings);}});}function getAZRanking(ide,f,_2c){var url=global_url;if(ide.substring(ide.length-3,ide.length)==""){url=url+"voti_LAZ_"+ide+".js";}else{url=url+ide.substring(ide.length-3,ide.length)+"/voti_"+ide+".js";}$.ajax({dataType:"json",contentType:"application/json; charset=utf-8",timeout:timeout_saz_recs,url:url,error:function(_2e,_2f,_30){_f_error(_2c,_2f,_2e.status);},cache:false,success:function(_31){f(_31.lista[0].ranking);}});}function getAZRankingN_Ratings(ide,f,_34){var url=global_url;if(ide.substring(ide.length-3,ide.length)==""){url=url+"voti_LAZ_"+ide+".js";}else{url=url+ide.substring(ide.length-3,ide.length)+"/voti_"+ide+".js";}$.ajax({dataType:"json",contentType:"application/json; charset=utf-8",timeout:timeout_saz_recs,url:url,error:function(_36,_37,_38){try{_f_error(_34,_37,_36.status);}catch(e){_f_error(_34,_37,504);}},cache:false,success:function(_39){f(_39.lista[0].ranking,_39.lista[0].n_ratings,ide);}});}function getEVN_Ratings(ide,f,_3c){var url=global_url;if(ide.substring(ide.length-3,ide.length)==""){url=url+"voti_LEV_"+ide+".js";}else{url=url+ide.substring(ide.length-3,ide.length)+"/voti_LEV_"+ide+".js";}$.ajax({dataType:"json",contentType:"application/json; charset=utf-8",timeout:timeout_saz_recs,url:url,error:function(_3e,_3f,_40){try{_f_error(_3c,_3f,_3e.status);}catch(e){_f_error(_3c,_3f,504);}},cache:false,success:function(_41){f(_41.lista[0].n_ratings);}});}function getEVRanking(ide,f,_44){var url=global_url;if(ide.substring(ide.length-3,ide.length)==""){url=url+"voti_LEV_"+ide+".js";}else{url=url+ide.substring(ide.length-3,ide.length)+"/voti_LEV_"+ide+".js";}$.ajax({dataType:"json",contentType:"application/json; charset=utf-8",timeout:timeout_saz_recs,url:url,error:function(_46,_47,_48){try{_f_error(_44,_47,_46.status);}catch(e){_f_error(_44,_47,504);}},cache:false,success:function(_49){f(_49.lista[0].ranking);}});}function getEVRankingN_Ratings(ide,f,_4c){var url=global_url;if(ide.substring(ide.length-3,ide.length)==""){url=url+"voti_LEV_"+ide+".js";}else{url=url+ide.substring(ide.length-3,ide.length)+"/voti_LEV_"+ide+".js";}$.ajax({dataType:"json",contentType:"application/json; charset=utf-8",timeout:timeout_saz_recs,url:url,error:function(_4e,_4f,_50){try{_f_error(_4c,_4f,_4e.status);}catch(e){_f_error(_4c,_4f,504);}},cache:false,success:function(_51){f(_51.lista[0].ranking,_51.lista[0].n_ratings);}});}function _f_error(_52,_53,_54){if(_52!="undefined"){_52(_53,_54);}}function loadVoti(_55){$(_55).each(function(i){var _57=this.id.replace("rating_gri_adv_","");getAZRankingN_Ratings(_57,leggivoto,function(){});});}function leggivoto(_58,_59,id){_58=roundVoto(_58);if(_59>0){var _5b="rating_";switch(_58){case 0:_5b+="0";break;case 0.5:_5b+="-5";break;case 1:_5b+="1";break;case 1.5:_5b+="1-5";break;case 2:_5b+="2";break;case 2.5:_5b+="2-5";break;case 3:_5b+="3";break;case 3.5:_5b+="3-5";break;case 4:_5b+="4";break;case 4.5:_5b+="4-5";break;case 5:_5b+="5";break;}if(_5b!="rating_"){$("#id_current_rating_"+id).removeClass();$("#id_current_rating_"+id).addClass(_5b);$("#id_current_rating_"+id).addClass("current-rating");}$("#risultato_voto_aziende_listing_"+id).empty().append("(<strong>"+_59+"</strong> voti - voto medio <strong>"+_58+"</strong>)");}}function boxAziendeRecs(_5c,_5d){urlToCall=baseReccUrl+"user/rawValue";$.ajax({dataType:"jsonp",contentType:"application/json; charset=utf-8",timeout:timeout_saz_recs,jsonp:"cb",url:urlToCall,error:function(_5e,_5f,_60){},cache:false,success:function(_61){cookieRecs=_61;url2RecAziende="/boxAziendeConsigliate?cookieRecs="+encodeURIComponent(cookieRecs)+"&catAziende="+encodeURIComponent(_5c)+"&idAzienda="+_5d;makeGetRequest(url2RecAziende);}});}