MONTHS=new Array('January','February','March','April','May','June','July','August','September','October','November','December');

function openPartnerWindow(url,x,y,l){return window.open(url,l,'screenX='+x+',screenY='+y+',left='+x+',top='+y+',width='+(screen.width>1000?800:(screen.width>800?640:520))+',height='+(screen.width>1000?600:(screen.width>800?460:400))+',toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1');}
function getObject(n){if(document.all)return document.all[n];else if(document.getElementById)return document.getElementById(n);else return document[n];}
function showObject(o){if(o.style)o.style.visibility='visible';else o.visibility='show';}
function hideObject(o){if(o.style)o.style.visibility='hidden';else o.visibility='hide';}
function getX(o){if(document.layers)return o.left;return o.offsetLeft+(o.offsetParent?getX(o.offsetParent):0);}
function getY(o){if(document.layers)return o.top;return o.offsetTop+(o.offsetParent?getY(o.offsetParent):0);}
function getW(o){if(document.layers)return o.clip.width;return o.offsetWidth;}
function getH(o){if(document.layers)return o.clip.height;return o.offsetHeight;}
function isInside(o,x,y,dx1,dy1,dx2,dy2){var l=getX(o);var t=getY(o);return ((x-(dx1?dx1:0)>=l)&&(y-(dy1?dy1:0)>=t)&&(x-(dx2?dx2:0)<l+getW(o))&&(y-(dy2?dy2:0)<t+getH(o)));}
function moveObject(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 writeObject(o,c){if(document.layers){o.document.open('text/html');o.document.write(c);o.document.close();}else o.innerHTML=c;}
function trackMouseClick(f){if(document.layers)document.captureEvents(Event.MOUSEDOWN);document.onmousedown=f;}
function untrackMouseClick(){if(document.layers)document.releaseEvents(Event.MOUSEDOWN);document.onmousedown=null;}
function getEventX(e){return (document.all?event.clientX+document.body.scrollLeft:e.pageX);}
function getEventY(e){return (document.all?event.clientY+document.body.scrollTop:e.pageY);}
function updateGuests(o) {
    for (i=0;i<o.form.elements.length;i++) {
        var p=o.form.elements[i];
        if ((p!=o)&&((p.name=='HGuests')||(p.name.substr(0,8)=='HGuests.')))p.selectedIndex=o.selectedIndex;
    }
}

HCAL_LAYER='HCAL';HCAL_OPEN=null;HCAL_FIELD=null;HCAL_DATE=new Date();HCAL_STARTDATE=new Date();

function h_open(a){var o=getObject(HCAL_LAYER);var n=(HCAL_OPEN==null);if(HCAL_FIELD&&(a==HCAL_FIELD))return false;if(!n)hideObject(HCAL_OPEN);HCAL_OPEN=o;HCAL_FIELD=a;var d;if(a.name=='HCheckIn'){d=new Date();d.setDate(d.getDate()+14);HCAL_STARTDATE=new Date();}else{d=new Date(HCAL_DATE.getFullYear(),HCAL_DATE.getMonth(),HCAL_DATE.getDate());d.setDate(d.getDate()+1);HCAL_STARTDATE=d;}h_renderMonth(d.getMonth()+1,d.getFullYear());moveObject(o,getX(a)+getW(a),getY(a));showObject(o);if(n)trackMouseClick(h_checkClose);}
function h_checkClose(e){if(HCAL_OPEN==null)return;var x=getEventX(e);var y=getEventY(e);if(!(isInside(HCAL_FIELD,x,y,0,0,4,0)||isInside(HCAL_OPEN,x,y)))h_close();}
function h_setDate(y,m,d){if(HCAL_OPEN==null)return;HCAL_FIELD.value=y+'-'+(m<10?'0':'')+m+'-'+(d<10?'0':'')+d;if(HCAL_FIELD.name=='HCheckIn')HCAL_DATE=new Date(y,m-1,d);h_close();}
function h_close(){hideObject(HCAL_OPEN);if(HCAL_OPEN!=null)untrackMouseClick();HCAL_OPEN=null;HCAL_FIELD=null;}
function h_renderMonth(month,year){if(HCAL_OPEN==null)return;var t_y=HCAL_STARTDATE.getFullYear();var t_m=HCAL_STARTDATE.getMonth()+1;var t_d=HCAL_STARTDATE.getDate()+5;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="#305799"><tr><td><table border=0 cellpadding=3 cellspacing=1 width=150><tr bgcolor="#993300"><td align=center><a href="javascript:void(0)" onclick="h_renderMonth('+(month>1?month-1:12)+',' +(month>1?year:year-1)+')"><img src="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>'+MONTHS[month-1].toUpperCase()+' '+year+'</b></font></td><td align=center><a href="javascript:void(0)" onclick="h_renderMonth('+(month<12?month+1:1)+','+(month<12?year:year+1)+')"><img src="images/a_right.gif" width=8 height=8 border=0></a></td></tr><tr bgcolor="#e1e1e1"><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="h_setDate('+year+','+month+','+i+')"><font color="blue"><b>':' color=gray>')+i+(a?'</b></font></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>';writeObject(HCAL_OPEN,html);}