document.write('<iframe id=CalFrame name=CalFrame frameborder=0 src=http://www.freeiva.com/view/default/jscript/calendar.html style=display:none;position:absolute;z-index:100></iframe>');
document.onclick=hideCalendar;
var isIndex=false;
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 setCheckInDate1(d)
{
	document.getElementById("tr1").value=d;
	if(document.getElementById("tr2").value.length==0)
	{
		showCalendar('dimtr2',false,'tr2','tr1');
	}
}

function setCheckInDate2(d)
{
	document.getElementById("tm1").value=d;
	if(document.getElementById("tm2").value.length==0)
	{
		showCalendar('dimgtm2',false,'tm2','tm1','setCheckInDate3');
	}
}

function setCheckInDate3(d)
{
	document.getElementById("tm2").value=d;
	if(document.getElementById("tm3").value.length==0)
	{
		showCalendar('dimgtm3',false,'tm3','tm2');
	}
}


function showCalendar(sImg,bOpenBound,sFld1,sFld2,sCallback,y1,m1,y2,m2)
{
	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!");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(y1)wcf.y1=y1;
	if(y2)wcf.y2=y2;
	if(m1)wcf.m1=m1;
	if(m2)wcf.m2=m2;	
	
	if(cf.style.display=="block"){cf.style.display="none";return;}
	
	var eT=0,eL=0,p=oImg;
	var sT=document.body.scrollTop,sL=document.body.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";
	var isIE = document.all && window.external;
	if (isIE){
		if(isIndex)
			cf.style.top = eT + eH + 5 + "px";
		else
			cf.style.top = eT + eH + 5 + "px";
	}else{
		cf.style.top = eT + eH + 1 + "px";
	}
	cf.style.left = eL + eW-5 + "px";
	//cf.style.left = eL + eW-143 + "px";

//	cf.style.top=(document.body.clientHeight-(eT-sT)-eH>=cf.height)?eT+eH:eT-cf.height + "px";
//	cf.style.left=(document.body.clientWidth-(eL-sL)>=cf.width)?eL: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";
}
