function lastday(mon, yr)
	{
		var start_date= new Date(yr, mon, 1);
		var end_date= new Date(yr, mon+1, 1);
		lday =( end_date - start_date);
		lday = lday/(24*60*60000);         //calculate no of days
		return lday;
	}
	function idays(m,d)
	{
	    month=m.value;
		day=d.value;
	    mon=month.substring(0,3);
		if(mon=="Jan")
		  mon=0;
		if(mon=="Feb")
		  mon=1;
		if(mon=="Mar")
		  mon=2;
		if(mon=="Apr")
		  mon=3;
		if(mon=="May")
		  mon=4;
		if(mon=="Jun")
		  mon=5;
		if(mon=="Jul")
		  mon=6;
		if(mon=="Aug")
		  mon=7;
		if(mon=="Sep")
		  mon=8;
		if(mon=="Oct")
		  mon=9;
		if(mon=="Nov")
		  mon=10;   
		if(mon=="Dec")
		  mon=11;   
		year=month.substring(3);
		lday=lastday(mon,year);  
		d.length=lday;
	    for(i=0;i<lday;i++)
	    {
			d.options[i].text=i+1;
			d.options[i].value=i+1;    //dispaly the no of days
	    }
		
	}
	var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	var offsetX=0;
	var offsetY=0;
	var bn=navigator.platform
	var leftmargin=0
	var scrheight=0;scrwidth=0;
	var bw=navigator.userAgent;
	var os="Win"
	var ie=false;
	var ns=false;
	var sf=false;
	var fx=false
	var op=false;
	var mz=false;
	scrheight =(window.screen.height);
	scrwidth =(window.screen.width);
	if(bn.indexOf("Win32")==-1){os="Mac";}
	if(bw.indexOf("Opera")!=-1)
	{op=true;}
	else if(bw.indexOf("Safari")!=-1)
	{sf=true;}
	else if(bw.indexOf("Firefox")!=-1)
	{fx=true;}
	else if(bw.indexOf("MSIE")!=-1)
	{ie=true;}
	else if(bw.indexOf("Netscape")!=-1 && bw.indexOf("Mozilla")!=-1)
	{ns=true;}
	else if(bw.indexOf("Mozilla")!=-1)
	{mz=true;}
	else
	{op=true;}	
	
	function setPos(pos)
	{
		if(os=="Win")
		{
			if(ie)
			{
			if(parseInt(scrwidth)=="800" && parseInt(scrheight)=="600") {offsetX=parseInt(pos[0]);offsetY=parseInt(pos[1]);}
			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[2]);offsetY=parseInt(pos[3]);}
			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[4]);offsetY=parseInt(pos[5]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[6]);offsetY=parseInt(pos[7]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[6]);offsetY=parseInt(pos[7]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[6]);offsetY=parseInt(pos[7]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[6]);offsetY=parseInt(pos[7]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="800"){offsetX=parseInt(pos1[0]);offsetY=parseInt(pos1[1]);}
			//alert("X:"+offsetX+"   Y:"+offsetY);
			}
			else if(op)
			{
			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[8]);offsetY=parseInt(pos[9]);}
			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[10]);offsetY=parseInt(pos[11]);}
			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[12]);offsetY=parseInt(pos[13]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[14]);offsetY=parseInt(pos[15]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[14]);offsetY=parseInt(pos[15]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[14]);offsetY=parseInt(pos[15]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[14]);offsetY=parseInt(pos[15]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="800"){offsetX=parseInt(pos1[2]);offsetY=parseInt(pos1[3]);}
			//alert("X:"+offsetX+"   Y:"+offsetY);
			}
			else if(fx)
			{
			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[16]);offsetY=parseInt(pos[17]);}
			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[18]);offsetY=parseInt(pos[19]);}
			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[20]);offsetY=parseInt(pos[21]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[22]);offsetY=parseInt(pos[23]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[80]);offsetY=parseInt(pos[23]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[81]);offsetY=parseInt(pos[23]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[82]);offsetY=parseInt(pos[23]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="800"){offsetX=parseInt(pos1[4]);offsetY=parseInt(pos1[5]);}
			//alert("offsetX:" +offsetX +"offsetY:"+offsetY );
			}
			else if(ns)
			{
			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[24]);offsetY=parseInt(pos[25]);}
			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[26]);offsetY=parseInt(pos[27]);}
			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[28]);offsetY=parseInt(pos[29]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[30]);offsetY=parseInt(pos[31]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[80]);offsetY=parseInt(pos[31]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[81]);offsetY=parseInt(pos[31]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[82]);offsetY=parseInt(pos[31]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="800"){offsetX=parseInt(pos1[6]);offsetY=parseInt(pos1[7]);}
			//alert("offsetX:" +offsetX +"offsetY:"+offsetY );
			}
			else if(mz)
			{
			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[32]);offsetY=parseInt(pos[33]);}
			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[34]);offsetY=parseInt(pos[35]);}
			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[36]);offsetY=parseInt(pos[37]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="720"){offsetX=parseInt(pos[38]);offsetY=parseInt(pos[39]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[80]);offsetY=parseInt(pos[39]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[81]);offsetY=parseInt(pos[39]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="1024"){offsetX=parseInt(pos[82]);offsetY=parseInt(pos[39]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="800"){offsetX=parseInt(pos1[8]);offsetY=parseInt(pos1[9]);}
			//alert("offsetX:" +offsetX +"offsetY:"+offsetY );
			}
		}
		else if(os=="Mac")
		{
			if(ie)
			{
			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[40]);offsetY=parseInt(pos[41]);}
			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[42]);offsetY=parseInt(pos[43]);}
			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[44]);offsetY=parseInt(pos[45]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[46]);offsetY=parseInt(pos[47]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="800"){offsetX=parseInt(pos1[10]);offsetY=parseInt(pos1[11]);}
			//alert("X:"+offsetX +"Y:" +offsetY);
			}
			else if(op)
			{
			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[48]);offsetY=parseInt(pos[49]);}
			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[50]);offsetY=parseInt(pos[51]);}
			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[52]);offsetY=parseInt(pos[53]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[54]);offsetY=parseInt(pos[55]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="800"){offsetX=parseInt(pos1[12]);offsetY=parseInt(pos1[13]);}
			//alert("X:"+offsetX +"Y:" +offsetY);
			}
			else if(fx)
			{
			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[56]);offsetY=parseInt(pos[57]);}
			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[58]);offsetY=parseInt(pos[59]);}
			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[60]);offsetY=parseInt(pos[61]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[62]);offsetY=parseInt(pos[63]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="800"){offsetX=parseInt(pos1[14]);offsetY=parseInt(pos1[15]);}
			//alert("X:"+offsetX +"Y:" +offsetY);
			}
			else if(ns)
			{
			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[64]);offsetY=parseInt(pos[65]);}
			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[66]);offsetY=parseInt(pos[67]);}
			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[68]);offsetY=parseInt(pos[69]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[70]);offsetY=parseInt(pos[71]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="800"){offsetX=parseInt(pos1[16]);offsetY=parseInt(pos1[17]);}
			//alert("X:"+offsetX +"Y:" +offsetY);
			}
			
			else if(sf)
			{
			if(parseInt(scrwidth)=="800"  && parseInt(scrheight)=="600"){offsetX=parseInt(pos[72]);offsetY=parseInt(pos[73]);}
			if(parseInt(scrwidth)=="1024" && parseInt(scrheight)=="768"){offsetX=parseInt(pos[74]);offsetY=parseInt(pos[75]);}
			if(parseInt(scrwidth)=="1152" && parseInt(scrheight)=="864"){offsetX=parseInt(pos[76]);offsetY=parseInt(pos[77]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="960"){offsetX=parseInt(pos[78]);offsetY=parseInt(pos[79]);}
			if(parseInt(scrwidth)=="1280" && parseInt(scrheight)=="800"){offsetX=parseInt(pos1[18]);offsetY=parseInt(pos1[19]);}
			//alert("X:"+offsetX +"Y:" +offsetY);
			}
		}
	}
	// Check - in Date
	var calReceivedBy= new CalendarPopup("calendarReceivedBy");
	calReceivedBy.setReturnFunction("showDateCheckIn");
	calReceivedBy.setDayHeaders('Su','M','Tu','W','Th','F','Sa');