OT_CAL_LAYER='OT_CAL';OT_CAL_OPEN=null;OT_CAL_FIELD=null;OT_CAL_DATE=new Date();OT_MONTHS=new Array('January','February','March','April','May','June','July','August','September','October','November','December');
function OT_x(o){if(document.layers) return o.left;return o.offsetLeft+(o.offsetParent?OT_x(o.offsetParent):0);}
function OT_y(o){if(document.layers) return o.top;return o.offsetTop+(o.offsetParent?OT_y(o.offsetParent):0);}
function OT_w(o){if(document.layers) return o.clip.width;return o.offsetWidth;}
function OT_h(o){if(document.layers) return o.clip.height;return o.offsetHeight;}
function OT_move(o,x,y){if(document.layers)o.moveToAbsolute(x,y);else if(o.style.left&&(!o.style.pixelLeft)){o.style.left=x+'px';o.style.top=y+'px';} else{o.style.pixelLeft=x;o.style.pixelTop=y;}}
function OT_inside(o,x,y,dx1,dy1,dx2,dy2){var l=OT_x(o);var t=OT_y(o);return ((x-(dx1?dx1:0)>=l)&&(y-(dy1?dy1:0)>=t)&&(x-(dx2?dx2:0)<l+OT_w(o))&&(y-(dy2?dy2:0)<t+OT_h(o)));}
function OT_open(a){var o=(document.getElementById?document.getElementById(OT_CAL_LAYER):(document.all?document.all[OT_CAL_LAYER]:document[OT_CAL_LAYER]));var n=(OT_CAL_OPEN==null);if(OT_CAL_FIELD&&(a==OT_CAL_FIELD)) return false;if(!n){if(document.layers) OT_CAL_OPEN.visibility='hide';else OT_CAL_OPEN.style.visibility='hidden';}OT_CAL_OPEN=o;OT_CAL_FIELD=a;var d;if(a.name=='inDate'){OT_CAL_DATE=new Date();d=new Date();d.setDate(d.getDate()+14);} else if(a.name=='departureDate'){OT_CAL_DATE=new Date();d=new Date();d.setDate(d.getDate()+14);} else{d=new Date(OT_CAL_DATE.getFullYear(),OT_CAL_DATE.getMonth(),OT_CAL_DATE.getDate());d.setDate(d.getDate()+2);}OT_render(d.getMonth()+1,d.getFullYear());OT_move(o,OT_x(a)+OT_w(a),OT_y(a));if(document.layers) o.visibility='show';else o.style.visibility='visible';if(n){if(document.layers) document.captureEvents(Event.MOUSEDOWN);else document.onmousedown=OT_check;}}
function OT_check(e){if(OT_CAL_OPEN==null) return;var x=(document.all?event.clientX+document.body.scrollLeft:e.pageX);var y=(document.all?event.clientY+document.body.scrollTop:e.pageY);if(!(OT_inside(OT_CAL_FIELD,x,y,0,0,4,0)||OT_inside(OT_CAL_OPEN,x,y))) OT_close();}
function OT_set(y,m,d){if(OT_CAL_OPEN==null) return;OT_CAL_FIELD.value=(m<10?'0':'')+m+'/'+(d<10?'0':'')+d+'/'+y;if(OT_CAL_FIELD.name=='inDate') OT_CAL_DATE=new Date(y,m-1,d);OT_close();}
function OT_close(){if(document.layers) OT_CAL_OPEN.visibility='hide';else OT_CAL_OPEN.style.visibility='hidden';if(OT_CAL_OPEN!=null){if(document.layers) document.releaseEvents(Event.MOUSEDOWN);else document.onmousedown=null;}OT_CAL_OPEN=null;OT_CAL_FIELD=null;}
function OT_render(month,year){if(OT_CAL_OPEN==null) return;var t_y=OT_CAL_DATE.getFullYear();var t_m=OT_CAL_DATE.getMonth()+1;var t_d=OT_CAL_DATE.getDate();var d=new Date(year,month-1,1);var max=(month==2?28+((year%4==0)&&((year%100!=0)||(year%400==0))?1:0):30+(month<8?1-((month-1)%2):(month-1)%2));var html='<table border=0 cellpadding=1 cellspacing=0 bgcolor="#003366"><tr><td><table border=0 cellpadding=3 cellspacing=1 width=150><tr bgcolor="#003366"><td align=center><a href="javascript:void(0)" onclick="OT_render(';html+=(month>1?month-1:12)+',' +(month>1?year:year-1)+')"><img src="/affiliates/onetime/images/a_left.gif" width=8 height=8 border=0></a></td><td colspan=5 align=center><font size=1 face="arial,helvetica" color=white><b>';html+=OT_MONTHS[month-1]+' '+year+'</b></font></td><td align=center><a href="javascript:void(0)" onclick="OT_render('+(month<12?month+1:1)+','+(month<12?year:year+1)+')"><img src="/affiliates/onetime/images/a_right.gif" width=8 height=8 border=0></a></td></tr><tr bgcolor="#e1e1e1">';html+='<td align=center><font size=1 face="arial,helvetica">S</font></td><td align=center><font size=1 face="arial,helvetica">M</font></td><td align=center><font size=1 face="arial,helvetica">T</font></td><td align=center><font size=1 face="arial,helvetica">W</font></td><td align=center><font size=1 face="arial,helvetica">T</font></td><td align=center><font size=1 face="arial,helvetica">F</font></td><td align=center><font size=1 face="arial,helvetica">S</font></td></tr>';var offset=d.getDay()+1;var count=1,i,a;for (i=1;i<=max;i++){if(count==1) html+='<tr bgcolor=white>';if((i==1)&&(offset>1)){html+='<td colspan='+(offset-1)+' bgcolor="#e1e1e1"><font size=1>&nbsp;</font></td>';count=offset;}a=((year>t_y)||((year==t_y)&&((month>t_m)||((month==t_m)&&(i>t_d)))));html+='<td align=center><font face="arial,helvetica" size=1'+(a?'><a href="javascript:void(0)" onclick="OT_set('+year+','+month+','+i+')"><b>':' color=gray>')+i+(a?'</b></a>':'')+'</font></td>';if((i==max)&&(count<7)){html+='<td colspan='+(7-count)+' bgcolor="#e1e1e1"><font size=1>&nbsp;</font></td>';count=7;}count++;if(count>7){count=1;html+='</tr>';}}html+='</table></td></tr></table>';if(document.layers){OT_CAL_OPEN.document.open('text/html');OT_CAL_OPEN.document.write(html);OT_CAL_OPEN.document.close();} else OT_CAL_OPEN.innerHTML=html;}
function OT_checkHDate(d,n){if(!d.value){alert('Please add a valid '+n+'.');return false;}var e1,e2;if((e1=d.value.match(/^(1[0-2]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])\/((20)?[0-9]{2})$/))||(e2=d.value.match(/^(3[01]|[12][0-9]|0?[1-9])\.\s*(1[0-2]|0?[1-9])\.\s*((20)?[0-9]{2})$/))){var day,month,year;if(e1){day=Number(e1[2]);month=Number(e1[1]);year=Number(e1[3]);}else{day=Number(e2[1]);month=Number(e2[2]);year=Number(e2[3]);}year=(year<2000?year+2000:year);if(day>(month==2?28+((year%4==0)&&((year%100!=0)||(year%400==0))?1:0):30+(month<8?1-((month-1)%2):(month-1)%2))){alert('The '+n+' does not seem to be a valid date.');return false;}d.value=(month<10?'0':'')+month+'/'+(day<10?'0':'')+day+'/'+year;} else{alert('The '+n+' does not seem to be a valid date.\nPlease provide a date in either the format\n"mm/dd/yyyy" or "dd. mm. yyyy".');return false;}return true;}function OT_submitH(f){if(!OT_checkHDate(f.inDate,'Check-In Date')) return false;if(!OT_checkHDate(f.outDate,'Check-Out Date')) return false;var d1=f.inDate.value.match(/^(1[0-2]|0[1-9])\/(3[01]|[12][0-9]|0[1-9])\/(20[0-9]{2})$/);var d2=f.outDate.value.match(/^(1[0-2]|0[1-9])\/(3[01]|[12][0-9]|0[1-9])\/(20[0-9]{2})$/);if((d2[3]<d1[3])||((d2[3]==d1[3])&&((d2[1]<d1[1])||((d2[1]==d1[1])&&(d2[2]<=d1[2]))))){alert('The Check-Out Date must be AFTER the Check-In Date.\nPlease correct and try again.');return false;}return true;}