function onEnterSubmit(a,b) {
e = a.keyCode;if ( e == 13 ) {a.returnValue=false;gj(b).click();}}
function printPage() {window.print();}
function fO(n, d) {
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=fO(n,d.layers[i].document); return x;}
function listItem(n, v, s, i) {
this.name=n;this.value=v;this.selected=s;this.inheritors=i;}
function listHierarchy() {
var a=listHierarchy.arguments;this.elements = a[0];
if (!this.elements[0].name) iA(this.elements);
this.lL = Array(a.length-1);
for (i=1; i< a.length; i++) {this.lL[i-1] = fO(a[i]);}
this.init = l1_init;this.lo = l1_lo;this.listSelectionChanged = l1_lC;this.init();}
function l1_init(){this.lo(0, this.elements);}
function l1_lo(l, e) {
var i=0, list;if (list=this.lL[l]) {
for (i = list.length; i > 0; i-- ) 
list.options[i]=null;
if (e) {
for (i=0; i<e.length; i++ ) {
list.options[i] = new Option(e[i].name, e[i].value, 0, e[i].selected);
e[i].selected = false;}}
this.listSelectionChanged(list);}}
function l1_lC(s) {
var i, l, e;if (s) {e = this.elements;
for (l=0; (l < this.lL.length) && (this.lL[l] != s);l++){
i = this.lL[l].selectedIndex;e = e[i].inheritors;}
if (l < this.lL.length) {i = s.selectedIndex;
if (e) {this.lo(l+1,e[i].inheritors);}}}}

all = new Array();mx = 1;
function AI(s, d, r) {
var k, j;if (!d) {
d = new Array();d[0] = new listItem('                        ','', 0);}
for (k=r; k<s.length; k++) {
f = false;for (j=0; j<d.length; j++)
if (s[k].value == d[j].value) {f=true;break;}
if (!flag) d.push(s[k]);}return d;}
function PL(l, e) {
var i;var c=e.inheritors;
for (i=0; i<c.length; i++) {all[l].push(c[i]);
if (c[i].inheritors) {if (mx<(l+1)) {all[l+1]=new Array();mx++;}
PL(l+1, c[i]);c[0].inheritors = AI(c[i].inheritors, c[0].inheritors, 1);}}}
function iA(d) {
var i,j,s;all[1] = new Array();
for (i=1; i<d.length; i++) {PL(1, d[i]);}
c=d[0];for (j=1; j<= mx; j++) {
c.inheritors = AI(all[j], c.inheritors, 0);c=c.inheritors[0];}}
function colazioneDetail(l) {
url="/servlet/nonAuth?action_var=hotelColazioneLegendaList&nonAuthUserLang="+l;
window.open(url,"LegendaColazione", "width=380, height=320, toolbar=yes, resizable=yes, scrollbars=yes");}
function condizioneCheck(cform, condizione, message) {if (condizione[0].checked == true){cform.submit();} else {alert(message);} }
function popupMessage(l, m){
url="/servlet/nonAuth?action_var=popupMessagePage&nonAuthUserLang="+l+"&nonAuthMessagePopup="+m;
window.open(url,"pp", "width=400, height=200, toolbar=no, resizable=yes, scrollbars=yes");}
function popupDirectMessage(l, m,gif) {
url="/servlet/nonAuth?action_var=popupDirectMessagePage&nonAuthUserLang="+l+"&nonAuthMessagePopup="+m+"&nonAuthMessagePo;pupGif="+gif;window.open(url,"pp", "width=400, height=200, toolbar=no, resizable=yes, scrollbars=yes");}
//function startchat(m) {
//var winl = (screen.width-472)/2;var wint = (screen.height-320)/2;
//var settings = 'height=320,width=472,top='+wint+',left='+winl+',scrollbars=no,resizable=no';
//toopen=window.open(m,'phplivehelper',settings);if (parseInt(navigator.appVersion) >= 4) {
//toopen.window.focus();}}
function pulsantiTopSubmit(a) {
document.TOPFORM.action_var.value=a;document.TOPFORM.submit();}
function checkMatrUnique(d, o) {
if (d.value==2 && o!=2){document.FHOTEL.submit();}
if (d.value!=2 && o==2){document.FHOTEL.submit();}}
function onfchk(c) {
if (document.NWLTFORM.nwl_email.value==c) document.NWLTFORM.nwl_email.value="";}
function onbchk(c) {
if ( (document.NWLTFORM.nwl_email.value==c) || (document.NWLTFORM.nwl_email.value=='') ) 
document.NWLTFORM.nwl_email.value=c;}
function cartDetail(u) {
crtopn=window.open(u,"LW", "height=250,width=250,status=no,toolbar=no,directories=no,menubar=no,location=no,resizable=no");
if (crtopn.focus()) crtopn.focus();}
function wopen(u, n, p) {window.open(u, n, p);}



