







var xmlHttp 

var div_ch

///////////////////////////////////

////////////////////////////////////////End upload Ajax





function reload_fsl(saf_id,div_name,rename){ 

div_ch=div_name;

document.getElementById(div_ch).innerHTML="<img src='ajax/indicator.gif' border='0'>";

		xmlHttp=GetXmlHttpObject()

		if (xmlHttp==null)

		 {

		 alert ("مستعرضك لايدعم الاجاكس . استخدم انترنت اكسبلورر6 أو اعلى")

		 return

		 }



		var url="ajax/gets.php"

		url=url+"?ajax="+"reload_fsl"

		url=url+"&saf_id="+saf_id

		url=url+"&cmp_name="+rename

		url=url+"&sid="+Math.random()

		

		xmlHttp.onreadystatechange=stateChanged

		

		xmlHttp.open("GET",url,true)

		xmlHttp.send(null)

}











function ajx_send_gets(page,ajx_fun,div_name){ 

div_ch=div_name;



document.getElementById(div_ch).innerHTML="<img src='ajax/indicator.gif' border='0'>";

		xmlHttp=GetXmlHttpObject()

		if (xmlHttp==null)

		 {

		 alert ("مستعرضك لايدعم الاجاكس . استخدم انترنت اكسبلورر6 أو اعلى")

		 return

		 }



		var url=page

		url=url+"?ajax="+ajx_fun

		url=url+"&sid="+Math.random()

		

		xmlHttp.onreadystatechange=stateChanged

		

		xmlHttp.open("GET",url,false)

		xmlHttp.send(null)

}

///////// this is public for all site ... at 8/11/2007

function ajx_send_gets_2(page,div_name,pic_wait){ 

div_ch=div_name;

document.getElementById(div_ch).innerHTML="<img src='"+ pic_wait +"' border='0'>";

		xmlHttp=GetXmlHttpObject()

		if (xmlHttp==null)

		 {

		 alert ("مستعرضك لايدعم الاجاكس . استخدم انترنت اكسبلورر6 أو اعلى")

		 return

		 }



		var url=page

		url=url+"&sid="+Math.random()

		

		xmlHttp.onreadystatechange=stateChanged

		

		xmlHttp.open("GET",url,false)

		xmlHttp.send(null)

}



/////////////////$$$$$$$$$$##############################################

function stateChanged() { 

	//alert(div_ch);

	//var obj = document.getElementById('txt'+div_name) ;

		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 

			document.getElementById(div_ch).innerHTML=xmlHttp.responseText 

		 } 

}



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;

}





function buildPOST(theFormName,with_encode) { 

    theForm = document.forms[theFormName]; 

   //theForm=document.getElementById(theFormName);

	//alert(theForm);

    var qs = '' 

    for (e=0;e<theForm.elements.length;e++) { 

        if (theForm.elements[e].name!='') { 

            var name = theForm.elements[e].name; 

            qs+=(qs=='')?'':'&' 

			if (with_encode==1){

            qs+= name+'='+escape(encodeURI(theForm.elements[e].value)); 

			}else{

            qs+= name+'='+((theForm.elements[e].value)); 

			}

        } 

    } 

    qs+="\n"; 

	

    return qs 

	

} 





function send_post(theFormName,page,div_name) { 



div_ch=div_name;



      xmlHttp=GetXmlHttpObject()



 var xmlMessage = buildPOST(theFormName,1);

    

	//var xmlDoc=xmlHttp.responseText;

	var url=page;

	

	xmlHttp.onreadystatechange=stateChanged

    xmlHttp.open("POST", url, true) 

    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=windows-1256");

    xmlHttp.send(xmlMessage)





	

} 





