document.write('<iframe id=CalFrame name=CalFrame frameborder=0 src=css/calendar.htm style=display:none;position:absolute;z-index:100></iframe>');
document.onclick=hideCalendar;

function setCheckInDate(d)
{
	document.getElementById("checkin").value=d;
	if(document.getElementById("checkout").value.length==0)
	{
		showCalendar('dimg2',false,'checkout','checkin');
	}
}

function setCheckIn1Date(d)
{
	document.getElementById("checkin1").value=d;
	if(document.getElementById("checkout1").value.length==0)
	{
		showCalendar('dimg22',false,'checkout1','checkin1');
	}
}

function showCalendar(sImg,bOpenBound,sFld1,sFld2,sCallback)
{
	var fld1,fld2;
	var cf=document.getElementById("CalFrame");
	var wcf=window.frames.CalFrame;
	var oImg=document.getElementById(sImg);
	if(!oImg){alert("Sorry,The System Error!");return;}
	if(!sFld1){alert("Sorry,The System Error!");return;}
	fld1=document.getElementById(sFld1);
	if(!fld1){alert("Sorry,The System Error!");return;}
	if(fld1.tagName!="INPUT"||fld1.type!="text"){alert("Sorry,The System Error!");return;}
	if(sFld2)
	{
		fld2=document.getElementById(sFld2);
		if(!fld2){alert("Sorry,The System Error!5");return;}
		if(fld2.tagName!="INPUT"||fld2.type!="text"){alert("Sorry,The System Error!");return;}
		wcf.fld2=fld2;
	}
	if(!wcf.bCalLoaded){alert("Sorry,The System Error!");return;}
	if(cf.style.display=="block"){cf.style.display="none";return;}
	
	var eT=0,eL=0,p=oImg;
	var sT=document.documentElement.scrollTop,sL=document.documentElement.scrollLeft;
	var eH=oImg.height,eW=oImg.width;
	while(p&&p.tagName!="BODY"){eT+=p.offsetTop;eL+=p.offsetLeft;p=p.offsetParent;}
//	cf.style.top = eT + eH +  "px";
//	cf.style.left = eL + eW +  "px";
	cf.style.top=(document.documentElement.clientHeight-(eT-sT)-eH>=cf.height)?eT+eH+ "px":eT-cf.height + "px";
cf.style.left=(document.documentElement.clientWidth-(eL-sL)>=cf.width)?eL+ "px":eL+eW-cf.width + "px";
	cf.style.display="block";
	wcf.openbound=bOpenBound;
	wcf.fld1=fld1;
	wcf.callback=sCallback;
	wcf.initCalendar();
}
function hideCalendar()
{
	var cf=document.getElementById("CalFrame");
	cf.style.display="none";
}