function gj(o) {
if (document.getElementById) {return document.getElementById(o);}
else if (document.all) {return document.all[o];}
else if (document.layers) {return document.layers[o];}}


function offerteDetail(ct1,sr1,rs1,fr1,dt1,dt2,tx1) {url="/servlet/Main?action_var=hotelOfferteLegenda&catalogo="+ct1+"&servizio="+sr1+"&risorsa="+rs1+"&fornitore="+fr1+"&dataIn="+dt1+"&dataOut="+dt2+"&txt_special="+tx1;window.open(url,"SpecialOffer","width=580,height=250,resizable=yes,scrollbars=yes");return;}

function formsSubmit(a, t) 
	{
	t.action_var.value=a;
	t.submit();
	}

function cancelLink () {return false;}
function disableLink (link, msg) 
	{
	if (link.onclick) link.oldOnClick=link.onclick;
	link.onclick=cancelLink;
	if (link.style) link.style.cursor='default';
	if ((link.innerText) && !(msg == "" || msg == null || isNaN(msg))) link.innerText=msg;
	}

function enableLink (link) {link.onclick=link.oldOnClick?link.oldOnClick:null;if (link.style) link.style.cursor=document.all?'hand':'pointer';}
function toggleLink (link,msg) 
	{
	disableLink(link,msg);
	link.disabled=!link.disabled;
	}

function checkType(param_check) {if (param_check.checked==true ) param_check.checked=false;}

var BackDark,BestButt,BackButt,BackOn,BestButtOn,BackButtOn ;

function init_color() 
	{
	BackDark=findStyleRule('TD.BackDark').style;
	BestButt=findStyleRule('TD.BestButt').style;
	BackButt=findStyleRule('TD.BackButt').style;
	BackOn  =findStyleRule('TD.BackOn').style;
	BestButtOn=findStyleRule('TD.BestButtOn').style;
	BackButtOn=findStyleRule('TD.BackButtOn').style;
	}


function findStyleRule(styleName) 
	{
	for (i = 0; i < document.styleSheets.length; i++) 
		{
		if (document.styleSheets[i].rules != null)
			{
			for (j = 0; j < document.styleSheets[i].rules.length; j++) 
				{
				if (document.styleSheets[i].rules[j].selectorText.toLowerCase() == styleName.toLowerCase()) 
					return document.styleSheets[i].rules[j];
				}    
			}
		else if(document.styleSheets[i].cssRules != null)
			{
			for (j = 0; j < document.styleSheets[i].cssRules.length; j++) 
				{
				if (document.styleSheets[i].cssRules[j].selectorText.toLowerCase() == styleName.toLowerCase()) 
					{
					return document.styleSheets[i].cssRules[j];
					}
				}    
			}



		}
	}

