


function show_l()
{
	var dstr = "<form action='login.php' method='post'>";
	dstr += "Login: <input name='ll' type='text' value='' /><br/>	Password: <input name='pp' type='password' value='' />";
	dstr += "<br/>	<input type='submit' value='Login' />	</form>";
	document.getElementById('logdiv').innerHTML= dstr;
}//funciton
//////////////////////
//////////////////////
//////////////////////
//////////////////////
function close_box()
{
	document.getElementById('eventdata').innerHTML="";
}//funciton
//////////////////////
//////////////////////
//////////////////////
//////////////////////
//////////////////////
//////////////////////
//////////////////////
//////////////////////
function make_entry()
{

var s=document.getElementById('subject').value;
var v=document.getElementById('venue').value;
var o=document.getElementById('other').value;
var h=document.getElementById('hour').value;
var min=document.getElementById('min').value;
var a=document.getElementById('ampm').value;
var d=document.getElementById('day').value;
var m=document.getElementById('month').value;
var y=document.getElementById('year').value;

var sstr = "?";
sstr += "s="+s;
sstr += "&v="+v;
sstr += "&o="+o;
sstr += "&h="+h;
sstr += "&min="+min;
sstr += "&a="+a;
sstr += "&d="+d;
sstr += "&m="+m;
sstr += "&y="+y;

		//AJAX>>>>>>>>
		//AJAX>>>>>>>>
		//AJAX>>>>>>>>
		//ajax add army
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser is not working!");
				return false;
			}
		}
	}
// Create a function that will receive data sent from the server

	var actionfile = "newinsert.php"+sstr;
	ajaxRequest.open("GET", actionfile, true);
	ajaxRequest.send(null);
	ajaxRequest.onreadystatechange = function()
	{	
			// We still need to write some code here
				if(ajaxRequest.readyState == 4)
				{
					//alert(ajaxRequest.responseText);
					//document.getElementById('myturn').value=0;
					//
					if(document.getElementById('subb').value == "Update")
					{
						del_e(document.getElementById('eventid').value);
					}else{
						window.location = "calendar.php";
					}
				}
	}//ajax

}//funciton
//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////
function del_e(id)
{

var answer;
if(document.getElementById('subb').value == "Update")
{
	answer = 1;
}else{
	answer = confirm('Are you sure you want to delete this appointment?');
}

if(answer)
{
		//AJAX>>>>>>>>
		//AJAX>>>>>>>>
		//AJAX>>>>>>>>
		//ajax add army
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser is not working!");
				return false;
			}
		}
	}
// Create a function that will receive data sent from the server

	var actionfile = "del.php?id="+id;
	ajaxRequest.open("GET", actionfile, true);
	ajaxRequest.send(null);
	ajaxRequest.onreadystatechange = function()
	{	
			// We still need to write some code here
				if(ajaxRequest.readyState == 4)
				{
					//alert(ajaxRequest.responseText);
					//document.getElementById('hd').innerHTML=ajaxRequest.responseText;
					window.location = "calendar.php";
					//
				}
	}//ajax
}//if answer
}//funciton
//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////
function show_upd(id)
{

		//AJAX>>>>>>>>
		//AJAX>>>>>>>>
		//AJAX>>>>>>>>
		//ajax add army
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser is not working!");
				return false;
			}
		}
	}
// Create a function that will receive data sent from the server

	var actionfile = "getevent.php?id="+id;
	ajaxRequest.open("GET", actionfile, true);
	ajaxRequest.send(null);
	ajaxRequest.onreadystatechange = function()
	{	
			// We still need to write some code here
				if(ajaxRequest.readyState == 4)
				{
					//alert(ajaxRequest.responseText);
					eval(ajaxRequest.responseText);
					//window.location = "calendar.php";
					//
				}
	}//ajax

}//show_upd
//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////
function view_e(id)
{

		//AJAX>>>>>>>>
		//AJAX>>>>>>>>
		//AJAX>>>>>>>>
		//ajax add army
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser is not working!");
				return false;
			}
		}
	}
// Create a function that will receive data sent from the server

	var actionfile = "viewevent.php?id="+id;
	ajaxRequest.open("GET", actionfile, true);
	ajaxRequest.send(null);
	ajaxRequest.onreadystatechange = function()
	{	
			// We still need to write some code here
				if(ajaxRequest.readyState == 4)
				{
					document.getElementById('eventdata').innerHTML = ajaxRequest.responseText;
					//eval(ajaxRequest.responseText);
					//window.location = "calendar.php";
					//
				}
	}//ajax

}//view_e
//////////////////////////////////////////
//////////////////////////////////////////
//////////////////////////////////////////