// holds an instance of XMLHttpRequest

var xmlHttp = createXmlHttpRequestObject();
var globalAction = ""; 	// keeps track of which operation is currently being done
var globalIDNum = 0; 	// keeps track of which record ID is being operated on

// creates an XMLHttpRequest instance

function createXmlHttpRequestObject()
{
	var xmlHttp;	// reference to the XMLHttpRequest object
	
	// Create the XMLHttpRequest Object for all versions of IE up to and including IE6
	try
	{
		// try to create XMLHttpRequest object
		
		xmlHttp = new XMLHttpRequest();
	}
	
	catch(e)
	{
		// assume IE6 or older
		
		var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP");
		
		// try every ID until on works
		
		for (var i=0; i < XmlHttpVersions.length && !xmlHttp; i++)
		{
			try
			{
				// try to create the XMLHttpRequest object
				
				xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
				
			}
			catch(e){}
		}
	}
		
	// return the created object or display an error message
		
	if(!xmlHttp)
	{
		alert("Error creating the XMLHttpRequest object.");
	}
	else
	{
		return xmlHttp;
	}
}

// called to read a file from the server



function process(action,IDNum, IDNum2)
{
	// only continue if xmlHttp isn't void
	if(xmlHttp)
	{
		globalAction = action;				// Set the globalAction
		globalIDNum = IDNum;				// Set the globalIDNum
		globalIDNum2 = IDNum2;				// Set the globalIDNum
		// try to connect to the server
		
		try
		{
			
			// Change the div contents from plain text to a Select Box
			if(action == "text2select")
			{				
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "updateDB.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.
							
				var params = "action=" + action + "&ID=" + globalIDNum; // The list of parameters to be passed
							
				xmlHttp.open(method,url,async);	// Opens the asynchronous connection to the server-side page
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				
				xmlHttp.send(params);	// Set to the parameter list (as a string) being
										// passed to the server-side script If using the "GET"
										//method, this should be set to null
																			
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
			}
			
			if(action == "Update")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "updateDB.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				var doc = document.Status; // reference the form being used
				//var selStatus = "fldEmail" + globalIDNum;
				var selStatus = "fldEmail";
				//var newStatus = document.getElementById(selStatus).value;
				var newStatus = document.getElementById(selStatus).value;
				var params = "action=" + action + "&ID=" + globalIDNum; // The list of parameters to be passed
			
				xmlHttp.open(method,url,async);	// Opens the asynchronous connection to the server-side page
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				
				xmlHttp.send(params);	// Set to the parameter list (as a string) being
										// passed to the server-side script If using the "GET"
										//method, this should be set to null
																			
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change

			}
			
			if(action == "RegisterPage")
			{
				//window.location = "register.php";
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "cms.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldEmail";
				var content_type = "RegisterPage";
				var params = "action=" + globalAction + "&content=" + content_type; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "LoginPage")
			{
				//window.location = "register.php";
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "cms.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldEmail";
				var content_type = "LoginPage";
				var params = "action=" + globalAction + "&content=" + content_type; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "Logout")
			{
				//window.location = "register.php";
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "cms.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldEmail";
				var content_type = "Logout";
				var params = "action=" + globalAction + "&content=" + content_type; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "NewAccount")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "confirmRegister.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				var doc = document.Status; // reference the form being used
				var selStatus = "fldEmail";
				var checkEmail = document.getElementById(selStatus).value;
				var username = document.getElementById("fldUsername").value;
				var account_password = document.getElementById("fldPassword").value;
				var params = "action=" + globalAction + "&checkEmail=" + checkEmail + "&username=" + username + "&account_password=" + account_password; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "ConfirmVideo")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "confirmVideo.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				var doc = document.Status; // reference the form being used				
				var title = document.getElementById("fldTitle").value;
				var tags = document.getElementById("fldTags").value;
				var code = document.getElementById("fldCode").value;
				var category = document.getElementById("fldCategory").value;
				var params = "action=" + globalAction + "&title=" + title + "&tags=" + tags + "&code=" + code + "&category=" + category; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "UpdateAccountDetails")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "confirmUpdateAccount.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				var doc = document.Status; // reference the form being used				
				var email = document.getElementById("fldEmail").value;
				var photo = document.getElementById("fldPhoto").value;
				var fldInteresting = document.getElementById("fldInteresting").value;
				var fvideo = document.getElementById("fldFURL").value;
				var furl = document.getElementById("fldPhoto").value;
				var ftags = document.getElementById("fldFTags").value;
				var real_name = document.getElementById("fldRName").value;
				var public_email = document.getElementById("fldPEmail").value;
				var homepage = document.getElementById("fldHomepage").value;
				var aim = document.getElementById("fldAim").value;
				var msn = document.getElementById("fldMsn").value;
				var yahoo = document.getElementById("fldYahoo").value;
				var googletalk = document.getElementById("fldGoogle").value;
				var skype = document.getElementById("fldSkype").value;
				var irc = document.getElementById("fldIRC").value;
				var account_password = document.getElementById("fldPassword").value;
				
				var params = "action=" + globalAction + "&email=" + email + "&photo=" + photo + "&fldInteresting=" + fldInteresting + "&fvideo=" + fvideo + "&furl=" + furl + "&ftags=" + ftags + "&public_email=" + public_email + "&real_name=" + real_name + "&homepage=" + homepage + "&aim=" + aim + "&msn=" + msn + "&yahoo=" + yahoo + "&googletalk=" + googletalk + "&skype=" + skype + "&irc=" + checkEmail + "&account_password=" + account_password; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			
			if(action == "Terms")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "cms.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldEmail";
				var content_type = "Terms";
				var params = "action=" + globalAction + "&content=" + content_type; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			
			
			if(action == "Privacy")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "cms.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldEmail";
				var content_type = "Privacy";
				var params = "action=" + globalAction + "&content=" + content_type; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "FAQ")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "cms.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldEmail";
				var content_type = "FAQ";
				var params = "action=" + globalAction + "&content=" + content_type; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "About Us")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "cms.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldEmail";
				var content_type = "About Us";
				var params = "action=" + globalAction + "&content=" + content_type; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "Contact Us")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "cms.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldEmail";
				var content_type = "Contact Us";
				var params = "action=" + globalAction + "&content=" + content_type; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "Announcements")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "cms.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldEmail";
				var content_type = "Announcements";
				var params = "action=" + globalAction + "&content=" + content_type; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "News")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "cms.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldEmail";
				var content_type = "News";
				var params = "action=" + globalAction + "&content=" + content_type; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "VerifyDiscipline1")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkUsername.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				var doc = document.form; // reference the form being used
				var selStatus = "t_discipline1";
				var checkEmail = document.getElementById(selStatus).value;
				var params = "action=" + globalAction + "&checkUsername=" + checkEmail; // Parameters to be passed.			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
				
			if(action == "VerifyDiscipline2")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkUsername2.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				var doc = document.form; // reference the form being used
				var selStatus = "t_discipline2";
				var checkEmail = document.getElementById(selStatus).value;
				var params = "action=" + globalAction + "&checkUsername2=" + checkEmail; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			
			if(action == "VerifyDiscipline3")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkUsername3.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				var doc = document.form; // reference the form being used
				var selStatus = "t_discipline3";
				var checkEmail = document.getElementById(selStatus).value;
				var params = "action=" + globalAction + "&checkUsername3=" + checkEmail; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			
			if(action == "discipline1")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkUsername.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				var doc = document.form; // reference the form being used
				var selStatus = "discipline1";
				var checkEmail = document.getElementById(discipline1).value;
				var params = "action=" + globalAction + "&discipline1=" + checkEmail; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "Vote")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "CastVote.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldUsername";
				//var checkEmail = document.getElementById(selStatus).value;
				var params = "action=" + globalAction + "&video_id=" + globalIDNum; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "SubmitComment")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "ConfirmComment.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				var doc = document.Status; // reference the form being used
				//var selStatus = "fldUsername";
				var comment = document.getElementById("fldComment").value;
				var video_id = globalIDNum
				var member_id = globalIDNum2
				var params = "action=" + globalAction + "&video_id=" + video_id + "&comment=" + comment + "&member_id=" + member_id; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "PostComment1")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldUsername";
				//var checkEmail = document.getElementById(selStatus).value;
				var params = "action=" + globalAction + "&video_id=" + globalIDNum + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "Comments")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				//var doc = document.Status; // reference the form being used
				//var selStatus = "fldUsername";
				//var checkEmail = document.getElementById(selStatus).value;
				var video_id = globalIDNum;
				var params = "action=" + globalAction + "&video_id=" + video_id + "&page=" + globalAction;; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "VerifyEmail")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkEmail.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				var doc = document.Status; // reference the form being used
				var selStatus = "fldEmail";
				var checkEmail = document.getElementById(selStatus).value;
				var params = "action=" + globalAction + "&checkEmail=" + checkEmail; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "Login")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkLogin.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				var doc = document.Status; // reference the form being used
				var selStatus = "fldUsername";
				var checkUsername = document.getElementById(selStatus).value;				
				var account_password = document.getElementById("fldPassword").value;
				var params = "action=" + globalAction + "&checkUsername=" + checkUsername + "&account_password=" + account_password; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "ForgotPassword")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "ForgotPassword.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				var doc = document.ForgotPasswordFrm; // reference the form being used				
				var checkUsername = document.getElementById("fldUsername1").value;				
				var params = "action=" + globalAction + "&checkUsername=" + checkUsername; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "MyProfile")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "VideosSubmitted")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "SubmitVideo")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "PostComment")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "Homepage")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "RecentVideos")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "TopRated")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "member2")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "VideosSubmittedUser")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction + "&member_id=" + globalIDNum; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "VideosPublished")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "VideosPublishedUser")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction + "&member_id=" + globalIDNum; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			

			
			if(action == "VideosVoted")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "VideosVotedUser")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.
				
				var params = "action=" + globalAction + "&page=" + globalAction + "&member_id=" + globalIDNum; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "MyArea")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "User")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction + "&member_id=" + globalIDNum; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
			if(action == "UpdateProfile")
			{
				// Connect asynchonously to the php to update database
				var method = "POST";		// Set to the method ("GET" or "POST") used to pass variables to the server-side page
				var url = "checkPage.php";	// Set to the url of the server-side page being connected to
				var async = true;			// Setting this argument to true is the backbone of AJAX. It allows for connecting to 
											// a server-side page for processing asynchronously.

				
				var params = "action=" + globalAction + "&page=" + globalAction; // Parameters to be passed.
			
				xmlHttp.open(method, url, async);
				xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	// Set the Content-Type Header
				xmlHttp.onreadystatechange = handleStateChange;	// Set to the function that will handle the state change
				xmlHttp.send(params);	// Set to the parameter list (as a string) being passed to the server-side script
										// If using the "GET" method, this should be set to null.

			}
			
		}
		
		// display the error in case of failure
		catch(e)
		{
			alert("Can't connect to server:\n" + e.toString());
		}
	}
}