function getColor(obj, c1,c2,c3) 
	{
	if (!document.styleSheets) return;
	id = obj.id;
	// Pulsante selezionato
	if (document.layers) {
			     document.layers[id].bgImage = c1.backgroundColor;
			     document.layers[id].cursor='pointer';
			     }
	else if (document.all) {
			       document.all[id].style.cursor=document.all?'hand':'pointer';
			       if (c1.backgroundImage=='') document.all[id].style.background = c1.backgroundColor;
			       else document.all[id].style.backgroundImage = c1.backgroundImage;

			       document.all[id].style.textDecoration = c1.textDecoration;
			       document.all[id].style.fontSize = c1.fontSize;
			       }	
        else {
	el = document.getElementById(id);

	elStyle="background-image: "+c1.backgroundImage+";"+"font-size: "+c1.fontSize+";"+"text-decoration: "+c1.textDecoration+";";
	elStyle+="cursor: pointer;";
	el.setAttribute("style", elStyle);
	}

	// Andata
	if (document.layers)      document.layers[id.substring(0,4)].bgColor = c2.backgroundColor;
	else 
		if (document.all) document.all[id.substring(0,4)].style.background = c2.backgroundColor;
	else {
	el = document.getElementById(id.substring(0,4));
	el.setAttribute("style", "background-color:"+c2.backgroundColor+";");
	}
			    

	// Ritorno
	if (document.layers)      document.layers[id.substring(0,2)+id.substring(4,6)].bgColor = c3.backgroundColor;
	else 
		if (document.all) document.all[id.substring(0,2)+id.substring(4,6)].style.background = c3.backgroundColor;
	else {
	el = document.getElementById(id.substring(0,2)+id.substring(4,6));
	el.setAttribute("style", "background-color:"+c3.backgroundColor+";");
	}
	}


function checkVol(d1) 
{
//alert(this.document.FHOTEL.fl_solo_volo.value);
if (d1[0].checked == true) 
{ 
gj('step3vh').style.display="block"; 
gj('step3sv').style.display="none"; 
gj('camvh').style.display="block"; 
gj('camsv').style.display="none"; 
} 
else
{ 
gj('step3vh').style.display="none";
gj('step3sv').style.display="block";
gj('camvh').style.display="none"; 
gj('camsv').style.display="block"; 
} 
}

var showLogin=false;
var showAssic=false;

function toggleBox(szDivID, iState, focusTo) // 1 visible, 0 hidden
{
   var obj = document.layers ? document.layers[szDivID] :
   document.getElementById ?  document.getElementById(szDivID).style :
   document.all[szDivID].style;
   obj.visibility = document.layers ? (iState ? "show" : "hide") :
   (iState ? "visible" : "hidden");

   if (focusTo) focusTo.focus();
}


function onEnterLogin(a, formSub, action)
{var eventKeycode;if( typeof( a.which ) == 'number' ) {eventKeycode = a.which;} 
else if( typeof( a.keyCode ) == 'number'  ) {eventKeycode = a.keyCode;} 
else if( typeof( a.charCode ) == 'number'  ) {eventKeycode = a.charCode;} 
else {return;}if ( eventKeycode != 13 ) return;
a.returnValue=false;formSub.action_var.value=action;formSub.submit();}



function cfpivachk(cf){
var cod=cf.value.toLowerCase();var check=true;
if ((cod.length!=16) && (cod.length!=11)) return false;
if (cod.length==16) {ltt=cod.substr(0,6)+cod.substr(8,1)+cod.substr(11,1)+cod.substr(15);nmr=cod.substr(6,2)+cod.substr(9,2)+cod.substr(12,3);
for (i=0;i<10;i++) if (ltt.charCodeAt(i)<97 || ltt.charCodeAt(i)>122) check=false;for (i=0;i<8;i++) if (nmr.charCodeAt(i)<48 || nmr.charCodeAt(i)>57) check=false;}
else for (i=0;i<10;i++) if (cod.charCodeAt(i)<48 || cod.charCodeAt(i)>57) check=false; return check;}


var trhov=0;
var sxhov=0;
var mOvrClass='';
var sxClass='';
function mOvr(src,clrOver) {
 if (!trhov) return;
 if (clrOver == "" || clrOver == null || isNaN(clrOver)) {var clrOver='mOvrDL'};
 mOvrClass = src.className;
 src.className = mOvrClass + ' ' + clrOver;
 if (!sxhov) return;
 var y=src.cells[0];
 sxClass= y.className;
 y.className = sxClass+'Ov';
}

