/* The following function creates an XMLHttpRequest object... */

function createRequestObject(){
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		/* Create the object using MSIE's method */
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	}
	return request_o; //return the object
}

/* You can get more specific with version information by using 
	parseInt(navigator.appVersion)
	Which will extract an integer value containing the version 
	of the browser being used.
*/
/* The variable http will hold our new XMLHttpRequest object. */
var http = createRequestObject();
var http2 = createRequestObject();

/* Function called to get the product categories list */

function disableThis(id){
	document.getElementById(id).innerHTML = "<font face=Verdana size=1>busy</font>";
}

function hideThis(id){
	document.getElementById(id).style.visibility='hidden';
}

function UnhideThis(id){
	document.getElementById(id).style.visibility='visible';
}

function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.visibility == 'hidden')
          e.style.visibility = 'visible';
       else
          e.style.visibility = 'hidden';
    }


function ttLayer(dow, period, m_class) {
  //if (!document.getElementsById) return false;
  var myLayer = document.getElementById('Edit_Layer');
  
  myLayer.style.visibility='visible';
  document.edit_form.dow.value = dow + 1;
  document.edit_form.period.value = period;
  
  document.edit_form.tt_edit_select_class.options[m_class].selected = true; 
}

function myLoadURL(url){
	
	http.open('get', url);
	var str = "";

	make_tinymce('elm1');
	http.onreadystatechange = handleUrl; 
	http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); 
	http.send(str);
}

function myLoadToMain(url){
	http.open('get', url);
	var str = "";
	http.onreadystatechange = handleUrl; 
	http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); 
	http.send(str);
}

function myLoadToMain2(url, post){
	
	http.open('POST', url);
	var str = post;
	//alert(str);
	http.onreadystatechange = handleUrl; 
	http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); 
	http.send(str);
}

function myLoadMenu(url){
	
	http2.open('get', url);
	var str = "";
	http2.onreadystatechange = handleLoadMenu; 
	http2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); 
	http2.send(str);
}


function handlemyload(){
	if(http.readyState == 4){ //Finished loading the response
		var response = http.responseText;
		document.getElementById('logon_cage').innerHTML = response;
		document.getElementById('main_cage').innerHTML = "Welcome.";
	}
}




function handleRes(){

	if(http.readyState == 4){ //Finished loading the response
		
		var response = http.responseText;		
		document.getElementById('MainLayer').innerHTML = response;
	}
}


function handleLoadMenu(){

	if(http2.readyState == 4){ //Finished loading the response
		
		var response = http2.responseText;		
		document.getElementById('MenuLayer').innerHTML = response;
	}
}


function handleUrl(){
	if(http.readyState == 4) { //Finished loading the response
	
		var response = http.responseText;
		document.getElementById('MainLayer').innerHTML = response;
		document.getElementById('LoadingLayer').style.visibility='hidden';
	} else { }
}

function ResetPostReview(){
	http.open('POST', 'homework_include_review.php');

	var str = "";
	http.onreadystatechange = HandleResetPostReview; 
	http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); 
	http.send(str);
}





