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 showCalendar(month,year,action)
{	
	if(action=='prev')
	{
		if(month==1)
		{
			month=12;
			year=year-1;
		}
		else
		{
			month=month-1;
		}		
	}
	
	if(action=='next')
	{
		if(month==12)
		{
			month=1;
			year=year+1;
		}
		else 
		{
			month=month+1;
		}
	}
	
	calxmlHttp=GetXmlHttpObject()
	if (calxmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	} 
  
  		var url="calendar/ajax/show_calendar.php";
		url=url+"?month="+month;
		url=url+"&year="+year;
		url=url+"&sid="+Math.random();
		calxmlHttp.onreadystatechange=function()
		{ 
			if (calxmlHttp.readyState==4 && calxmlHttp.status == 200)
			{ 
				var calresponse=calxmlHttp.responseText;
						
				document.getElementById('calendar_div').innerHTML=calresponse;
				document.getElementById('message_div').innerHTML="";
			}
		};
		
		calxmlHttp.open("GET",url,true);
		calxmlHttp.send(null);
 
}
	
	
//function showEvent(date)
//{
//	document.getElementById('message_div').innerHTML="";
//	catid=document.getElementById('catid').value;
//	
//	evxmlHttp=GetXmlHttpObject()
//	if (evxmlHttp==null)
//  	{
//  		alert ("Your browser does not support AJAX!");
//  		return;
//  	} 
//  
//  		var url="../ajax/get_events.php";
//		url=url+"?date="+date;
//		url=url+"&catid="+catid;
//		url=url+"&sid="+Math.random();
//		evxmlHttp.onreadystatechange=function()
//		{ 
//			if (evxmlHttp.readyState==4 && evxmlHttp.status == 200)
//			{ 
//				var evresponse=evxmlHttp.responseText;
//				
//				if(evresponse==1)
//				{
//					location.href="show_events.php?date="+date+"&catid="+catid;
//				}
//				else
//				{
//					document.getElementById('message_div').innerHTML="<font color='red'>No Events</font>";
//					//document.getElementById('message_div').innerHTML=evresponse;
//				}
//			
//			}
//		};
//		
//		evxmlHttp.open("GET",url,true);
//		evxmlHttp.send(null);
// 
//}
// 
//