function mOut(src) {
 if (!trhov) return;
 src.className=mOvrClass;
 if (!sxhov) return;
 var y=src.cells[0];
 y.className = sxClass;
}


function cngBG(id, url) {
var ob=gj(id);
if ((ob) && (ob.style)) {
gj('drpgbg').style.backgroundImage="url("+url+")";
gj('drpgbg').style.backgroundRepeat="no-repeat";
}}

function getOrder(obj) {
return (obj.options[obj.selectedIndex].value!='' );
}


var mN;var dN;var dFN;var fx=-1;var fy=-1;var sA=1;var sT=0;
var imgDir="img/";var ixm;var axm;var nDS;var scM;var cO=0;
var CMO,CYO,mSd,ySd,dSd,omSd,oySd,odSd,mC,yC,v1,t1,cTP,Ft;
var bpl=false;var ie=document.all;var dom=document.getElementById;var ns4=document.layers;
var today=new Date();var dW=today.getDate();var mW=today.getMonth();var yW=today.getFullYear();
var ccn=false;var sMd=false;var mnD=new Date();var o1d=new Date();var o2=new Date();
var bw=false;var thisForm=document.forms[0];
var iconSpanIndex=-1;var lbl_close='Close';

function gj(o) {
if (document.getElementById) {return document.getElementById(o);}
else if (document.all) {return document.all[o];}
else if (document.layers) {return document.layers[o];}}
function hE(eID,oD) {
if(ie) {
for(i=0;i<document.all.tags(eID).length;i++) 
{o=document.all.tags(eID)[i];if(!o||!o.offsetParent) {continue;}
oL=o.offsetLeft;oT=o.offsetTop;oP=o.offsetParent;
while(oP.tagName.toUpperCase()!="BODY") {
oL+=oP.offsetLeft;oT+=oP.offsetTop;oP=oP.offsetParent;} 
oH=o.offsetHeight;oW=o.offsetWidth;
if((oD.offsetLeft+oD.offsetWidth)<=oL);
else if((oD.offsetTop+oD.offsetHeight)<=oT); 
else if(oD.offsetTop>=(oT+oH)); 
else if(oD.offsetLeft>=(oL+oW)); 
else {o.style.visibility="hidden";}}}}
function wE(eID) {
if(ie){for(i=0;i<document.all.tags(eID).length;i++){ 
o=document.all.tags(eID)[i]; 
if(!o || !o.offsetParent) {continue;}
o.style.visibility="";}}}
function createCalendar(labelClose) {
if(labelClose!=undefined && labelClose!='')
{lbl_close=labelClose;}
document.write ("<div visibility='hidden' style='z-index:999' onclick='bw=true' id='clnd' class='div-style'><table width="+((0==1)?150:120)+" class='table-style'><tr class='title-background-style' ><td><table align='center' width='100%' border=0 class='table1' width='"+((0==1)?150:120)+"'><tr><td class='title-style'><STRONG><span id='caption'><\/span><\/STRONG><\/td><\/tr><\/table><\/td><\/tr><tr><td class='body-style'><span id='content'><\/span><\/td><\/tr><tr class='title-background-style'><td align=center class='close-style'><strong><a href='javascript:h0();' style='color:#fff;text-decoration:none;'>"+lbl_close+"<\/a></strong><\/td></tr>") 
if (sT==1) {document.write ("<tr class='today-style'><td><span id='lblToday'><\/span><\/td><\/tr>")} 
document.write ("<\/table><\/div><div id='selectMonth' class='div-style'><\/div><div id='SY' class='div-style'><\/div>");} 
function s0(s,d) {if (ie) {gj(s).setAttribute("src",imgDir+d)}}
function init(sLM,sRM) {
if (!ns4) {cO=(dom)?gj("clnd").style:ie?document.all.clnd:document.clnd;
h0();CMO=(dom)?gj("selectMonth").style:ie?document.all.selectMonth:document.selectMonth;
CYO=(dom)?gj("SY").style:ie?document.all.SY:document.SY;mC=false;yC=false;
s="<span id='spanLeft' class='title-control-normal-style' style='cursor:hand;' onclick='javascript:dM()' onmouseup='clearTimeout(t1);clearInterval(v1)'><IMG id='changeLeft' SRC='"+imgDir+"calendar_left.gif' BORDER=0><\/span>";
s+="<span id='spanMonth' class='title-month-normal-style'><\/span>&nbsp;";
s+="<span id='spanYear' class='title-control-normal-style'><\/span>&nbsp;";
s+="<span id='spanRight' class='title-control-normal-style' style='cursor:hand;' onclick='iM()' onmouseup='clearTimeout(t1);clearInterval(v1)'><IMG id='changeRight' SRC='"+imgDir+"calendar_right.gif' BORDER=0><\/span>";
gj("caption").innerHTML=s;bpl=true;}}
function h0() {
cO.visibility="hidden";
if (CMO != null){CMO.visibility="hidden"}
if (CYO != null){CYO.visibility="hidden"}
wE('SELECT');wE('APPLET');}
function p0(num) {return(num<10)?'0'+num:num;}
function CD1(d,m,y) {
var s=Ft;s=s.replace ("dd","<e>");s=s.replace ("d","<d>");
s=s.replace ("<e>",p0(d));s=s.replace ("<d>",d);s=s.replace ("mmm","<o>");
s=s.replace ("mm","<n>");s=s.replace ("m","<m>");s=s.replace ("<m>",m+1);
s=s.replace ("<n>",p0(m+1));s=s.replace ("<o>",mN[m]);return s.replace ("yyyy",y);}
function cC() {
    h0();cTP.value=CD1(dSd,mSd,ySd);
    var i='';
    if (iconSpanIndex>=0) i='_'+iconSpanIndex;
    if (sMd) {
        dP=new Date((mSd+1)+"/"+dSd+"/"+ySd);
        gj("chkday_in"+i).innerHTML=dFN[(dP.getDay()-sA==-1)?6:(dP.getDay()-sA)]+"&nbsp;"+dSd+"&nbsp;"+mN[mSd]+"&nbsp;"+ySd;return;}
    if (ccn) {
        dP=new Date((mSd+1)+"/"+dSd+"/"+ySd);
        var combo_val=Math.floor(((dP.getTime()+10800000-o1d.getTime())/(1000*60*60*24)));
        var prec_combo_val=gj('COMBO_GIORNI').value;
        gj('COMBO_GIORNI').value=combo_val;
        if (gj('COMBO_GIORNI').value!=combo_val){
            gj('COMBO_GIORNI').value=combo_val-1;
        } //pezza per explorer su mac
        if(isNaN(parseInt(gj('COMBO_GIORNI').value))){
            gj('COMBO_GIORNI').value=prec_combo_val;
        } //pezza per explorer
        gj("chkday_out"+i).innerHTML=dFN[(dP.getDay()-sA==-1)?6:(dP.getDay()-sA)]+"&nbsp;"+dSd+"&nbsp;"+mN[mSd]+"&nbsp;"+ySd;
    } else {
        dP=new Date((mSd+1)+"/"+dSd+"/"+ySd);
        gj("chkday_in"+i).innerHTML=dFN[(dP.getDay()-sA==-1)?6:(dP.getDay()-sA)]+"&nbsp;"+dSd+"&nbsp;"+mN[mSd]+"&nbsp;"+ySd;
        t=dP.getTime()+(86400000*parseInt(gj('COMBO_GIORNI').value))+10800000;dP=new Date(t);
        thisForm.combo_finemm_aa.value=CD1(dP.getDate(),dP.getMonth(),dP.getFullYear());
        gj("chkday_out"+i).innerHTML=dFN[(dP.getDay()-sA==-1)?6:(dP.getDay()-sA)]+"&nbsp;"+dP.getDate()+"&nbsp;"+mN[dP.getMonth()]+"&nbsp;"+dP.getFullYear();
    }
}
function SDM() {v1=setInterval("dM()",80)}
function SIM() {v1=setInterval("iM()",80)}
function iM() {if (isM()) {mSd++;if (mSd>11){mSd=0;ySd++;}bC();}else alert(axm);}
function dM() {if (isMi()) {mSd--;if (mSd<0){mSd=11;ySd--;}bC();}else alert(ixm);}
function isMi() {x=new Date((mSd+1)+"/01/"+ySd);return (mnD<x);} 
function isM() {x=new Date((mSd+1)+"/01/"+ySd);m=new Date((mnD.getMonth()+1)+"/01/"+(mnD.getFullYear()+1));return (x<m);}
function bC() {
var m1;var s1=new Date (ySd,mSd,1);var e1=new Date(ySd,mSd+1,1);
e1=new Date(e1-(24*60*60*1000));m2=e1.getDate();d1=0;d2=s1.getDay()-sA;
if (d2<0) {d2=6;}
s="<table border=0 cellpadding='1' cellspacing='0' class='body-style'><tr>";
for (i=0; i<7; i++) {s+="<td class='title-name-day' align='right'>"+dN[i]+"<\/td>";}
s+="<\/tr><tr>";
for (var i=1;i<=d2;i++ ) {s+="<td>&nbsp;<\/td>";}
for (d1=1;d1<=m2;d1++) {
d2++;s+="<td align=right>";var sS="normal-day-style";var p=true;
if ((d1==dW)&&(mSd==mW)&&(ySd==yW)) {sS="current-day-style";}
else if (d2%7==(sA*-1)+1) {sS="end-of-weekday-style";}
if ((d1==odSd)&&(mSd==omSd)&&(ySd==oySd)) {sS+=" selected-day-style";}
sD=new Date((mSd+1)+"/"+d1+"/"+ySd);
if (mnD>sD) {sS+=" not-selected-day-style";p=false;}
if (sD>o2) {sS+=" not-selected-day-style";p=false;}
h="";var g=/\"/g;h=h.replace(g,"&quot;");
m1="onmousemove='window.status=\""+scM.replace("[date]",CD1(d1,mSd,ySd))+"\"' onmouseout='window.status=\"\"' ";
if (p) s+="<a class='"+sS+"' "+m1+" title=\""+h+"\" href='javascript:dSd="+d1+";cC();'>&nbsp;"+d1+"&nbsp;<\/a>";
else s+="<a class='"+sS+"' "+m1+" title=\""+nDS+"\" >&nbsp;"+d1+"&nbsp;<\/a>";
s+="";if ((d2+sA)%7==sA) {s+="<\/tr><tr>";}}
gj("content").innerHTML=s;
gj("spanMonth").innerHTML="&nbsp;"+mN[mSd]+"&nbsp;";
gj("spanYear").innerHTML="&nbsp;"+ySd+"&nbsp;";}
function sTD(d3) {
fC="/";aF=Ft.split(fC);aD=d3.split(fC);Tk=0;
for (i=0;i<3;i++) {
if ((aF[i]=="d") || (aF[i]=="dd")) {dSd=parseInt(aD[i], 10);Tk++;}
else if ((aF[i]=="m")||(aF[i]=="mm")) {mSd=parseInt(aD[i],10);Tk++;} 
else if (aF[i]=="yyyy") {ySd=parseInt(aD[i],10);Tk++;}}
if ((Tk!=3)||isNaN(dSd)||isNaN(mSd)||isNaN(ySd))
return (NaN);return(new Date(mSd+"/"+dSd+"/"+ySd));} 
/*
function init_combo_day(th,f4, dFNe, mNe) {
Ft=f4;dFN=dFNe;mN=mNe;tp=th.COMBO_INIZIOMM_AA.value;d5=sTD(tp);
gj("chkday_in").innerHTML=dFN[(d5.getDay()-sA==-1)?6:(d5.getDay()-sA)]+"&nbsp;"+d5.getDate()+"&nbsp;"+mN[d5.getMonth()]+"&nbsp;"+d5.getFullYear();
tp=th.combo_finemm_aa.value;d5=sTD(tp);
gj("chkday_out").innerHTML=dFN[(d5.getDay()-sA==-1)?6:(d5.getDay()-sA)]+"&nbsp;"+d5.getDate()+"&nbsp;"+mN[d5.getMonth()]+"&nbsp;"+d5.getFullYear();}
*/
function init_combo_day(th,f4, dFNe, mNe,idx)
{
	var i='';
	if (typeof idx != 'undefined') i='_'+idx;		
	Ft=f4;dFN=dFNe.split(',');mN=mNe.split(',');tp=th.COMBO_INIZIOMM_AA.value;d5=sTD(tp);
	gj("chkday_in"+i).innerHTML=dFN[(d5.getDay()-sA==-1)?6:(d5.getDay()-sA)]+"&nbsp;"+d5.getDate()+"&nbsp;"+mN[d5.getMonth()]+"&nbsp;"+d5.getFullYear();
	tp=th.combo_finemm_aa.value;d5=sTD(tp);
	gj("chkday_out"+i).innerHTML=dFN[(d5.getDay()-sA==-1)?6:(d5.getDay()-sA)]+"&nbsp;"+d5.getDate()+"&nbsp;"+mN[d5.getMonth()]+"&nbsp;"+d5.getFullYear();
}
/*
function change_combo_day(th, f4) {
Ft=f4;tp=th.COMBO_INIZIOMM_AA.value;nday=th.COMBO_GIORNI.value;d5= sTD(tp);
tp=d5.getTime()+(86400000*parseInt(th.COMBO_GIORNI.value))+10800000;d5=new Date(tp);
th.combo_finemm_aa.value=CD1(d5.getDate(),d5.getMonth(),d5.getFullYear());
gj("chkday_out").innerHTML=dFN[(d5.getDay()-sA==-1)?6:(d5.getDay()-sA)]+"&nbsp;"+d5.getDate()+"&nbsp;"+mN[d5.getMonth()]+"&nbsp;"+d5.getFullYear();}
*/
function change_combo_day(th, f4,idx)
{
	var i='';
	if (typeof idx != 'undefined') i='_'+idx;	
	Ft=f4;
	tp=th.COMBO_INIZIOMM_AA.value;
	nday=th.COMBO_GIORNI.value;
	d5= sTD(tp);
	tp=d5.getTime()+(86400000*parseInt(th.COMBO_GIORNI.value))+10800000;d5=new Date(tp);
	th.combo_finemm_aa.value=CD1(d5.getDate(),d5.getMonth(),d5.getFullYear());
  gj("chkday_out"+i).innerHTML=dFN[(d5.getDay()-sA==-1)?6:(d5.getDay()-sA)]+"&nbsp;"+d5.getDate()+"&nbsp;"+mN[d5.getMonth()]+"&nbsp;"+d5.getFullYear();
}


