// JavaScript Document

var xmlHttp1

var calendar;
var url="";
function show_calendar(obj)
{ 
		temp=url;
		if(url=="")
			url="Scripts/popcalendar.php";		
		else
			url=url+"Scripts/popcalendar_admin.php?url="+url;		
		//alert(url);	
		calendar=document.getElementById(obj);	
		//alert(calendar.name);
		html='<br><br><br><br>Loading......<br><br><br>';		

		document.getElementById("divCalendar").style.visibility='visible';		
		
		xmlHttp1=GetXmlHttpObject(stateChanged1)
		
		xmlHttp1.open("GET", url , true)

		xmlHttp1.setRequestHeader("Content-Type","text/html")

		xmlHttp1.send(null)
		
		url=temp;
		return false;

} 

function change_calendar(yr,mn){
		temp=url;
		if(url=="")		
			url="Scripts/popcalendar.php?year="+yr+"&month="+mn+"&url="+url;		
		else
			url=url+"Scripts/popcalendar.php?year="+yr+"&month="+mn+"&url="+url;		
		html='<br><br><br>Loading......<br><br><br>';

		document.getElementById("divCalendar").innerHTML=html;

		xmlHttp1=GetXmlHttpObject(stateChanged1)

		xmlHttp1.open("GET", url , true)

		xmlHttp1.setRequestHeader("Content-Type","text/html")

		xmlHttp1.send(null)	
		url=temp;

}

function stateChanged1() 

{ 

	if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete")

	{ 

		document.getElementById("divCalendar").innerHTML=xmlHttp1.responseText;

		//document.getElementById("divCalendar").style.visibility='visible';

		var h = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;

		//var wintop = h + (screen.height - 500)/2 -200;

		var winleft = (screen.width - 400)/2-150;		
		//var winleft =0;
		var wintop= document.body.scrollTop;
		//alert(wintop);
		document.getElementById("divCalendar").style.left=winleft;

		document.getElementById("divCalendar").style.top=wintop;

		document.getElementById("divCalendar").style.visibility="visible";

	} 

}


function hideMe(){

	document.getElementById("divCalendar").innerHTML="";	
	document.getElementById("divCalendar").style.visibility='hidden';

}

function loadData(val){

	calendar.value=val;	
	hideMe();
	callMe(0,document.getElementById('FromDate'));
	return false;

}
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
	}
}

document.write('<div class=content align=center id="divCalendar" style="overflow-y:auto;overflow: -moz-scrollbars-vertical;width:660px; height:570px; visibility:hidden;z-index:2;position:absolute;background-color:#FFFFFF;border:1px solid #886AAA"></div>');