var img = '<img src="images/Loading.gif">'; 
var msg = '<br>أنتظر'; 

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no) 
var loadedobjects="" 
var bustcacheparameter="" 

function include(url, containerid){ 
document.getElementById(containerid).innerHTML = img+msg;  
var page_request = false 
if (window.XMLHttpRequest) // if Mozilla, Safari etc 
page_request = new XMLHttpRequest() 
else if (window.ActiveXObject){ // if IE 
try { 
page_request = new ActiveXObject("Msxml2.XMLHTTP") 
}  
catch (e){ 
try{ 
page_request = new ActiveXObject("Microsoft.XMLHTTP") 
} 
catch (e){} 
} 
} 
else 
return false 
page_request.onreadystatechange=function(){ 
loadpage(page_request, containerid) 
} 
if (bustcachevar) //if bust caching of external page 
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime() 
page_request.open('GET', url+bustcacheparameter, true) 
page_request.send(null) 
} 

function loadpage(page_request, containerid){ 
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) 
document.getElementById(containerid).innerHTML=page_request.responseText 
} 

function loadobjs(){ 
if (!document.getElementById) 
return 
for (i=0; i<arguments.length; i++){ 
var file=arguments[i] 
var fileref="" 
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding 
if (file.indexOf(".js")!=-1){ //If object is a js file 
fileref=document.createElement('script') 
fileref.setAttribute("type","text/javascript"); 
fileref.setAttribute("src", file); 
} 
else if (file.indexOf(".css")!=-1){ //If object is a css file 
fileref=document.createElement("link") 
fileref.setAttribute("rel", "stylesheet"); 
fileref.setAttribute("type", "text/css"); 
fileref.setAttribute("href", file); 
} 
} 
if (fileref!=""){ 
document.getElementsByTagName("head").item(0).appendChild(fileref) 
loadedobjects+=file+" " //Remember this object as being already added to page 
} 
} 
} 
function submitonce(theform){
if (document.all||document.getElementById){
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
tempobj.disabled=true
}
}
}


var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);
}


function check(f){ 
if (f.name.value =="" ) { 
  alert("من فضلك أدخل اسمك"); 
  f.name.focus(); 
  f.name.style.color="#EE2830";
  f.name.style.background="#FFE8E8";
  f.email.style.background="#FFFFFF";
  f.web.style.background="#FFFFFF";
  f.text.style.background="#FFFFFF";
  return false; 
 } 
  
 if (f.email.value =="" ) { 
  alert("من فضلك أدخل بريدك الالكتروني"); 
   f.email.style.background="#FFE8E8";
   f.name.style.background="#FFFFFF";
   f.web.style.background="#FFFFFF";
   f.text.style.background="#FFFFFF";
  return false; 
 } 
 ReAddr=/([a-zA-Z0-9_\-])+@([a-zA-Z0-9_\-])+\.([a-zA-Z])+/g; 
 if(! (ReAddr.exec(f.email.value) ) ){ 
   alert("بريدك الالكتروني غير صحيح"); 
   f.email.focus(); 
   f.email.style.color="#EE2830";
   f.email.style.background="#FFE8E8";
   f.name.style.background="#FFFFFF";
   f.web.style.background="#FFFFFF";
   f.text.style.background="#FFFFFF";
   return false; 
 }  

if (f.web.value =="" ) { 
  alert("من فضلك أدخل موقعك المفضل"); 
  f.web.focus(); 
  f.web.style.color="#EE2830"; 
  f.web.style.background="#FFE8E8";
  f.name.style.background="#FFFFFF";
  f.email.style.background="#FFFFFF";
  f.text.style.background="#FFFFFF";
  return false; 
 } 
  

if (f.text.value =="" ) { 
  alert("لقد نسيت أن تكتب تعليقك !!"); 
  f.text.focus(); 
  f.text.style.color="#EE2830";
  f.text.style.background="#FFE8E8";
  f.name.style.background="#FFFFFF";
  f.email.style.background="#FFFFFF";
  f.web.style.background="#FFFFFF";
  return false; 
 } 

} 

 function smiley(s){
  document.send.text.value = document.send.text.value + s;
  document.send.text.focus();
}
//--> 

function checkx(f){ 
if (f.xname.value =="" ) { 
  alert("من فضلك أدخل اسمك"); 
  f.xname.focus(); 
f.xname.style.color="#EE2830";
f.xname.style.background="#FFE8E8";



  return false; 
 } 
  
 if (f.email.value =="" ) { 
  alert("من فضلك أدخل بريدك الالكتروني"); 
  f.email.style.color="#EE2830";
  f.email.style.background="#FFE8E8";
  return false; 
 } 
 ReAddr=/([a-zA-Z0-9_\-])+@([a-zA-Z0-9_\-])+\.([a-zA-Z])+/g; 
 if(! (ReAddr.exec(f.email.value) ) ){ 
   alert("بريدك الالكتروني غير صحيح"); 
   f.email.focus(); 
   f.email.style.color="#EE2830"; 
   f.email.style.background="#FFE8E8";
   return false; 
 } 

if (f.xmail.value =="" ) { 
  alert("من فضلك أدخل بريد صديقك الالكتروني"); 
  return false; 
 } 
 ReAddr=/([a-zA-Z0-9_\-])+@([a-zA-Z0-9_\-])+\.([a-zA-Z])+/g; 
 if(! (ReAddr.exec(f.xmail.value) ) ){ 
   alert("بريد صديقك الالكتروني غير صحيح"); 
   f.xmail.focus(); 
   f.xmail.style.color="#EE2830"; 
   f.xmail.style.background="#FFE8E8";
   return false; 
 }

if (f.msg.value =="" ) { 
  alert("لقد نسيت أن تكتب رسالتك !!"); 
   f.msg.focus(); 
   f.msg.style.color="#EE2830"; 
   f.msg.style.background="#FFE8E8";
  return false; 
 } 

}
//--> 