function popUpCalendar(extForm, ctl, ctl2, ctlx, ft6, mNe, dNe, dFNe,xd3,isOut,dmx,nsx,mrx,arx,s8,mxd,i) {
var l7=0;
var t7=0;
//mN=String(mNe).split(',');
//dN=String(dNe).split(',');
//dFN=String(dFNe).split(',');
mN= mNe.split(',');
dN= dNe.split(',');
dFN= dFNe.split(',');
nDS=nsx;
scM=dmx;ccn=isOut;axm=arx;ixm=mrx;sMd=s8;thisForm=extForm;
if (typeof i == 'undefined') iconSpanIndex=-1; else iconSpanIndex=i;	
if (bpl) {
if (cO.visibility=="hidden") {
cTP=ctl2;Ft=ft6;f8="/";aF=Ft.split(f8);if (aF.length<3) {f8="";}Tk=0;
if (f8!="") {aD=ctl2.value.split(f8);m3=xd3.split(f8);if (!s8) oid=ctlx.value.split(f8);
for (i=0;i<3;i++) {
if ((aF[i]=="d")||(aF[i]=="dd")){
dSd=parseInt(aD[i],10);
dx1=parseInt(m3[i],10);
if (!s8) ois=parseInt(oid[i],10);Tk++;}
else if ((aF[i]=="m")||(aF[i]=="mm")) {mSd=parseInt(aD[i],10)-1;mx=parseInt(m3[i],10);if (!s8) mos=parseInt(oid[i],10);Tk++;}
else if (aF[i]=="yyyy") {ySd=parseInt(aD[i],10);yx=parseInt(m3[i],10);if (!s8) yos=parseInt(oid[i],10);Tk++;}}}
if ((Tk!=3)||isNaN(dSd)||isNaN(mSd)||isNaN(ySd)) {dSd=today.getDate();mSd=today.getMonth();ySd=today.getFullYear();}
mnD=new Date(mx+"/"+dx1+"/"+yx);
if (!s8) o1d=new Date(mos+"/"+ois+"/"+yos);
if (ccn) o2=new Date((mos)+"/"+(ois+mxd)+"/"+yos);
else o2=new Date((mx+1)+"/"+dx1+"/"+(yx+1));
odSd=dSd;omSd=mSd;oySd=ySd;aTag=ctl;
do {aTag=aTag.offsetParent;l7+=aTag.offsetLeft;t7+=aTag.offsetTop;} 
while (aTag.tagName!="BODY");
cO.left=fx==-1?ctl.offsetLeft+l7:fx;
cO.top=fy==-1?ctl.offsetTop+t7+ctl.offsetHeight+2-115:fy;
//bC(1,mSd,ySd);
bC(i);
cO.visibility=(dom||ie)?"visible":"show";
hE('SELECT',gj("clnd"));hE('APPLET',gj("clnd"));bw=true;}}
else {init();popUpCalendar(thisForm, ctl, ctl2, ctlx, ft6, mNe,dNe,dFNe,xd3,isOut,dmx,nsx,mrx,arx,s8,mxd,i);}
}
document.onclick=function hidecal2() 
{
	if (!bw) {h0();}
	bw=false;
}

