if(navigator.appName == "Microsoft Internet Explorer"){
	var contact = new ActiveXObject("Microsoft.XMLHTTP");
}else{
	var contact = new XMLHttpRequest();
}

function docontact()
{
	      if (document.getElementById('name').value == "") {
         alert ("الرجاء كتابة الإسم");
         document.getElementById('name').focus();
         return (false); }



      if (document.getElementById('email').value == "") {
         alert ("الرجاء كتابة البريد الإلكتروني");
         document.getElementById('email').focus();
         return (false); }

	var Symb = "|.{.}.[.].:.;.?.!.#.$.%.^.&.*.(.)./.\\.=.+.~.\'.\". .>.<.,".split(".");

for (var i=0; i < Symb.length; i++) {
      if (document.getElementById('email').value.indexOf(Symb[i]) !== -1) {
         alert ("هذا الرمز ["+Symb[i]+"] والمسافات غير مسموح بها في البريد الإلكتروني");
         document.getElementById('email').focus();
         return (false); }

   }

      if (document.getElementById('email').value.indexOf("@") == -1 || document.getElementById('email').value.indexOf(".") == -1 || document.getElementById('email').value.length < 7 ) {
         alert ("من فضلك اكتب بريدا ً إلكترونيا ً صحيحا ً");
         document.getElementById('email').focus();
         return (false); }
               if (document.getElementById('text').value.length < 10 ) {
         alert ("رسالتك قصيرة جدا ً");
         document.getElementById('text').focus();
         return (false); }

	var name = document.getElementById('name');
	var email = document.getElementById('email');
	var text = document.getElementById('text');
	var url="tellsend.php?"
	document.getElementById('contacts').style.display  = 'none';
	document.getElementById('waitcontact').style.display  = 'block';
	contact.open("POST",url,true)
	contact.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=windows-1256');
	param="name="+encodeURIComponent(name.value)
	param=param+"&email="+encodeURIComponent(email.value)
	param=param+"&text="+text.value
	contact.onreadystatechange = contacthandleResponse;	
	contact.send(param) 
}

function contacthandleResponse() {
    if(contact.readyState == 4){
        
		document.getElementById('contacts').innerHTML = contact.responseText;
		document.getElementById('waitcontact').style.display  = 'none';
		document.getElementById('contacts').style.display  = 'block';
    }
}
