// JavaScript Document

var xmlHttp

var calendar;
var url="";
function show_calendar(obj)
{ 
		temp=url;
		if(url=="")
			url="script/popcalendar.php?url=";		
		else
			url=url+"script/popcalendar.php?url="+url;		
		if(typeof(obj.value)!="undefined"){
			calendar=obj;	
			url=url+"&curdate="+obj.value;
		}
		else{
			calendar=eval("document."+obj);		
			url=url+"&curdate="+calendar.value;
		}
			

		html='<br><br><br><br>Loading......<br><br><br>';		

		document.getElementById("divCalendar").style.visibility='visible';		

		xmlHttp=GetXmlHttpObject(stateChanged1)

		xmlHttp.open("GET", url , true)
		
		xmlHttp.setRequestHeader("If-Modified-Since","Thu, 1 Jan 1970 00:00:00 GMT")
		
		xmlHttp.setRequestHeader("Cache-Control", "no-cache")

		xmlHttp.setRequestHeader("Content-Type","text/html")

		xmlHttp.send(null)
		
		url=temp;
		return false;

} 

function change_calendar(yr,mn){
		temp=url;
		if(url=="")		
			url="script/popcalendar.php?year="+yr+"&month="+mn+"&url="+url;		
		else
			url=url+"script/popcalendar.php?year="+yr+"&month="+mn+"&url="+url;		
		html='<br><br><br>Loading......<br><br><br>';

		document.getElementById("divCalendar").innerHTML=html;

		xmlHttp=GetXmlHttpObject(stateChanged1)

		xmlHttp.open("GET", url , true)
		
		xmlHttp.setRequestHeader("If-Modified-Since","Thu, 1 Jan 1970 00:00:00 GMT")
		
		xmlHttp.setRequestHeader("Cache-Control", "no-cache")
		
		xmlHttp.setRequestHeader("Content-Type","text/html")

		xmlHttp.send(null)	
		url=temp;

}

function stateChanged1() 

{ 

	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=normalcontent align=center id="divCalendar" style="overflow:hidden; width:270px; height:250px; visibility:hidden;z-index:2;position:absolute;background-color:#FFFFFF;border:1px solid #C5043C"></div>');
