// JavaScript Document

var xmlHttp

var calendar;

function show_calendar(obj)

{ 

		var url="script/popcalendar.php";		
		if(typeof(obj.value)!="undefined")
			calendar=obj;	
		else
			calendar=eval("document."+obj);		

		html='<br><br><br><img src="script/loading.gif" width="49" height="50"><br>Loading......<br><br><br>';		

		document.getElementById("divCalendar").style.visibility='visible';		

		xmlHttp=GetXmlHttpObject(stateChanged)

		xmlHttp.open("GET", url , true)

		xmlHttp.setRequestHeader("Content-Type","text/html")

		xmlHttp.send(null)

} 

function change_calendar(yr,mn){

		var url="script/popcalendar.php?year="+yr+"&month="+mn;		

		html='<br><br><img src="script/loading.gif" width="49" height="50"><br>Loading......<br><br><br>';

		document.getElementById("divCalendar").innerHTML=html;

		xmlHttp=GetXmlHttpObject(stateChanged)

		xmlHttp.open("GET", url , true)

		xmlHttp.setRequestHeader("Content-Type","text/html")

		xmlHttp.send(null)	

}

function stateChanged() 

{ 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

	{ 

		document.getElementById("divCalendar").innerHTML=xmlHttp.responseText;

		document.getElementById("divCalendar").style.visibility='visible';

		var h = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;

		var wintop = h + (screen.height - 500)/2 -50;

		var winleft = (screen.width - 400)/2-70;		

		document.getElementById("divCalendar").style.left=winleft;

		document.getElementById("divCalendar").style.top=wintop;

		document.getElementById("divCalendar").style.visibility="visible";

	} 

}

function GetXmlHttpObject(handler)

{ 

	

	var objXmlHttp=null

	

	

	if (navigator.userAgent.indexOf("MSIE")>=0)

	{ 

		var strName="Msxml2.XMLHTTP"

		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)

		{

			strName="Microsoft.XMLHTTP"

		} 

		try

		{ 

			objXmlHttp=new ActiveXObject(strName)

			objXmlHttp.onreadystatechange=handler 

			return objXmlHttp

		} 

		catch(e)

		{ 

			alert("Error. Scripting for ActiveX might be disabled") 

			return 

		} 

	} 

	else

	{

		objXmlHttp=new XMLHttpRequest()

		objXmlHttp.onload=handler

		objXmlHttp.onerror=handler 

		return objXmlHttp

	}

} 

function hideMe(){

	document.getElementById("divCalendar").innerHTML="";	

	document.getElementById("divCalendar").style.visibility='hidden';

}

function loadData(val){

	calendar.value=val;	
	calendar.focus();
	hideMe();

}

document.write('<div class=content align=center id="divCalendar" style="overflow:hidden; width:270px; height:250px; visibility:hidden;z-index:2;position:absolute;background-color:#FFFFFF;border:1px solid #539E1D"></div>');