function DoCal(elTarget, elTarget2, IN_OUT, p1, p2) { var value=elTarget.value; // if (value=="" && elTarget2!=null){ // value=elTarget2.value; // } var path; var path2; if (IN_OUT==0){path=p1; path2=p2; value=elTarget.value;} if (IN_OUT==1){path=p2; path2=p1; value=elTarget2.value;} var width = screen.width/2 - 95; var height = screen.height/2 - 95; window.open("include/calendar.asp?Date="+value+"&Path="+path+"&Path2="+path2+"&IN_OUT="+IN_OUT,"Calendar","width=250,height=200,toolbar=no,scrollbars=no,status=no,center=yes,resizable=yes,left="+width+",top="+height); } //---------------------------------- function DoCalShort(elTarget,year, path) { var sRtn; var Data = ""; if(elTarget.value != "") Data = elTarget.value+"-"+year; else{ d = '24/11/2017'; Data = d.substr(0,5)+"/"+year; } /* sRtn = showModalDialog("Include/Calendar.asp?Date="+Data,"","center:yes;dialogWidth=190pt;dialogHeight=190pt;scroll:no;help:no;status:no;"); if (sRtn!="") elTarget.value = sRtn.substr(0,6); */ var width = screen.width/2 - 95; var height = screen.height/2 - 95; window.open("../common/Include/Calendar.asp?Date="+Data+"&Path="+path,"Calendar","width=250,height=200,toolbar=no,scrollbars=no,status=no,center=yes,resizable=yes,left="+width+",top="+height); } //--------------------------------------- // for default.asp and search2.asp //--------------------------------------- function getMonthNumber(month){ if(month=="01") return 0; if(month=="02") return 1; if(month=="03") return 2; if(month=="04") return 3; if(month=="05") return 4; if(month=="06") return 5; if(month=="07") return 6; if(month=="08") return 7; if(month=="09") return 8; if(month=="10") return 9; if(month=="11") return 10; if(month=="12") return 11; } function getMonthName(month_number){ if(month_number==0) return "01"; if(month_number==1) return "02"; if(month_number==2) return "03"; if(month_number==3) return "04"; if(month_number==4) return "05"; if(month_number==5) return "06"; if(month_number==6) return "07"; if(month_number==7) return "08"; if(month_number==8) return "09"; if(month_number==9) return "10"; if(month_number==10) return "11"; if(month_number==11) return "12"; } function CalculateNights(night_obj, d_in_obj, d_out_obj){ nights=night_obj.value; if (isNaN(nights)){ alert("Nights must be number!"); night_obj.focus(); return; }// // regarding from DATE_IN date_arr=d_in_obj.value; if (date_arr!=""){ year="20"+date_arr.substring(7); day = date_arr.substring(0,2); month = date_arr.substring(3,6); month2=getMonthNumber(month); day2=parseFloat(day)+parseFloat(nights); // var Date_OUT = new Date( year, month2, day2 ); d=new String(Date_OUT.getDate()); m=getMonthName(Date_OUT.getMonth()); y=new String(Date_OUT.getFullYear()); d2= (d.length == 1) ? "0"+d : d; Date_OUT_STR=d2 +" "+m+" "+y.substring(2); if(nights!=""){ d_out_obj.value=Date_OUT_STR; } } } var paramspassed = new Array(); function DoCalNights(elTarget, elTarget2, elNights, IN_OUT, p1, p2) { var value=elTarget.value; // if (value=="" && elTarget2!=null){ // value=elTarget2.value; // } var path; var path2; if (IN_OUT==0){path=p1; path2=p2; value=elTarget.value;} if (IN_OUT==1){path=p2; path2=p1; value=elTarget2.value;} var width = screen.width/2 - 95; var height = screen.height/2 - 95; window.open("../common/Include/Calendar.asp?Date="+value+"&Path="+path+"&Path2="+path2+"&IN_OUT="+IN_OUT,"Calendar","width=250,height=200,toolbar=no,scrollbars=no,status=no,center=yes,resizable=yes,left="+width+",top="+height); } var check_alert = false; function checkDate(elTarget, elTarget2, elNights, IN_OUT) { date_arr=elTarget2.value; date_part=elTarget.value; if ( (date_arr!="")&(date_part!="")&(date_part!= "al") ){ year=date_arr.substring(6); day = date_arr.substring(0,2); month = date_arr.substring(3,5); month2=getMonthNumber(month); var Date_IN = new Date( year, month2, day); //alert(Date_IN); year=date_part.substring(6); day = date_part.substring(0,2); month = date_part.substring(3,5); month2=getMonthNumber(month); var Date_OUT = new Date( year, month2, day); //alert(Date_OUT); var MinMilli = 1000 * 60; var HrMilli = MinMilli * 60; var DyMilli = HrMilli * 24; //-------------------------- d1=Date_IN.getTime(); d2=Date_OUT.getTime(); diff=d2-d1; df=Math.round(diff/DyMilli); if(parseFloat(df) >= 1) { //elNights.value=df; check_alert = false; }else{ if(!check_alert){ alert("La data fine deve essere successiva alla data inizio "); //elNights.value=""; check_alert = false; } if(IN_OUT==0){ elTarget2.value="";elTarget2.focus();} else {elTarget.value="";elTarget.focus();} check_alert = false; } } } //------------------------------------------