var please_wait = "جاري التحميل";

function open_url(url, target) {
 	if ( ! document.getElementById) {
  		return false;
 	}

 	if (please_wait != null) {
  		document.getElementById(target).innerHTML = '<img scr="http://localhost/ajax+php_2/images/loading.gif" alt="جاري التحميل" />';
 	}

// if Mozilla, Safari etc
  if (window.XMLHttpRequest) 
    link = new XMLHttpRequest()
  // if IE
  else if (window.ActiveXObject){ 
    try {
      link = new ActiveXObject("Msxml2.XMLHTTP")
    } 
    catch (e){
      try{ link = new ActiveXObject("Microsoft.XMLHTTP") }catch (e){}
    }
  }else{
    alert('This Browser do not support AJAX-Technology!');
    return ;
  }
  
 	if (link == undefined) {
  		return false;
 	}
 	link.onreadystatechange = function() { response(url, target); }
 	link.open("GET", url, true);
 	link.send(url);
}

function response(url, target) {
 	if (link.readyState == 4) {
	 	document.getElementById(target).innerHTML = (link.status == 200) ? link.responseText : "أووبس! رابط معطوب ، نرجو الاتصال بنا وإخبارنا بالخلل .. شكراً لتعاونك :) ";
	}
}

function set_loading_message(msg) {
 	please_wait = msg;
}