function dateCoerenti(dataInizio,dataFine)
{
  gI= dataInizio.substr(0,2);
  mI= dataInizio.substr(3,2);        
  aI= dataInizio.substr(6);
        
  gF= dataFine.substr(0,2);
  mF= dataFine.substr(3,2);
  aF= dataFine.substr(6);
        
  var departingDate=new Date(aI, mI-1, gI);  //Month is 0-11 in JavaScript
  var returningDate=new Date(aF, mF-1, gF);  //new Date()
  
  if(returningDate.getTime()-departingDate.getTime() > 0) return true;
  else return false;
}

function dateCoerentiSoloVolo(dataInizio,dataFine)
{
  gI= dataInizio.substr(0,2);
  mI= dataInizio.substr(3,2);        
  aI= dataInizio.substr(6);
        
  gF= dataFine.substr(0,2);
  mF= dataFine.substr(3,2);
  aF= dataFine.substr(6);
        
  var departingDate=new Date(aI, mI-1, gI);  //Month is 0-11 in JavaScript
  var returningDate=new Date(aF, mF-1, gF);  //new Date()
  
  if(returningDate.getTime()-departingDate.getTime() >= 0) return true;
  else return false;
}


function giorniDifferenza(dataInizio,dataFine)
{
  gI= dataInizio.substr(0,2);
  mI= dataInizio.substr(3,2);        
  aI= dataInizio.substr(6);
        
  gF= dataFine.substr(0,2);
  mF= dataFine.substr(3,2);
  aF= dataFine.substr(6);
        
  var departingDate=new Date(aI, mI-1, gI);  //Month is 0-11 in JavaScript
  var returningDate=new Date(aF, mF-1, gF);  //new Date()
  var one_day=1000*60*60*24;
  //Calculate difference btw the two dates, and convert to days        
  var giorniDifferenza = Math.floor((returningDate.getTime()-departingDate.getTime())/(one_day));        

  return giorniDifferenza;
}


