// JavaScript Document
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
function msg_focus()
{	
	//alert(document.getElementById(id).value);
	if (document.getElementById('msg').value=="please enter your note")
	{
		document.getElementById('msg').value='';	
	}
	
}
function msg_save(date)
{
	var msg = document.getElementById('msg').value;
	//alert(date);
	if (msg=="")	
	{
		alert("please enter note:");
		//return false;
	}
	else
	{
		add_msg("add_data.php",msg,date);
	}
}
function add_msg(strurl,msg,date)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url=strurl;
	var url=url+"?msg="+msg+"&date="+date;
	xmlHttp.onreadystatechange=function() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			alert(xmlHttp.responseText); 
			//document.getElementById(id).innerHTML='block';	
			//document.getElementById('msg').value=xmlHttp.responseText;
		}
	};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function add_note(strurl,date)
{
	//alert(date);
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url=strurl;
	url=url+"?date="+date;
	xmlHttp.onreadystatechange=function() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			//alert(xmlHttp.responseText); 
			//document.getElementById(id).innerHTML='block';	
			document.getElementById('ms').innerHTML=xmlHttp.responseText;
		}
	};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function set_reminder(cal_id)
{	var width=500;
	var height=350;
	var left=parseInt((screen.availWidth/2) - (width/2));
	var top = parseInt((screen.availHeight/2) - (height/2));
		win=window.open('set_reminder.php?cal_id='+cal_id,'add','toolbar=0,scrollbars=0,left='+left+',top='+top+',screenx='+left+',screenY='+top+' , statusbar=0 , menubar=0,resizable=0,width='+width+',height='+height);
	
	window.add.focus();
}

function edit_calendar_note(cal_id)
{			
		var width=485;
		var height=545;
		var left=parseInt((screen.availWidth/2) - (width/2));
		var top = parseInt((screen.availHeight/2) - (height/2));
		
		win=window.open('edit_calendar_data.php?cal_id='+cal_id,'add','toolbar=0,scrollbars=0,left='+left+',top='+top+',screenx='+left+',screenY='+top+' , statusbar=0 , menubar=0,resizable=0,width='+width+',height='+height);
	
}
function delete_calendar_note(cal_id)
{

	window.open('delete_calendar_note.php?cal_id='+cal_id,'add','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300');
	window.add.focus();
}
