//CREATE GLOBAL VARIABLES
	var xmlHttp;
	var xmlHttp2;
	

//AJAX BASIC FUNCTIONS=================================================================
	var passedOk = false;
	function showBox(url, getString, thisBoxId, showLoad)
	{
		if(!showLoad) var showLoad = false;
		
		xmlHttp=GetXmlHttpObject();
	    if (xmlHttp==null)
	  	{
		  alert ("Your browser does not support AJAX!");
		  return;
	  	} 
		
		url=url+"?sid="+Math.random();
		if(getString)
		{
			url=url+getString;
		}
		
		xmlHttp.onreadystatechange=function(){
			//alert("readystate: "+xmlHttp.readyState)
			if (xmlHttp.readyState==4)
			{ 
				document.getElementById(thisBoxId).innerHTML=xmlHttp.responseText;
				passedOk = true;
			}
			else if(showLoad == true) {
				document.getElementById(thisBoxId).innerHTML="LOADING.";
			}
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		return(passedOk);
		
	} 
	
	function hiddenCall(url)
	{
		
		xmlHttp=GetXmlHttpObject();
	    if (xmlHttp==null)
	  	{
		  alert ("Your browser does not support AJAX!");
		  return;
	  	} 
		
		url=url+"?sid="+Math.random();
		
		xmlHttp.onreadystatechange=function(){
			//alert("readystate: "+xmlHttp.readyState)
			if (xmlHttp.readyState==4)
			{ 
				//document.getElementById(thisBoxId).innerHTML=xmlHttp.responseText;
				passedOk = true;
			}
			else if(showLoad == true) {
				//document.getElementById(thisBoxId).innerHTML="LOADING.";
			}
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		return(passedOk);
		
	} 
	

	function showBoxFunc(url, getString, thisBoxId, showLoad, func)
	{
		if(!showLoad) var showLoad = false;
		
		xmlHttp=GetXmlHttpObject();
	    if (xmlHttp==null)
	  	{
		  alert ("Your browser does not support AJAX!");
		  return;
	  	} 
		
		url=url+"?sid="+Math.random();
		if(getString)
		{
			url=url+getString;
		}
		xmlHttp.onreadystatechange=function(){
			if (xmlHttp.readyState==4)
			{ 
				document.getElementById(thisBoxId).innerHTML=xmlHttp.responseText;
				func();
			}
			else if(showLoad == true) {
				document.getElementById(thisBoxId).innerHTML="LOADING.";
			}
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	} 
	
	function showDropDown(url, getString, thisDropDownId, showLoad)
	{
		if(!showLoad) var showLoad = false;
		
		xmlHttp=GetXmlHttpObject();
	    if (xmlHttp==null)
	  	{
		  alert ("Your browser does not support AJAX!");
		  return;
	  	} 
		
		url=url+"?sid="+Math.random();
		if(getString)
		{
			url=url+getString;
		}
		
		var parseStr = '';
		xmlHttp.onreadystatechange=function(){
			if (xmlHttp.readyState==4)
			{ 
				parseStr =  xmlHttp.responseText;
				var OptionsArr = parseStr.split(',');
				if (OptionsArr.length == 0) 
				{
					var opt = new Option('Upload file(s) to populate list.', '', true, true);
					document.getElementById(thisDropDownId).options[0] = opt;
				}
				for (i=0; i<OptionsArr.length -1; i++)
				{
					if (OptionsArr[i].replace(' ','') != ''); 
					{
						var selected = false;
						if (OptionsArr[i].indexOf("*") > -1) 
						{
							selected = true;
						}
						var opt = new Option(OptionsArr[i]+'Arthur', OptionsArr[i]+'Arthur', selected, selected);
						document.getElementById(thisDropDownId).options[i] = opt;
					}
				}
			}
			else if(showLoad == true) {
				var opt = new Option('Loading...', '', true, true);
				document.getElementById(thisDropDownId).options[0] = opt;
			}
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	} 
	
	function showBox2(url, getString, thisBoxId, showLoad)
	{
		if(!showLoad) var showLoad = false;
		xmlHttp2=GetXmlHttpObject();
	    if (xmlHttp==null)
	  	{
		  alert ("Your browser does not support AJAX!");
		  return;
	  	} 
		
		url=url+"?sid="+Math.random();
		if(getString)
		{
			url=url+getString;
		}
		xmlHttp2.onreadystatechange=function(){
			if (xmlHttp2.readyState==4)
			{ 
				try {
					document.getElementById(thisBoxId).innerHTML = xmlHttp2.responseText;
				}catch(e){
					
				}
			}
			else if(showLoad == true){
				document.getElementById(thisBoxId).innerHTML="LOADING.";
			}
		}
		xmlHttp2.open("GET",url,true);
		xmlHttp2.send(null);
	} 
	
	function simpleResponse(url, getString) //simple text based response
	{
		var myVar;
		if(!showLoad) var showLoad = false;
		
		xmlHttp=GetXmlHttpObject();
	    if (xmlHttp==null)
	  	{
		  alert ("Your browser does not support AJAX!");
		  return;
	  	} 
		
		url=url+"?sid="+Math.random();
		if(getString)
		{
			url=url+getString;
		}
		xmlHttp.onreadystatechange=function(){
			if (xmlHttp.readyState==4)
			{ 
				myVar=xmlHttp.responseText;
			}
			
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		
		return myVar;
	}
	
	function simpleAJAXCall(url, getString, thisBoxId, showLoad) // JUST RETURNS TRUE OR FALSE AS TEXT
	{
		this.boolReturn = false;
		xmlHttp=GetXmlHttpObject();
	    if (xmlHttp==null)
	  	{
		  alert ("Your browser does not support AJAX!");
		  return;
	  	} 
		
		url=url+"?sid="+Math.random();
		if(getString)
		{
			url=url+getString;
		}
		xmlHttp.onreadystatechange=function(){
			if (xmlHttp.readyState==4)
			{ 
				if (xmlHttp.responseText.replace(' ','') != '');
				{
					document.getElementById(thisBoxId).InnerHTML = xmlHttp.responseText;
					this.boolReturn = true;
				}
			}
			else
			{
				document.getElementById(thisBoxId).InnerHTML = 'Loading...';
			}
			
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		return this.boolReturn;
	} 
	
	function showConseq(f1, f2)
	{
		var ok = f1();

		if (ok)
		{
			f2();
		}
	}
	
	function getStudentName(){
		var studentName = document.getElementById("studentName").value;
		return studentName;
		
	}
	
	function evaluateStudentAdd(){
		
	}
	//==================================================================================
	
	//==================================================================================
	
	
	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;
	}
	//==================================================================================


	

