var istate=0;var iid=0;var xml_cfg_file;var xml_cfg;var xml_cli;var xml_lng;var xml_ini;var xml_ref;var qrStr=window.location.search;var spQrStr=qrStr.substring(1);var arrQrStr=new Array();var arr=spQrStr.split("&");for(var i=0;i<arr.length;i++){var index=arr[i].indexOf("=");var key=arr[i].substring(0,index);var val=arr[i].substring(index+1);arrQrStr[key]=val}function ecmsb_loadconfig(){var a=new ScriptQuery("ecmsb.js").flatten();xml_cfg_file=a.cfg;xml_cli=a.cli;xml_lng=a.lng;xml_ini=a.ini;xml_ref=a.ref;fcn("loadconfig","<request><cfgurl>"+xml_cfg_file+"</cfgurl><lingua>"+xml_lng+"</lingua></request>")}function stateChanged_loadconfig(a){xml_cfg=a;if(xml_ini=="book"){if(ecsmb_cfg("results","url")==null){ecmsb_init()}else{if(arrQrStr.ecmsb_request!=""&arrQrStr.ecmsb_request!=undefined){ecmsb_wait(true);istate=255;fcn("disponibilita",arrQrStr.ecmsb_request)}else{ecmsb_init()}}}if(xml_ini=="contact"){istate=255;ecmsb_contact(xml_ref,true)}}function ecmsb_init(){fcn("book","<request><cfgurl>"+xml_cfg_file+"</cfgurl><lingua>"+xml_lng+"</lingua></request>")}function stateChanged_book(a){xmlDoc=getXmlDoc(a);node=xmlDoc.getElementsByTagName("book")[0];var b="";b+=node.childNodes[0].childNodes[0].nodeValue;var c=o("ecmsb_book");c.innerHTML=b;ecmsb_wait(true);if(ecsmb_cfg("area","visible")==1){fcn("aree")}else{istate=istate+1}if(ecsmb_cfg("localita","visible")==1){fcn("citta")}else{istate=istate+2}if(ecsmb_cfg("tipologia","visible")==1){fcn("tipologie")}else{istate=istate+4}if(ecsmb_cfg("categoria","visible")==1){fcn("categorie")}else{istate=istate+8}LoadArrivo();LoadPartenza();LoadPersone();if(ecsmb_cfg("opzioni","visible")==1){LoadOpzioni()}else{istate=istate+128}}function o(a){return document.getElementById(a)}function s(a){return document.getElementById(a).style}function v(a){return document.getElementById(a).value}function vi(a){return parseInt(document.getElementById(a).value)}function or(a){while(a.options.length>0){a.remove(0)}}function advopt(){var a="";for(i=0;i<20;i++){if(obj=document.getElementById("o_"+i)){if(obj.checked){if(a!=""){a+=","}a+=obj.value}}}return a}var ScriptQuery=function(a){this.scriptPath=a};ScriptQuery.prototype={get:function(){var d=new RegExp(this.scriptPath.replace(".","\\.")+"(\\?.*)?$");var a=document.getElementsByTagName("script");for(var c=0;c<a.length;c++){var b=a[c];if(b.src&&b.src.match(d)){var e=b.src.match(/\?([^#]*)(#.*)?/);return !e?"":e[1]}}return""},parse:function(){var k={};var g=this.get();var d=g.split("&");for(var c=0;c<d.length;c++){var b=d[c].split("=");var a=b[0],h=b[1];if(!k[a]){k[a]=[]}if(!h){h="true"}else{try{h=decodeURIComponent(h)}catch(f){h=unescape(h)}}var j=k[a];j[j.length]=h}return k},flatten:function(){var b=this.parse();for(var a in b){b[a]=b[a][0]}return b},toString:function(){return"ScriptQuery [path="+this.scriptPath+"]"}};function ecmsb_pageprev(a){s("book_"+(a-1)).display="block";s("book_"+a).display="none"}function ecmsb_pagenext(a){s("book_"+(a+1)).display="block";s("book_"+a).display="none"}function ecmsb_skip(a){ecmsb_wait(true);o("ecmsb_position").value=a;fcn("disponibilita")}function ecmsb_newsearch(){var a=ecsmb_cfg("search","url");if(a==""){ecmsb_pageprev(2)}else{window.document.location.href=a}}function getElementPosition(d){var a=document.getElementById(d);var c=0;var b=0;while(a){c+=a.offsetLeft;b+=a.offsetTop;a=a.offsetParent}if(navigator.userAgent.indexOf("Mac")!=-1&&typeof document.body.leftMargin!="undefined"){c+=document.body.leftMargin;b+=document.body.topMargin}return{left:c,top:b}}function ecmsb_hideE(a){if(document.getElementById){document.getElementById(a).style.visibility="hidden";document.getElementById(a).style.height="5px"}else{if(document.layers){document.hideShow.visibility="hidden"}else{document.all.hideShow.style.visibility="hidden"}}}function ecmsb_showE(a){document.getElementById(a).style.display="block"}function ecmsb_wait(b){if(b){var a=getElementPosition("ecmsb_book");s("book_0").top=a.top;s("book_0").left=a.left;s("book_0").width=o("ecmsb_book").offsetWidth;s("book_0").height=o("ecmsb_book").offsetHeight;s("book_0ani").top=a.top+o("ecmsb_book").offsetHeight/2-20;s("book_0ani").left=a.left+o("ecmsb_book").offsetWidth/2-20;s("book_0").display="block";s("book_0ani").display="block"}else{s("book_0").display="none";s("book_0ani").display="none"}}function ecmsb_build_rn(b){var a="<request>";a+="<id>"+iid+"</id>";a+="<config>"+xml_cfg_file+"</config>";a+="<lingua>"+xml_lng+"</lingua>";a+="<area>"+v("ecmsb_aree")+"</area>";a+="<localita>"+v("ecmsb_localita")+"</localita>";a+="<tipologia>"+v("ecmsb_tipologia")+"</tipologia>";a+="<categoria>"+v("ecmsb_categoria")+"</categoria>";a+="<arrivo>"+v("ecmsb_arrivo")+"</arrivo>";a+="<partenza>"+v("ecmsb_partenza")+"</partenza>";a+="<persone>"+v("ecmsb_persone")+"</persone>";a+="<camera>"+v("ecmsb_camera")+"</camera>";a+="<struttura>"+ecsmb_cfg("struttura","id")+"</struttura>";a+="<opzioni>"+v("ecmsb_opzioni")+"</opzioni>";a+="<results>"+v("ecmsb_results")+"</results>";a+="<position>"+v("ecmsb_position")+"</position>";a+="<advanced>"+advopt()+"</advanced>";a+="<format>HTML</format>";a+="</request>";return a}function ecmsb_areeonchange(){ecmsb_wait(true);istate=istate-2;fcn("citta")}function ecmsb_search(){ecmsb_wait(true);fcn("disponibilita")}function check_date(m){var k="0123456789";var c=fld=document.getElementById(m);var g="";var d="";var j="/";var l;var f;var h;var a=0;var b=0;var e;b=0;DateValue=c.value;for(e=0;e<DateValue.length;e++){if(k.indexOf(DateValue.substr(e,1))>=0){d=d+DateValue.substr(e,1)}}DateValue=d;if(DateValue.length==6){DateValue=DateValue.substr(0,4)+"20"+DateValue.substr(4,2)}if(DateValue.length!=8){b=19}h=DateValue.substr(4,4);if(h==0){b=20}f=DateValue.substr(2,2);if((f<1)||(f>12)){b=21}l=DateValue.substr(0,2);if(l<1){b=22}if((h%4==0)||(h%100==0)||(h%400==0)){a=1}if((f==2)&&(a==1)&&(l>29)){b=23}if((f==2)&&(a!=1)&&(l>28)){b=24}if((l>31)&&((f=="01")||(f=="03")||(f=="05")||(f=="07")||(f=="08")||(f=="10")||(f=="12"))){b=25}if((l>30)&&((f=="04")||(f=="06")||(f=="09")||(f=="11"))){b=26}if((l==0)&&(f==0)&&(h==0)){b=0;l="";f="";h="";j="";c.value=l+j+f+j+h;return false}if(b==0){c.value=l+j+f+j+h;return true}return false}function ecmsb_search2(){if(v("ecmsb_tipologia")==""){alert("Non è stata selezionata la tipologia della struttura desiderata..");return}if(!check_date("ecmsb_arrivo")){alert("La data di arrivo inserita è errata.");return}if(!check_date("ecmsb_partenza")){alert("La data di partenza inserita è errata.");return}if(v("ecmsb_persone")==""){alert("Non è stato selezionato il numero di persone.");return}o("ecmsb_request").value=ecmsb_build_rn();document.ecmsb_form.submit()}function ecmsb_showtel(a,b){document.getElementById(a).innerHTML=b}function ecmsb_scheda(c,b){if(b){iid=c;ecmsb_wait(true);var a="<request>";a+="<id>"+iid+"</id>";a+="<config>"+xml_cfg_file+"</config>";a+="<lingua>"+xml_lng+"</lingua>";a+="</request>";fcn("scheda",a)}else{iid=0;s("book_2").display="block";s("book_scheda").display="none"}}function ecmsb_contact(c,b){if(b){iid=c;ecmsb_wait(true);var a="<request>";a+="<id>"+iid+"</id>";a+="<config>"+xml_cfg_file+"</config>";a+="<lingua>"+xml_lng+"</lingua>";a+="</request>";fcn("contact",a)}else{if(xml_ini=="contact"){closynoshowsme()}iid=0;s("book_2").display="block";s("book_contact").display="none"}}function ecmsb_prenota(c,b){if(b){iid=c;ecmsb_wait(true);var a="<request>";a+="<id>"+iid+"</id>";a+="<config>"+xml_cfg_file+"</config>";a+="<lingua>"+arrQrStr.ecmsb_language+"</lingua>";a+="</request>";fcn("contact",a)}else{iid=0;s("book_2").display="block";s("book_contact").display="none"}}var xhf=new Array();var xhr=new Array();var xi=new Array(0);xi[0]=1;function fcn(fnc,rn){var xhri=xhrRequest("html",fnc);var url=xml_cli;url=url+"?fnc="+fnc;if(!rn){}if(!rn){url=url+"&rn="+ecmsb_build_rn()}else{url=url+"&rn="+rn}url=url+"&sid="+Math.random();xhr[xhri].open("GET",url,true);xhr[xhri].onreadystatechange=function(){if(xhr[xhri].readyState==4&&xhr[xhri].status==200){eval(xhf[xhri]+"(xhr[xhri].responseText)");xi[xhri]=1;xhr[xhri]=null;xhf[xhri]=null;if(istate==255){ecmsb_wait(false)}}};xhr[xhri].send(null)}function xhrRequest(b,f){if(!b){b="html"}var c=xi.length;for(var a=0;a<xi.length;a++){if(xi[a]==1){xi[a]=0;c=a;break}}xi[c]=0;if(window.ActiveXObject){try{xhr[c]=new ActiveXObject("Msxml2.XMLHTTP")}catch(d){try{xhr[c]=new ActiveXObject("Microsoft.XMLHTTP")}catch(d){}}}else{if(window.XMLHttpRequest){xhr[c]=new XMLHttpRequest();if(xhr[c].overrideMimeType){xhr[c].overrideMimeType("text/"+b)}}}xhf[c]="stateChanged_"+f;return(c)}function getXmlDoc(a){try{xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.loadXML(a)}catch(b){try{parser=new DOMParser();xmlDoc=parser.parseFromString(a,"text/xml")}catch(b){alert(b.message)}}try{return xmlDoc}catch(b){alert(b.message)}}function stateChanged_aree(a){var c=ecsmb_cfg("area","default");xmlDoc=getXmlDoc(a);var d=o("ecmsb_aree");or(d);d.disabled=true;for(var b=0;b<xmlDoc.getElementsByTagName("Area").length;b++){var e=document.createElement("OPTION");d.options.add(e);e.value=xmlDoc.getElementsByTagName("Area")[b].getAttribute("ID");e.innerHTML=xmlDoc.getElementsByTagName("Area")[b].firstChild.nodeValue;if(e.value==c){c=b}}d.options[c].selected=true;d.disabled=false;istate=istate+1}function stateChanged_citta(a){var c=ecsmb_cfg("localita","default");xmlDoc=getXmlDoc(a);var d=o("ecmsb_localita");or(d);d.disabled=true;for(var b=0;b<xmlDoc.getElementsByTagName("citta").length;b++){var e=document.createElement("OPTION");d.options.add(e);e.value=xmlDoc.getElementsByTagName("citta")[b].getAttribute("id");e.innerHTML=xmlDoc.getElementsByTagName("citta")[b].firstChild.nodeValue;if(e.value==c){c=b}}d.options[c].selected=true;d.disabled=false;istate=istate+2}function stateChanged_tipologie(a){xmlDoc=getXmlDoc(a);var c=document.ecmsb_form.ecmsb_tipologia;or(c);c.disabled=true;for(var b=0;b<xmlDoc.getElementsByTagName("Tipologia").length;b++){var d=document.createElement("OPTION");c.options.add(d);d.value=xmlDoc.getElementsByTagName("Tipologia")[b].getAttribute("ID");d.innerHTML=xmlDoc.getElementsByTagName("Tipologia")[b].firstChild.nodeValue}c.options[ecsmb_cfg("tipologia","default")].selected=true;c.disabled=false;istate=istate+4}function stateChanged_categorie(a){xmlDoc=getXmlDoc(a);var c=document.ecmsb_form.ecmsb_categoria;or(c);c.disabled=true;for(var b=0;b<xmlDoc.getElementsByTagName("Categoria").length;b++){var d=document.createElement("OPTION");c.options.add(d);d.value=xmlDoc.getElementsByTagName("Categoria")[b].getAttribute("ID");d.innerHTML=xmlDoc.getElementsByTagName("Categoria")[b].firstChild.nodeValue}c.options[ecsmb_cfg("categoria","default")].selected=true;c.disabled=false;istate=istate+8}function stateChanged_disponibilita(j){xmlDoc=getXmlDoc(j);var f=o("book_2page");var a=xmlDoc.getElementsByTagName("struttura").length;var k=xmlDoc.getElementsByTagName("result")[0].getAttribute("count");var b=vi("ecmsb_position")-vi("ecmsb_results");var d=vi("ecmsb_position")+vi("ecmsb_results");var g="";var c="";g+='<p align="left">';g+='<a href="javascript: ecmsb_newsearch()">Nuova ricerca</a>';g+="</p>";for(var e=0;e<a;e++){node=xmlDoc.getElementsByTagName("struttura")[e];g+=node.childNodes[0].childNodes[0].nodeValue}g+='<br /><p align="center">';if(b>-1){g+='<a href="javascript: ecmsb_skip('+b+')">&lt;&lt; Indietro</a>&nbsp;&nbsp;'}if(d<k){g+='<a href="javascript: ecmsb_skip('+d+')">Avanti &gt;&gt;</a>'}g+="<p>";f.innerHTML=g;s("book_1").display="none";s("book_2").display="block"}function stateChanged_scheda(a){xmlDoc=getXmlDoc(a);node=xmlDoc.getElementsByTagName("struttura")[0];var c=o("book_scheda");var b="";b+=node.childNodes[0].childNodes[0].nodeValue;c.innerHTML=b;s("book_2").display="none";s("book_scheda").display="block"}function stateChanged_contact(a){xmlDoc=getXmlDoc(a);node=xmlDoc.getElementsByTagName("struttura")[0];var c=o("book_contact");var b="";b+=node.childNodes[0].childNodes[0].nodeValue;c.innerHTML=b;s("book_2").display="none";s("book_contact").display="block"}function ecsmb_cfg(b,a){xmlDoc=getXmlDoc(xml_cfg);node=xmlDoc.getElementsByTagName("loadconfig")[0];xmlDoc=getXmlDoc(node.childNodes[0].childNodes[0].nodeValue);node=xmlDoc.getElementsByTagName(b)[0];return node.getAttribute(a)}var browserName=navigator.appName;if(browserName=="Netscape"){function closynoshowsme(){window.open("","_parent","");window.close()}}else{if(browserName=="Microsoft Internet Explorer"){function closynoshowsme(){window.opener="whocares";window.open("","_parent","");window.close()}}}function stateChanged_requestinfo(a){alert("Messaggio inviato correttamente.\n\nTi ringraziamo per averci contattato.");if(xml_ini=="contact"){closynoshowsme()}else{ecmsb_contact(false)}}function LoadArrivo(){var b=new Date();var a=b.getDate();var e=b.getMonth()+1;var f=b.getFullYear();var c=o("ecmsb_arrivo");c.value="gg/mm/aaaa";if(a<10){a="0"+a}if(e<10){e="0"+e}c.value=a+"/"+e+"/"+f;var d=ecsmb_cfg("arrivo","default");if(d!=""){c.value=d}c.disabled=false;istate=istate+16}function LoadPartenza(){var a=o("ecmsb_partenza");a.value="gg/mm/aaaa";a.value=ecsmb_cfg("partenza","default");a.disabled=false;istate=istate+32}function LoadPersone(){var b=document.ecmsb_form.ecmsb_persone;while(b.options.length>0){b.remove(0)}var c=document.createElement("OPTION");b.options.add(c);c.value="";if(xml_lng=="it"){c.innerHTML="Selezionare il numero"}if(xml_lng=="en"){c.innerHTML="Select number"}if(xml_lng=="de"){c.innerHTML="Bitte eine Ziffer auswählen"}b.disabled=true;for(var a=1;a<parseInt(ecsmb_cfg("persone","max"))+1;a++){var c=document.createElement("OPTION");b.options.add(c);c.value=a;c.innerHTML=a}b.options[ecsmb_cfg("persone","default")].selected=true;b.disabled=false;istate=istate+64}function LoadOpzioni(){var a=document.ecmsb_form.ecmsb_opzioni;a.disabled=true;while(a.options.length>0){a.remove(0)}var b=document.createElement("OPTION");a.options.add(b);b.value="0";if(xml_lng=="it"){b.innerHTML="Elenco completo"}if(xml_lng=="en"){b.innerHTML="View all vacancies"}if(xml_lng=="de"){b.innerHTML="Alle verfügbare Unterkünften"}var b=document.createElement("OPTION");a.options.add(b);b.value="0";if(xml_lng=="it"){b.innerHTML="Prenotabili on-line"}if(xml_lng=="en"){b.innerHTML="Online bookable only"}if(xml_lng=="de"){b.innerHTML="Nur buchbaren Unterkünften"}a.disabled=false;istate=istate+128}function GetXmlHttpObjectEx(){var a=null;try{a=new XMLHttpRequest()}catch(b){try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(b){a=new ActiveXObject("Microsoft.XMLHTTP")}}return a}function GetXmlHttpObject(){if(typeof XMLHttpRequest!="undefined"){return new XMLHttpRequest()}else{if(window.ActiveXObject){var a=["MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp"];for(var b=0;b<a.length;b++){try{var d=new ActiveXObject(a[b]);return d}catch(c){}}}}throw new Error("XMLHttp object could be created.")}function jsw_LoadEvent(a){var b=window.onload;if(typeof window.onload!="function"){window.onload=a}else{window.onload=function(){if(b){b()}a()}}}function getAnchorPosition(b){var e=false;var k=new Object();var j=0,g=0;var d=false,f=false,h=false;if(document.getElementById){d=true}else{if(document.all){f=true}else{if(document.layers){h=true}}}if(d&&document.all){j=AnchorPosition_getPageOffsetLeft(document.all[b]);g=AnchorPosition_getPageOffsetTop(document.all[b])}else{if(d){var a=document.getElementById(b);j=AnchorPosition_getPageOffsetLeft(a);g=AnchorPosition_getPageOffsetTop(a)}else{if(f){j=AnchorPosition_getPageOffsetLeft(document.all[b]);g=AnchorPosition_getPageOffsetTop(document.all[b])}else{if(h){var l=0;for(var c=0;c<document.anchors.length;c++){if(document.anchors[c].name==b){l=1;break}}if(l==0){k.x=0;k.y=0;return k}j=document.anchors[c].x;g=document.anchors[c].y}else{k.x=0;k.y=0;return k}}}}k.x=j;k.y=g;return k}function getAnchorWindowPosition(b){var c=getAnchorPosition(b);var a=0;var d=0;if(document.getElementById){if(isNaN(window.screenX)){a=c.x-document.body.scrollLeft+window.screenLeft;d=c.y-document.body.scrollTop+window.screenTop}else{a=c.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;d=c.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset}}else{if(document.all){a=c.x-document.body.scrollLeft+window.screenLeft;d=c.y-document.body.scrollTop+window.screenTop}else{if(document.layers){a=c.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;d=c.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset}}}c.x=a;c.y=d;return c}function AnchorPosition_getPageOffsetLeft(b){var a=b.offsetLeft;while((b=b.offsetParent)!=null){a+=b.offsetLeft}return a}function AnchorPosition_getWindowOffsetLeft(a){return AnchorPosition_getPageOffsetLeft(a)-document.body.scrollLeft}function AnchorPosition_getPageOffsetTop(a){var b=a.offsetTop;while((a=a.offsetParent)!=null){b+=a.offsetTop}return b}function AnchorPosition_getWindowOffsetTop(a){return AnchorPosition_getPageOffsetTop(a)-document.body.scrollTop}var MONTH_NAMES=new Array("January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");var DAY_NAMES=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sun","Mon","Tue","Wed","Thu","Fri","Sat");function LZ(a){return(a<0||a>9?"":"0")+a}function isDate(c,b){var a=getDateFromFormat(c,b);if(a==0){return false}return true}function compareDates(e,f,c,d){var b=getDateFromFormat(e,f);var a=getDateFromFormat(c,d);if(b==0||a==0){return -1}else{if(b>a){return 1}}return 0}function formatDate(N,I){I=I+"";var n="";var z=0;var L="";var f="";var l=N.getYear()+"";var g=N.getMonth()+1;var J=N.getDate();var q=N.getDay();var p=N.getHours();var B=N.getMinutes();var t=N.getSeconds();var w,x,b,u,O,e,G,F,C,r,Q,p,P,j,a,D;var A=new Object();if(l.length<4){l=""+(l-0+1900)}A.y=""+l;A.yyyy=l;A.yy=l.substring(2,4);A.M=g;A.MM=LZ(g);A.MMM=MONTH_NAMES[g-1];A.NNN=MONTH_NAMES[g+11];A.d=J;A.dd=LZ(J);A.E=DAY_NAMES[q+7];A.EE=DAY_NAMES[q];A.H=p;A.HH=LZ(p);if(p==0){A.h=12}else{if(p>12){A.h=p-12}else{A.h=p}}A.hh=LZ(A.h);if(p>11){A.K=p-12}else{A.K=p}A.k=p+1;A.KK=LZ(A.K);A.kk=LZ(A.k);if(p>11){A.a="PM"}else{A.a="AM"}A.m=B;A.mm=LZ(B);A.s=t;A.ss=LZ(t);while(z<I.length){L=I.charAt(z);f="";while((I.charAt(z)==L)&&(z<I.length)){f+=I.charAt(z++)}if(A[f]!=null){n=n+A[f]}else{n=n+f}}return n}function _isInteger(c){var b="1234567890";for(var a=0;a<c.length;a++){if(b.indexOf(c.charAt(a))==-1){return false}}return true}function _getInt(f,d,e,c){for(var a=c;a>=e;a--){var b=f.substring(d,d+a);if(b.length<e){return null}if(_isInteger(b)){return b}}return null}function getDateFromFormat(B,q){B=B+"";q=q+"";var A=0;var l=0;var t="";var f="";var z="";var h,g;var b=new Date();var j=b.getYear();var w=b.getMonth()+1;var u=1;var d=b.getHours();var r=b.getMinutes();var n=b.getSeconds();var k="";while(l<q.length){t=q.charAt(l);f="";while((q.charAt(l)==t)&&(l<q.length)){f+=q.charAt(l++)}if(f=="yyyy"||f=="yy"||f=="y"){if(f=="yyyy"){h=4;g=4}if(f=="yy"){h=2;g=2}if(f=="y"){h=2;g=4}j=_getInt(B,A,h,g);if(j==null){return 0}A+=j.length;if(j.length==2){if(j>70){j=1900+(j-0)}else{j=2000+(j-0)}}}else{if(f=="MMM"||f=="NNN"){w=0;for(var p=0;p<MONTH_NAMES.length;p++){var e=MONTH_NAMES[p];if(B.substring(A,A+e.length).toLowerCase()==e.toLowerCase()){if(f=="MMM"||(f=="NNN"&&p>11)){w=p+1;if(w>12){w-=12}A+=e.length;break}}}if((w<1)||(w>12)){return 0}}else{if(f=="EE"||f=="E"){for(var p=0;p<DAY_NAMES.length;p++){var m=DAY_NAMES[p];if(B.substring(A,A+m.length).toLowerCase()==m.toLowerCase()){A+=m.length;break}}}else{if(f=="MM"||f=="M"){w=_getInt(B,A,f.length,2);if(w==null||(w<1)||(w>12)){return 0}A+=w.length}else{if(f=="dd"||f=="d"){u=_getInt(B,A,f.length,2);if(u==null||(u<1)||(u>31)){return 0}A+=u.length}else{if(f=="hh"||f=="h"){d=_getInt(B,A,f.length,2);if(d==null||(d<1)||(d>12)){return 0}A+=d.length}else{if(f=="HH"||f=="H"){d=_getInt(B,A,f.length,2);if(d==null||(d<0)||(d>23)){return 0}A+=d.length}else{if(f=="KK"||f=="K"){d=_getInt(B,A,f.length,2);if(d==null||(d<0)||(d>11)){return 0}A+=d.length}else{if(f=="kk"||f=="k"){d=_getInt(B,A,f.length,2);if(d==null||(d<1)||(d>24)){return 0}A+=d.length;d--}else{if(f=="mm"||f=="m"){r=_getInt(B,A,f.length,2);if(r==null||(r<0)||(r>59)){return 0}A+=r.length}else{if(f=="ss"||f=="s"){n=_getInt(B,A,f.length,2);if(n==null||(n<0)||(n>59)){return 0}A+=n.length}else{if(f=="a"){if(B.substring(A,A+2).toLowerCase()=="am"){k="AM"}else{if(B.substring(A,A+2).toLowerCase()=="pm"){k="PM"}else{return 0}}A+=2}else{if(B.substring(A,A+f.length)!=f){return 0}else{A+=f.length}}}}}}}}}}}}}}if(A!=B.length){return 0}if(w==2){if(((j%4==0)&&(j%100!=0))||(j%400==0)){if(u>29){return 0}}else{if(u>28){return 0}}}if((w==4)||(w==6)||(w==9)||(w==11)){if(u>30){return 0}}if(d<12&&k=="PM"){d=d-0+12}else{if(d>11&&k=="AM"){d-=12}}var a=new Date(j,w-1,u,d,r,n);return a.getTime()}function parseDate(h){var f=(arguments.length==2)?arguments[1]:false;generalFormats=new Array("y-M-d","MMM d, y","MMM d,y","y-MMM-d","d-MMM-y","MMM d");monthFirst=new Array("M/d/y","M-d-y","M.d.y","MMM-d","M/d","M-d");dateFirst=new Array("d/M/y","d-M-y","d.M.y","d-MMM","d/M","d-M");var b=new Array("generalFormats",f?"dateFirst":"monthFirst",f?"monthFirst":"dateFirst");var g=null;for(var e=0;e<b.length;e++){var a=window[b[e]];for(var c=0;c<a.length;c++){g=getDateFromFormat(h,a[c]);if(g!=0){return new Date(g)}}}return null}function PopupWindow_getXYPosition(a){var b;if(this.type=="WINDOW"){b=getAnchorWindowPosition(a)}else{b=getAnchorPosition(a)}this.x=b.x;this.y=b.y}function PopupWindow_setSize(b,a){this.width=b;this.height=a}function PopupWindow_populate(a){this.contents=a;this.populated=false}function PopupWindow_setUrl(a){this.url=a}function PopupWindow_setWindowProperties(a){this.windowProperties=a}function PopupWindow_refresh(){if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).innerHTML=this.contents}else{if(this.use_css){document.all[this.divName].innerHTML=this.contents}else{if(this.use_layers){var a=document.layers[this.divName];a.document.open();a.document.writeln(this.contents);a.document.close()}}}}else{if(this.popupWindow!=null&&!this.popupWindow.closed){if(this.url!=""){this.popupWindow.location.href=this.url}else{this.popupWindow.document.open();this.popupWindow.document.writeln(this.contents);this.popupWindow.document.close()}this.popupWindow.focus()}}}function PopupWindow_showPopup(a){hideSelects("hidden");this.getXYPosition(a);this.x;this.y+=this.offsetY;if(!this.populated&&(this.contents!="")){this.populated=true;this.refresh()}if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).style.left=this.x+"px";document.getElementById(this.divName).style.top=this.y+"px";document.getElementById(this.divName).style.visibility="visible"}else{if(this.use_css){document.all[this.divName].style.left=this.x;document.all[this.divName].style.top=this.y;document.all[this.divName].style.visibility="visible"}else{if(this.use_layers){document.layers[this.divName].left=this.x;document.layers[this.divName].top=this.y;document.layers[this.divName].visibility="visible"}}}}else{if(this.popupWindow==null||this.popupWindow.closed){if(this.x<0){this.x=0}if(this.y<0){this.y=0}if(screen&&screen.availHeight){if((this.y+this.height)>screen.availHeight){this.y=screen.availHeight-this.height}}if(screen&&screen.availWidth){if((this.x+this.width)>screen.availWidth){this.x=screen.availWidth-this.width}}var b=window.opera||(document.layers&&!navigator.mimeTypes["*"])||navigator.vendor=="KDE"||(document.childNodes&&!document.all&&!navigator.taintEnabled);this.popupWindow=window.open(b?"":"about:blank","window_"+a,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"")}this.refresh()}}function PopupWindow_hidePopup(){hideSelects("visible");if(this.divName!=null){if(this.use_gebi){document.getElementById(this.divName).style.visibility="hidden"}else{if(this.use_css){document.all[this.divName].style.visibility="hidden"}else{if(this.use_layers){document.layers[this.divName].visibility="hidden"}}}}else{if(this.popupWindow&&!this.popupWindow.closed){this.popupWindow.close();this.popupWindow=null}}}function PopupWindow_isClicked(c){if(this.divName!=null){if(this.use_layers){var d=c.pageX;var b=c.pageY;var a=document.layers[this.divName];if((d>a.left)&&(d<a.left+a.clip.width)&&(b>a.top)&&(b<a.top+a.clip.height)){return true}else{return false}}else{if(document.all){var a=window.event.srcElement;while(a.parentElement!=null){if(a.id==this.divName){return true}a=a.parentElement}return false}else{if(this.use_gebi&&c){var a=c.originalTarget;while(a.parentNode!=null){if(a.id==this.divName){return true}a=a.parentNode}return false}}}return false}return false}function PopupWindow_hideIfNotClicked(a){if(this.autoHideEnabled&&!this.isClicked(a)){this.hidePopup()}}function PopupWindow_autoHide(){this.autoHideEnabled=true}function PopupWindow_hidePopupWindows(c){for(var a=0;a<popupWindowObjects.length;a++){if(popupWindowObjects[a]!=null){var b=popupWindowObjects[a];b.hideIfNotClicked(c)}}}function PopupWindow_attachListener(){if(document.layers){document.captureEvents(Event.MOUSEUP)}window.popupWindowOldEventListener=document.onmouseup;if(window.popupWindowOldEventListener!=null){document.onmouseup=new Function("window.popupWindowOldEventListener();PopupWindow_hidePopupWindows();")}else{document.onmouseup=PopupWindow_hidePopupWindows}}function PopupWindow(){if(!window.popupWindowIndex){window.popupWindowIndex=0}if(!window.popupWindowObjects){window.popupWindowObjects=new Array()}if(!window.listenerAttached){window.listenerAttached=true;PopupWindow_attachListener()}this.index=popupWindowIndex++;popupWindowObjects[this.index]=this;this.divName=null;this.popupWindow=null;this.width=0;this.height=0;this.populated=false;this.visible=false;this.autoHideEnabled=false;this.contents="";this.url="";this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";if(arguments.length>0){this.type="DIV";this.divName=arguments[0]}else{this.type="WINDOW"}this.use_gebi=false;this.use_css=false;this.use_layers=false;if(document.getElementById){this.use_gebi=true}else{if(document.all){this.use_css=true}else{if(document.layers){this.use_layers=true}else{this.type="WINDOW"}}}this.offsetX=0;this.offsetY=0;this.getXYPosition=PopupWindow_getXYPosition;this.populate=PopupWindow_populate;this.setUrl=PopupWindow_setUrl;this.setWindowProperties=PopupWindow_setWindowProperties;this.refresh=PopupWindow_refresh;this.showPopup=PopupWindow_showPopup;this.hidePopup=PopupWindow_hidePopup;this.setSize=PopupWindow_setSize;this.isClicked=PopupWindow_isClicked;this.autoHide=PopupWindow_autoHide;this.hideIfNotClicked=PopupWindow_hideIfNotClicked}var MSIE=navigator.userAgent.indexOf("MSIE")>=0?true:false;var isFirefox=navigator.userAgent.toLowerCase().indexOf("firefox")>=0?true:false;var navigatorVersion=navigator.appVersion.replace(/.*?MSIE ([0-9]\.[0-9]).*/g,"$1")/1;function hideSelects(c){if(MSIE&navigatorVersion>6){return}if(!MSIE){return}if(c!="visible"){c="hidden"}if(navigator.appName.indexOf("MSIE")){for(var a=0;a<document.forms.length;a++){for(var b=0;b<document.forms[a].length;b++){if(document.forms[a].elements[b].options){document.forms[a].elements[b].style.visibility=c}}}}}function CalendarPopup(){var b;var a=true;if(arguments.length>0){b=new PopupWindow(arguments[0])}else{b=new PopupWindow();b.setSize(160,175)}if(arguments.length>2){b.offsetX=arguments[2];b.offsetY=arguments[3];b.autoHide()}else{b.offsetX=-152;b.offsetY=31;b.autoHide()}if(arguments.length>1){if(arguments[1]!="en"){a=false}if(arguments[1]=="it"){b.monthNames=new Array("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre");b.monthAbbreviations=new Array("Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic");b.dayHeaders=new Array("D","L","M","M","G","V","S");b.todayText="Oggi"}if(arguments[1]=="de"){b.monthNames=new Array("Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember");b.monthAbbreviations=new Array("Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez");b.dayHeaders=new Array("S","Mo","Di","Mi","Di","F","Sa");b.todayText="Heute"}}if(a==true){b.monthNames=new Array("January","February","March","April","May","June","July","August","September","October","November","December");b.monthAbbreviations=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");b.dayHeaders=new Array("S","M","T","W","T","F","S");b.todayText="Today"}b.returnFunction="CP_tmpReturnFunction";b.returnMonthFunction="CP_tmpReturnMonthFunction";b.returnQuarterFunction="CP_tmpReturnQuarterFunction";b.returnYearFunction="CP_tmpReturnYearFunction";b.weekStartDay=0;b.isShowYearNavigation=false;b.displayType="date";b.disabledWeekDays=new Object();b.disabledDatesExpression="";b.yearSelectStartOffset=2;b.currentDate=null;b.cssPrefix="";b.isShowNavigationDropdowns=false;b.isShowYearNavigationInput=false;window.CP_calendarObject=null;window.CP_targetInput=null;window.CP_dateFormat="MM/dd/yyyy";b.copyMonthNamesToWindow=CP_copyMonthNamesToWindow;b.setReturnFunction=CP_setReturnFunction;b.setReturnMonthFunction=CP_setReturnMonthFunction;b.setReturnQuarterFunction=CP_setReturnQuarterFunction;b.setReturnYearFunction=CP_setReturnYearFunction;b.setMonthNames=CP_setMonthNames;b.setMonthAbbreviations=CP_setMonthAbbreviations;b.setDayHeaders=CP_setDayHeaders;b.setWeekStartDay=CP_setWeekStartDay;b.setDisplayType=CP_setDisplayType;b.setDisabledWeekDays=CP_setDisabledWeekDays;b.addDisabledDates=CP_addDisabledDates;b.setYearSelectStartOffset=CP_setYearSelectStartOffset;b.setTodayText=CP_setTodayText;b.showYearNavigation=CP_showYearNavigation;b.showCalendar=CP_showCalendar;b.hideCalendar=CP_hideCalendar;b.getStyles=getCalendarStyles;b.refreshCalendar=CP_refreshCalendar;b.getCalendar=CP_getCalendar;b.select=CP_select;b.setCssPrefix=CP_setCssPrefix;b.showNavigationDropdowns=CP_showNavigationDropdowns;b.showYearNavigationInput=CP_showYearNavigationInput;b.copyMonthNamesToWindow();return b}function CP_copyMonthNamesToWindow(){if(typeof(window.MONTH_NAMES)!="undefined"&&window.MONTH_NAMES!=null){window.MONTH_NAMES=new Array();for(var a=0;a<this.monthNames.length;a++){window.MONTH_NAMES[window.MONTH_NAMES.length]=this.monthNames[a]}for(var a=0;a<this.monthAbbreviations.length;a++){window.MONTH_NAMES[window.MONTH_NAMES.length]=this.monthAbbreviations[a]}}}function CP_tmpReturnFunction(e,a,c){if(window.CP_targetInput!=null){var b=new Date(e,a-1,c,0,0,0);if(window.CP_calendarObject!=null){window.CP_calendarObject.copyMonthNamesToWindow()}window.CP_targetInput.value=formatDate(b,window.CP_dateFormat)}else{alert("Use setReturnFunction() to define which function will get the clicked results!")}}function CP_tmpReturnMonthFunction(b,a){alert("Use setReturnMonthFunction() to define which function will get the clicked results!\nYou clicked: year="+b+" , month="+a)}function CP_tmpReturnQuarterFunction(b,a){alert("Use setReturnQuarterFunction() to define which function will get the clicked results!\nYou clicked: year="+b+" , quarter="+a)}function CP_tmpReturnYearFunction(a){alert("Use setReturnYearFunction() to define which function will get the clicked results!\nYou clicked: year="+a)}function CP_setReturnFunction(a){this.returnFunction=a}function CP_setReturnMonthFunction(a){this.returnMonthFunction=a}function CP_setReturnQuarterFunction(a){this.returnQuarterFunction=a}function CP_setReturnYearFunction(a){this.returnYearFunction=a}function CP_setMonthNames(){for(var a=0;a<arguments.length;a++){this.monthNames[a]=arguments[a]}this.copyMonthNamesToWindow()}function CP_setMonthAbbreviations(){for(var a=0;a<arguments.length;a++){this.monthAbbreviations[a]=arguments[a]}this.copyMonthNamesToWindow()}function CP_setDayHeaders(){for(var a=0;a<arguments.length;a++){this.dayHeaders[a]=arguments[a]}}function CP_setWeekStartDay(a){this.weekStartDay=a}function CP_showYearNavigation(){this.isShowYearNavigation=(arguments.length>0)?arguments[0]:true}function CP_setDisplayType(a){if(a!="date"&&a!="week-end"&&a!="month"&&a!="quarter"&&a!="year"){alert("Invalid display type! Must be one of: date,week-end,month,quarter,year");return false}this.displayType=a}function CP_setYearSelectStartOffset(a){this.yearSelectStartOffset=a}function CP_setDisabledWeekDays(){this.disabledWeekDays=new Object();for(var a=0;a<arguments.length;a++){this.disabledWeekDays[arguments[a]]=true}}function CP_addDisabledDates(b,a){if(arguments.length==1){a=b}if(b==null&&a==null){return}if(this.disabledDatesExpression!=""){this.disabledDatesExpression+="||"}if(b!=null){b=parseDate(b);b=""+b.getFullYear()+LZ(b.getMonth()+1)+LZ(b.getDate())}if(a!=null){a=parseDate(a);a=""+a.getFullYear()+LZ(a.getMonth()+1)+LZ(a.getDate())}if(b==null){this.disabledDatesExpression+="(ds<="+a+")"}else{if(a==null){this.disabledDatesExpression+="(ds>="+b+")"}else{this.disabledDatesExpression+="(ds>="+b+"&&ds<="+a+")"}}}function CP_setTodayText(a){this.todayText=a}function CP_setCssPrefix(a){this.cssPrefix=a}function CP_showNavigationDropdowns(){this.isShowNavigationDropdowns=(arguments.length>0)?arguments[0]:true}function CP_showYearNavigationInput(){this.isShowYearNavigationInput=(arguments.length>0)?arguments[0]:true}function CP_hideCalendar(){if(arguments.length>0){window.popupWindowObjects[arguments[0]].hidePopup()}else{this.hidePopup()}}function CP_refreshCalendar(a){var b=window.popupWindowObjects[a];if(arguments.length>1){b.populate(b.getCalendar(arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]))}else{b.populate(b.getCalendar())}b.refresh()}function CP_showCalendar(a){if(arguments.length>1){if(arguments[1]==null||arguments[1]==""){this.currentDate=new Date()}else{this.currentDate=new Date(parseDate(arguments[1]))}}this.populate(this.getCalendar());this.showPopup(a)}function CP_select(c,a,e){var b=(arguments.length>3)?arguments[3]:null;if(!window.getDateFromFormat){alert("calendar.select: To use this method you must also include 'date.js' for date formatting");return}if(this.displayType!="date"&&this.displayType!="week-end"){alert("calendar.select: This function can only be used with displayType 'date' or 'week-end'");return}if(c.type!="text"&&c.type!="hidden"&&c.type!="textarea"){alert("calendar.select: Input object passed is not a valid form input object");window.CP_targetInput=null;return}if(c.disabled){return}window.CP_targetInput=c;window.CP_calendarObject=this;this.currentDate=null;var d=0;if(b!=null){d=getDateFromFormat(b,e)}else{if(c.value!=""){d=getDateFromFormat(c.value,e)}}if(b!=null||c.value!=""){if(d==0){this.currentDate=null}else{this.currentDate=new Date(d)}}window.CP_dateFormat=e;this.showCalendar(a)}function getCalendarStyles(){var a="";var b="";if(this!=null&&typeof(this.cssPrefix)!="undefined"&&this.cssPrefix!=null&&this.cssPrefix!=""){b=this.cssPrefix}a+="<STYLE>\n";a+="."+b+"cpYearNavigation,."+b+"cpMonthNavigation{background-color:#C0C0C0;text-align:center;vertical-align:center;text-decoration:none;color:#000000;font-weight:bold;}\n";a+="."+b+"cpDayColumnHeader, ."+b+"cpYearNavigation,."+b+"cpMonthNavigation,."+b+"cpCurrentMonthDate,."+b+"cpCurrentMonthDateDisabled,."+b+"cpOtherMonthDate,."+b+"cpOtherMonthDateDisabled,."+b+"cpCurrentDate,."+b+"cpCurrentDateDisabled,."+b+"cpTodayText,."+b+"cpTodayTextDisabled,."+b+"cpText{font-family:Trebuchet MS, Arial, Helvetica, Geneva, Swiss, SunSans-Regular;font-size:8pt;}\n";a+="TD."+b+"cpDayColumnHeader{text-align:right;border:solid thin #C0C0C0;border-width:0px 0px 1px 0px;}\n";a+="."+b+"cpCurrentMonthDate, ."+b+"cpOtherMonthDate, ."+b+"cpCurrentDate{text-align:right;text-decoration:none;}\n";a+="."+b+"cpCurrentMonthDateDisabled, ."+b+"cpOtherMonthDateDisabled, ."+b+"cpCurrentDateDisabled{color:#D0D0D0;text-align:right;text-decoration:line-through;}\n";a+="."+b+"cpCurrentMonthDate, .cpCurrentDate{color:#000000;}\n";a+="."+b+"cpOtherMonthDate{color:#808080;}\n";a+="TD."+b+"cpCurrentDate{color:white;background-color: #C0C0C0;border-width:1px;border:solid thin #800000;}\n";a+="TD."+b+"cpCurrentDateDisabled{border-width:1px;border:solid thin #FFAAAA;}\n";a+="TD."+b+"cpTodayText, TD."+b+"cpTodayTextDisabled{border:solid thin #C0C0C0;border-width:1px 0px 0px 0px;}\n";a+="A."+b+"cpTodayText, SPAN."+b+"cpTodayTextDisabled{height:20px;}\n";a+="A."+b+"cpTodayText{color:black;}\n";a+="."+b+"cpTodayTextDisabled{color:#D0D0D0;}\n";a+="."+b+"cpBorder{border:solid thin #808080;}\n";a+="</STYLE>\n";return a}function CP_getCalendar(){var now=new Date();if(this.type=="WINDOW"){var windowref="window.opener."}else{var windowref=""}var result="";if(this.type=="WINDOW"){result+="<HTML><HEAD><TITLE>Calendar</TITLE>"+this.getStyles()+"</HEAD><BODY MARGINWIDTH=0 MARGINHEIGHT=0 TOPMARGIN=0 RIGHTMARGIN=0 LEFTMARGIN=0>\n";result+="<CENTER><TABLE WIDTH=100% BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>\n"}else{result+='<TABLE CLASS="'+this.cssPrefix+'cpBorder" WIDTH=144 BORDER=1 BORDERWIDTH=1 CELLSPACING=0 CELLPADDING=1>\n';result+="<TR><TD ALIGN=CENTER>\n";result+="<CENTER>\n"}if(this.displayType=="date"||this.displayType=="week-end"){if(this.currentDate==null){this.currentDate=now}if(arguments.length>0){var month=arguments[0]}else{var month=this.currentDate.getMonth()+1}if(arguments.length>1&&arguments[1]>0&&arguments[1]-0==arguments[1]){var year=arguments[1]}else{var year=this.currentDate.getFullYear()}var daysinmonth=new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);if(((year%4==0)&&(year%100!=0))||(year%400==0)){daysinmonth[2]=29}var current_month=new Date(year,month-1,1);var display_year=year;var display_month=month;var display_date=1;var weekday=current_month.getDay();var offset=0;offset=(weekday>=this.weekStartDay)?weekday-this.weekStartDay:7-this.weekStartDay+weekday;if(offset>0){display_month--;if(display_month<1){display_month=12;display_year--}display_date=daysinmonth[display_month]-offset+1}var next_month=month+1;var next_month_year=year;if(next_month>12){next_month=1;next_month_year++}var last_month=month-1;var last_month_year=year;if(last_month<1){last_month=12;last_month_year--}var date_class;if(this.type!="WINDOW"){result+="<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>"}result+="<TR>\n";var refresh=windowref+"CP_refreshCalendar";var refreshLink="javascript:"+refresh;if(this.isShowNavigationDropdowns){result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="78" COLSPAN="3"><select CLASS="'+this.cssPrefix+'cpMonthNavigation" name="cpMonth" onChange="'+refresh+"("+this.index+",this.options[this.selectedIndex].value-0,"+(year-0)+');">';for(var monthCounter=1;monthCounter<=12;monthCounter++){var selected=(monthCounter==month)?"SELECTED":"";result+='<option value="'+monthCounter+'" '+selected+">"+this.monthNames[monthCounter-1]+"</option>"}result+="</select></TD>";result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10">&nbsp;</TD>';result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="56" COLSPAN="3"><select CLASS="'+this.cssPrefix+'cpYearNavigation" name="cpYear" onChange="'+refresh+"("+this.index+","+month+',this.options[this.selectedIndex].value-0);">';for(var yearCounter=year-this.yearSelectStartOffset;yearCounter<=year+this.yearSelectStartOffset;yearCounter++){var selected=(yearCounter==year)?"SELECTED":"";result+='<option value="'+yearCounter+'" '+selected+">"+yearCounter+"</option>"}result+="</select></TD>"}else{if(this.isShowYearNavigation){result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+"("+this.index+","+last_month+","+last_month_year+');">&lt;</A></TD>';result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="58"><SPAN CLASS="'+this.cssPrefix+'cpMonthNavigation">'+this.monthNames[month-1]+"</SPAN></TD>";result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+"("+this.index+","+next_month+","+next_month_year+');">&gt;</A></TD>';result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="10">&nbsp;</TD>';result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="'+refreshLink+"("+this.index+","+month+","+(year-1)+');">&lt;</A></TD>';if(this.isShowYearNavigationInput){result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="36"><INPUT NAME="cpYear" CLASS="'+this.cssPrefix+'cpYearNavigation" SIZE="4" MAXLENGTH="4" VALUE="'+year+'" onBlur="'+refresh+"("+this.index+","+month+',this.value-0);"></TD>'}else{result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="36"><SPAN CLASS="'+this.cssPrefix+'cpYearNavigation">'+year+"</SPAN></TD>"}result+='<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="10"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="'+refreshLink+"("+this.index+","+month+","+(year+1)+');">&gt;</A></TD>'}else{result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+"("+this.index+","+last_month+","+last_month_year+');">&lt;&lt;</A></TD>\n';result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="100"><SPAN CLASS="'+this.cssPrefix+'cpMonthNavigation">'+this.monthNames[month-1]+" "+year+"</SPAN></TD>\n";result+='<TD CLASS="'+this.cssPrefix+'cpMonthNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpMonthNavigation" HREF="'+refreshLink+"("+this.index+","+next_month+","+next_month_year+');">&gt;&gt;</A></TD>\n'}}result+="</TR></TABLE>\n";result+="<TABLE WIDTH=120 BORDER=0 CELLSPACING=0 CELLPADDING=1 ALIGN=CENTER>\n";result+="<TR>\n";for(var j=0;j<7;j++){result+='<TD CLASS="'+this.cssPrefix+'cpDayColumnHeader" WIDTH="14%"><SPAN CLASS="'+this.cssPrefix+'cpDayColumnHeader">'+this.dayHeaders[(this.weekStartDay+j)%7]+"</TD>\n"}result+="</TR>\n";for(var row=1;row<=6;row++){result+="<TR>\n";for(var col=1;col<=7;col++){var disabled=false;if(this.disabledDatesExpression!=""){var ds=""+display_year+LZ(display_month)+LZ(display_date);eval("disabled=("+this.disabledDatesExpression+")")}var dateClass="";if((display_month==this.currentDate.getMonth()+1)&&(display_date==this.currentDate.getDate())&&(display_year==this.currentDate.getFullYear())){dateClass="cpCurrentDate"}else{if(display_month==month){dateClass="cpCurrentMonthDate"}else{dateClass="cpOtherMonthDate"}}if(disabled||this.disabledWeekDays[col-1]){result+='	<TD CLASS="'+this.cssPrefix+dateClass+'"><SPAN CLASS="'+this.cssPrefix+dateClass+'Disabled">'+display_date+"</SPAN></TD>\n"}else{var selected_date=display_date;var selected_month=display_month;var selected_year=display_year;if(this.displayType=="week-end"){var d=new Date(selected_year,selected_month-1,selected_date,0,0,0,0);d.setDate(d.getDate()+(7-col));selected_year=d.getYear();if(selected_year<1000){selected_year+=1900}selected_month=d.getMonth()+1;selected_date=d.getDate()}result+='	<TD CLASS="'+this.cssPrefix+dateClass+'"><A HREF="javascript:'+windowref+this.returnFunction+"("+selected_year+","+selected_month+","+selected_date+");"+windowref+"CP_hideCalendar('"+this.index+'\');" CLASS="'+this.cssPrefix+dateClass+'">'+display_date+"</A></TD>\n"}display_date++;if(display_date>daysinmonth[display_month]){display_date=1;display_month++}if(display_month>12){display_month=1;display_year++}}result+="</TR>"}var current_weekday=now.getDay()-this.weekStartDay;if(current_weekday<0){current_weekday+=7}result+="<TR>\n";result+='	<TD COLSPAN=7 ALIGN=CENTER CLASS="'+this.cssPrefix+'cpTodayText">\n';if(this.disabledDatesExpression!=""){var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate());eval("disabled=("+this.disabledDatesExpression+")")}if(disabled||this.disabledWeekDays[current_weekday+1]){result+='		<SPAN CLASS="'+this.cssPrefix+'cpTodayTextDisabled">'+this.todayText+"</SPAN>\n"}else{result+='		<A CLASS="'+this.cssPrefix+'cpTodayText" HREF="javascript:'+windowref+this.returnFunction+"('"+now.getFullYear()+"','"+(now.getMonth()+1)+"','"+now.getDate()+"');"+windowref+"CP_hideCalendar('"+this.index+"');\">"+this.todayText+"</A>\n"}result+="		<BR>\n";result+="	</TD></TR></TABLE></CENTER></TD></TR></TABLE>\n"}if(this.displayType=="month"||this.displayType=="quarter"||this.displayType=="year"){if(arguments.length>0){var year=arguments[0]}else{if(this.displayType=="year"){var year=now.getFullYear()-this.yearSelectStartOffset}else{var year=now.getFullYear()}}if(this.displayType!="year"&&this.isShowYearNavigation){result+="<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";result+="<TR>\n";result+='	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+"CP_refreshCalendar("+this.index+","+(year-1)+');">&lt;&lt;</A></TD>\n';result+='	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="100">'+year+"</TD>\n";result+='	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="22"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+"CP_refreshCalendar("+this.index+","+(year+1)+');">&gt;&gt;</A></TD>\n';result+="</TR></TABLE>\n"}}if(this.displayType=="month"){result+="<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n";for(var i=0;i<4;i++){result+="<TR>";for(var j=0;j<3;j++){var monthindex=((i*3)+j);result+='<TD WIDTH=33% ALIGN=CENTER><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnMonthFunction+"("+year+","+(monthindex+1)+");"+windowref+"CP_hideCalendar('"+this.index+'\');" CLASS="'+date_class+'">'+this.monthAbbreviations[monthindex]+"</A></TD>"}result+="</TR>"}result+="</TABLE></CENTER></TD></TR></TABLE>\n"}if(this.displayType=="quarter"){result+="<BR><TABLE WIDTH=120 BORDER=1 CELLSPACING=0 CELLPADDING=0 ALIGN=CENTER>\n";for(var i=0;i<2;i++){result+="<TR>";for(var j=0;j<2;j++){var quarter=((i*2)+j+1);result+='<TD WIDTH=50% ALIGN=CENTER><BR><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnQuarterFunction+"("+year+","+quarter+");"+windowref+"CP_hideCalendar('"+this.index+'\');" CLASS="'+date_class+'">Q'+quarter+"</A><BR><BR></TD>"}result+="</TR>"}result+="</TABLE></CENTER></TD></TR></TABLE>\n"}if(this.displayType=="year"){var yearColumnSize=4;result+="<TABLE WIDTH=144 BORDER=0 BORDERWIDTH=0 CELLSPACING=0 CELLPADDING=0>";result+="<TR>\n";result+='	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="50%"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+"CP_refreshCalendar("+this.index+","+(year-(yearColumnSize*2))+');">&lt;&lt;</A></TD>\n';result+='	<TD CLASS="'+this.cssPrefix+'cpYearNavigation" WIDTH="50%"><A CLASS="'+this.cssPrefix+'cpYearNavigation" HREF="javascript:'+windowref+"CP_refreshCalendar("+this.index+","+(year+(yearColumnSize*2))+');">&gt;&gt;</A></TD>\n';result+="</TR></TABLE>\n";result+="<TABLE WIDTH=120 BORDER=0 CELLSPACING=1 CELLPADDING=0 ALIGN=CENTER>\n";for(var i=0;i<yearColumnSize;i++){for(var j=0;j<2;j++){var currentyear=year+(j*yearColumnSize)+i;result+='<TD WIDTH=50% ALIGN=CENTER><A CLASS="'+this.cssPrefix+'cpText" HREF="javascript:'+windowref+this.returnYearFunction+"("+currentyear+");"+windowref+"CP_hideCalendar('"+this.index+'\');" CLASS="'+date_class+'">'+currentyear+"</A></TD>"}result+="</TR>"}result+="</TABLE></CENTER></TD></TR></TABLE>\n"}if(this.type=="WINDOW"){result+="</BODY></HTML>\n"}return result}function OpenCal(b,e,d,f){var c=new CalendarPopup(d,b);var a=document.getElementById(e);c.setReturnFunction(f);c.setUrl("");c.setWindowProperties("toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0");c.select(a,e,"dd/MM/yyyy")}function SetValueYMD_dal(h,b,f){var e;var g;var c;e=h;if(b.toString().length==1){g="0"+b}else{g=b}if(f.toString().length==1){c="0"+f}else{c=f}var a=document.getElementById("ecmsb_arrivo");a.value=c+"/"+g+"/"+e}function SetValueYMD_al(h,b,f){var e;var g;var c;e=h;if(b.toString().length==1){g="0"+b}else{g=b}if(f.toString().length==1){c="0"+f}else{c=f}var a=document.getElementById("ecmsb_partenza");a.value=c+"/"+g+"/"+e}function ecmsb_GetInfoByMail(c){var b=null;if(document.getElementById("nome").value==""){b="Manca il nome."}if(document.getElementById("cognome").value==""){b="Manca il cognome."}if(document.getElementById("email").value==""){b="Manca l'indirizzo e-mail."}if(document.getElementById("trattamento").value==""){b="Non è stato selezionato il tipo di trattamento desiderato.."}if(b!=null){alert(b);return}ecmsb_wait(true);var a="";a+="    <request>";a+='        <Riferimento ID="A91AE52612D5F4FFC3"/>';a+='        <Struttura ID="'+c+'"/>';a+="        <nome><![CDATA["+v("nome")+"]]></nome>";a+="        <cognome><![CDATA["+document.getElementById("cognome").value+"]]></cognome>";a+="        <indirizzo><![CDATA["+document.getElementById("indirizzo").value+"]]></indirizzo>";a+="        <cap><![CDATA["+document.getElementById("cap").value+"]]></cap>";a+="        <citta><![CDATA["+document.getElementById("citta").value+"]]></citta>";a+="        <nazione><![CDATA["+document.getElementById("nazione").value+"]]></nazione>";a+="        <tel><![CDATA["+document.getElementById("tel").value+"]]></tel>";a+="        <fax><![CDATA["+document.getElementById("fax").value+"]]></fax>";a+="        <email><![CDATA["+document.getElementById("email").value+"]]></email>";a+="        <arrivo><![CDATA["+document.getElementById("arrivo").value+"]]></arrivo>";a+="        <partenza><![CDATA["+document.getElementById("partenza").value+"]]></partenza>";a+="        <adulti><![CDATA["+document.getElementById("adulti").value+"]]></adulti>";a+="        <bambini><![CDATA["+document.getElementById("bambini").value+"]]></bambini>";a+="        <trattamento><![CDATA["+document.getElementById("trattamento").value+"]]></trattamento>";a+="        <s1><![CDATA["+document.getElementById("s1").value+"]]></s1>";a+="        <s2><![CDATA["+document.getElementById("s2").value+"]]></s2>";a+="        <s3><![CDATA["+document.getElementById("s3").value+"]]></s3>";a+="        <s4><![CDATA["+document.getElementById("s4").value+"]]></s4>";a+="        <s5><![CDATA["+document.getElementById("s5").value+"]]></s5>";a+="        <s6><![CDATA["+document.getElementById("s6").value+"]]></s6>";a+="        <infotext><![CDATA["+document.getElementById("infotext").value+"]]></infotext>";a+="    </request>";fcn("requestinfo",a)}jsw_LoadEvent(function(){ecmsb_loadconfig()});document.write(getCalendarStyles());