
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}

function sa3dwi(id) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = function()
{

if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
//alert("The server replied with: " + xmlHttp.responseText);
       var text= xmlHttp.responseText;
	 //document.getElementById("content").innerHTML="<img src='../images/loading.gif'>";
	document.getElementById("content").innerHTML=text  ;
}
}

};
document.getElementById("content").innerHTML="<center><img src='images/loading.gif'></center>";    
xmlHttp.open("GET", id , true);
xmlHttp.send(null);
}


////////////////////////////////////////////////////////

var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}

////////////////////////////////////////

function addcom(page) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = function()
{

if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
//alert("The server replied with: " + xmlHttp.responseText);
       var text= xmlHttp.responseText;
	 
	document.getElementById("coment_content").innerHTML="<img src='images/loading.gif'>";  
	document.getElementById("coment_content").innerHTML=text ;
}
}

};    
var params="op_com=" + document.getElementById("op_com").value       +"&"+ 
				    "id_art="    + document.getElementById("id_art").value              +"&"+
					"com_sender="+ document.getElementById("com_sender").value         +"&"+
					"com_title="+ document.getElementById("com_title").value            +"&"+
					"com_text="+ document.getElementById("com_text").value   ;
					
		   
xmlHttp.open("POST", page ,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
	
xmlHttp.send(params);
}

//////////////////////////////////////////////////////////////////

////////////////////////////////////////

function e_mail(id) {

createXMLHttpRequest();
xmlHttp.onreadystatechange = function()
{

if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
//alert("The server replied with: " + xmlHttp.responseText);
       var text= xmlHttp.responseText;
	 
	document.getElementById("mail_content").innerHTML="<img src='images/loading.gif'>";  
	document.getElementById("mail_content").innerHTML=text ;
}
}

};    
var params="email="    + document.getElementById("m").value   +"&"+
		   "op2="       + document.getElementById("op2").value ;           
					
		   
xmlHttp.open("POST", id ,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
	
xmlHttp.send(params);
}

//////////////////////////////////////////////////////////////////

////////////////////////////////////////

function vote(id) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = function()
{

if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {

       var text= xmlHttp.responseText;
	 
	document.getElementById("vote_content").innerHTML="<img src='images/loading.gif'>";  
	document.getElementById("vote_content").innerHTML=text ;
}
}

}; 
answer_n="";
for (var i = 0; i < document.vote_form.answer.length; i++) 
{
		if (document.vote_form.answer[i].checked) {
		    answer_n = document.vote_form.answer[i].value ;
		}
}
     if(answer_n==""){
		   document.getElementById("vote_alert").innerHTML = "<strong> يجب الضغط علي أحد الخيارات </strong>"  ;
		   return false; 
	 }
var params="answers="  + answer_n   +"&"+
		   "vote_id="  + document.getElementById("vote_id").value  +"&"+
		   "op="       + document.getElementById("op").value ;           
					
		   
xmlHttp.open("POST", id ,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
	
xmlHttp.send(params);
}

//////////////////////////////////////////////////////////////////
////////////////////////////////////////

function q(page) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = function()
{

if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
//alert("The server replied with: " + xmlHttp.responseText);
       var text= xmlHttp.responseText;
	 
	document.getElementById("q_content").innerHTML="<img src='images/loading.gif'>";  
	document.getElementById("q_content").innerHTML=text ;
}
}

};    
var params="op_faq=" + document.getElementById("op_faq").value       +"&"+ 
					"name=" + document.getElementById("name").value       +"&"+ 
				    "email="    + document.getElementById("email").value                 +"&"+
					"address="	 + document.getElementById("address").value            +"&"+
					"q_title="+ document.getElementById("q_title").value                       +"&"+
					"q_text="   + document.getElementById("q_text").value ;
		   
xmlHttp.open("POST", page ,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
	
xmlHttp.send(params);
}

//////////////////////////////////////////////////////////////////


function courselink(id) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = function()
{

if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
//alert("The server replied with: " + xmlHttp.responseText);
       var text= xmlHttp.responseText;
	 //document.getElementById("content").innerHTML="<img src='../images/loading.gif'>";
	document.getElementById("course_content").innerHTML=text  ;
}
}

};
document.getElementById("course_content").innerHTML="<center><img src='images/loading.gif'></center>";    
xmlHttp.open("GET", id , true);
xmlHttp.send(null);
}


////////////////////////////////////////////////////////
/////////////////////

///////////////  register.php /////////////////////////

function reg(page,divID) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = function()
{

if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
//alert("The server replied with: " + xmlHttp.responseText);
       var text= xmlHttp.responseText;
	 
	document.getElementById(divID).innerHTML="<img src='images/loading.gif'>";  
	document.getElementById(divID).innerHTML=text ;
}
}

};   

var params="op=" + document.getElementById("op").value     +"&"+
					"reg=" + document.getElementById("reg").value   +"&"+
					"ma_id=" + document.getElementById("ma_id").value   +"&"+
					"name=" + document.getElementById("name").value     +"&"+ 
				    "email="+ document.getElementById("email").value    +"&"+
					"class="+ document.getElementById("class").value    +"&"+
					"user="+ document.getElementById("user").value    +"&"+
					"pass="+ document.getElementById("pass").value    +"&"+					
					"bar="+ document.getElementById("bar").value ;

xmlHttp.open("POST", page ,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");

xmlHttp.send(params);
}
///////////*********************////////////////

///////////////  chat.php /////////////////////////

function chat_add(page,divID) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = function()
{

if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
//alert("The server replied with: " + xmlHttp.responseText);
       var text= xmlHttp.responseText;
	 
	document.getElementById(divID).innerHTML="<img src='images/loading.gif'>";  
	document.getElementById(divID).innerHTML=text ;
}
}

};   

var params="ma_id="  + document.getElementById("ma_id").value   	+"&"+
					"chat_id=" 	+ document.getElementById("chat_id").value   	+"&"+
					"stu_id=" 	+ document.getElementById("stu_id").value   	+"&"+
					"stu_name=" + document.getElementById("stu_name").value     +"&"+ 
					"stu_text=" + document.getElementById("stu_text").value  ;

xmlHttp.open("POST", page ,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");

xmlHttp.send(params);
}
///////////*********************////////////////