// function that handles the response from the HttpRequestObject
function handleStateChange()
{
	// We wait until the server is ready to respond
	if(xmlHttp.readyState == 4)
	{
		// only continue if status is 200 or OK
		if(xmlHttp.status == 200)
		{
			try
			{
				// Handle the server's response
				
				// Change the div Text to a Select Box
				if(globalAction == "text2select")
				{
					//var divName = document.getElementById("textDiv" + globalIDNum);	// Aquire reference to targeted Div tag
					//divName.innerHTML = xmlHttp.responseText;			// Set content of the targeted Div to the value sent back from
																		// the server-side page
					var divName = document.getElementById("textDiv");					
					divName.innerHTML = '<div id="textDiv">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "Update")
				{
					
					var divName = document.getElementById("textDiv");					
					divName.innerHTML = '<div id="textDiv">' + xmlHttp.responseText + '</div>';
					//var divName = document.getElementById("textDiv" + globalIDNum);					
					//divName.innerHTML = '<div id="textDiv' + globalIDNum + '"><div onClick="process(\'text2select\',' + globalIDNum + ')">' + xmlHttp.responseText + '</div></div>';					
				}
				
				if(globalAction == "NewAccount")
				{
					
				
					if(xmlHttp.responseText == "already")
					{
						var divName = document.getElementById("textDiv");					
						divName.innerHTML = '<div id="textDiv"><font face="Verdana" color="660000">An account already exisits with the email you have provided!</div>';
					}
					
					if(xmlHttp.responseText == "done")
					{
						var divName = document.getElementById("newaccount");					
						divName.innerHTML = '<div id="newaccount"><strong><font color="#336633" size="2" face="Verdana, Arial, Helvetica, sans-serif">Congratulations....</font></strong><br><br><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">You have signed up for your DailyStew.com Account Successfully!!!!<br><br></font></strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Proceed to <a href="login.php">Login Area</a></font><br></div>';
						
						var divName1 = document.getElementById("reg_form");					
						divName1.innerHTML = '<div id="reg_form"></div>';
					}
					//var divName = document.getElementById("textDiv");					
					//divName.innerHTML = '<div id="textDiv">' + xmlHttp.responseText + '</div>';
					
				}
				
				if(globalAction == "Terms")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "SubmitVideo")
				{					
				
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';
					
				}
				
				if(globalAction == "Privacy")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "FAQ")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "About Us")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "RegisterPage")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "LoginPage")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';
					
					var divName = document.getElementById("JoinLink");					
					divName.innerHTML = '<div id="JoinLink">JOIN NOW</div>';
						
					var divName = document.getElementById("LoginLink");					
					divName.innerHTML = '<div id="LoginLink">LOGIN</div>';
				}
				
				if(globalAction == "Logout")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "Contact Us")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "Announcements")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "News")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "VerifyDiscipline1")
				{
					var divName = document.getElementById("UsernameStatus");					
					divName.innerHTML = '<div id="UsernameStatus">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "VerifyDiscipline2")
				{
					var divName = document.getElementById("UsernameStatus2");					
					divName.innerHTML = '<div id="UsernameStatus2">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "VerifyDiscipline3")
				{
					var divName = document.getElementById("UsernameStatus3");					
					divName.innerHTML = '<div id="UsernameStatus3">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "discipline1")
				{
					var divName = document.getElementById("UsernameStatus");					
					divName.innerHTML = '<div id="UsernameStatus">' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "VerifyEmail")
				{
					var divName = document.getElementById("EmailStatus");					
					divName.innerHTML = '<div id="EmailStatus"><b>Status: </b>' + xmlHttp.responseText + '</div>';
				}				
				
				
				if(globalAction == "Login")
				{
					if(xmlHttp.responseText == "notfound")
					{
						var divName = document.getElementById("textDiv");					
						divName.innerHTML = '<div id="textDiv"><center><font face="Verdana" face="2" color="#660000">Invalid Username or Password!</center></div>';
					}
					
					else
					{

						window.location = "MyProfile.php";
					}
					
					//var divName = document.getElementById("textDiv");					
					//divName.innerHTML = '<div id="textDiv"><b>Status: </b>' + xmlHttp.responseText + '</div>';
				}
				
				if(globalAction == "MyProfile")
				{
					//window.location = "MyProfile.php";					
					var divName = document.getElementById("Published");					
					divName.innerHTML = '<div id="Published"></div>';
				}
				
				if(globalAction == "VideosSubmitted")
				{
					//window.location = "VideosSubmitted.php";					
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';					
				}
				
				if(globalAction == "Homepage")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';					
					
				}
				
				if(globalAction == "RecentVideos")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';					
					
				}
				
				if(globalAction == "TopRated")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';					
					
				}
				
				if(globalAction == "member2")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';					
					
				}
				
				if(globalAction == "VideosSubmittedUser")
				{
					//window.location = "VideosSubmitted.php";					
					var divName = document.getElementById("Information");					
					divName.innerHTML = '<div id="Information">' + xmlHttp.responseText + '</div>';					
				}
				
				if(globalAction == "VideosPublished")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';										
				}
				
				if(globalAction == "VideosPublishedUser")
				{
					var divName = document.getElementById("Information");					
					divName.innerHTML = '<div id="Information">' + xmlHttp.responseText + '</div>';										
				}
				
				if(globalAction == "VideosVoted")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';					
					
				}
				
				if(globalAction == "VideosVotedUser")
				{
					var divName = document.getElementById("Information");					
					divName.innerHTML = '<div id="Information">' + xmlHttp.responseText + '</div>';					
					
				}
				
				if(globalAction == "MyArea")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';					
					
				}
				
				if(globalAction == "PostComment")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';					
					
				}
				
				if(globalAction == "SubmitComment")
				{
					var divName = document.getElementById("CommentStatus");					
					divName.innerHTML = '<div id="CommentStatus"><font color="#660000">Your comment has been posted successfully!</font></div>';					
					
				}
				
				if(globalAction == "PostComment1")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';					
					
				}
				
				if(globalAction == "Comments")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';					
					
				}
				
				if(globalAction == "User")
				{
					var divName = document.getElementById("Information");					
					divName.innerHTML = '<div id="Information">' + xmlHttp.responseText + '</div>';					
					
				}
				
				if(globalAction == "UpdateProfile")
				{
					var divName = document.getElementById("Main");					
					divName.innerHTML = '<div id="Main">' + xmlHttp.responseText + '</div>';					
					
				}
				if(globalAction == "UpdateAccountDetails")
				{					
				
					if(xmlHttp.responseText == "done")
					{
						var divName = document.getElementById("UpdateStatus");					
						divName.innerHTML = '<div id="UpdateStatus"><center><font color="#660000">Your Account Details have been updated!</font></center></div>';
						
					}
					
				}
				
				if(globalAction == "ConfirmVideo")
				{
					if(xmlHttp.responseText == "done")
					{
						var divName = document.getElementById("SubmissionStatus");					
						divName.innerHTML = '<div id="SubmissionStatus"><span class="style6"><font color="#660000"><font size="+1">Congratulations....</font></font></span> <span class="style7"><br><font color="000000">Your video has been sent for Submission!!!!<br>Administrator will review and confirm your video submission shortly....</font></span></div>';
						
						
						var divName1 = document.getElementById("video_submit");					
						divName1.innerHTML = '<div id="video_submit"></div>';
					}					
					
				}
				
				if(globalAction == "Vote")
				{
					
						var divName = document.getElementById("Video" + globalIDNum);					
						divName.innerHTML = '<div id="Video" + globalIDNum>' + xmlHttp.responseText + '</div>';										
			
				}
				
				
				
				if(globalAction == "ForgotPassword")
				{
					if(xmlHttp.responseText == "notfound")
					{
						var divName = document.getElementById("ForgotPasswordStatus");					
						divName.innerHTML = '<div id="ForgotPasswordStatus"><center><font face="Verdana" face="2">Invalid Username!</center></div>';
					}
					
					if(xmlHttp.responseText == "ok")
					{
						var divName = document.getElementById("ForgotPasswordStatus");					
						divName.innerHTML = '<div id="ForgotPasswordStatus"><center><font face="Verdana" face="2">Your password has been sent to the email address you registered with!</font></center></div>';
					}
					
				}


			}
			catch(e)
			{
				// display error message
				alert("Error reading the response: " + e.toString());
			}
		}
		else
		{
			// display status message
			alert("There was a problem retrieving the data:\n" + xmlHttp.statusText);
		}
	}
}