var http = createRequestObject();
function createRequestObject()
{
 var xmlhttp;
  /*@cc_on

  @if (@_jscript_version >= 5)

    try {

      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

    } catch (e) {

      try {

        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

      } catch (E) {

        xmlhttp = false;

      }

    }

  @else

  xmlhttp = false;

  @end @*/

 if(!xmlhttp && typeof XMLHttpRequest != 'undefined')
 {
  try
  {
   xmlhttp = new XMLHttpRequest();

  }
  catch(e)
  {
   xmlhttp = false;
  }

 }

 return xmlhttp;
}

function getLink(link){
    http.open('get', link);
    http.onreadystatechange = handleLink;
    http.send(null);
}
function handleLink(){
    if(http.readyState == 4){
        var response = http.responseText;
        document.getElementById('maindiv').innerHTML = response;
    }
}

function getrateInfo(){
    var poststr = "rate.php?id="  + document.getElementById("xxid").value + "&rate=" + document.getElementById("xxrate").value + "&random=" + Math.floor(89999999*Math.random()+10000000) ;
    http.open('get',poststr);
    http.onreadystatechange = handlerateInfo;
    http.send(null);
}
function handlerateInfo(){
    if(http.readyState == 4){
        var response = http.responseText;
        document.getElementById('ratediv').innerHTML = response;
    }
}

function getcommentInfo(){
    var poststr = "includes/comment.php?add=comment&bid="  + document.getElementById("bid").value + "&bname=" + document.getElementById("bname").value + "&bmail=" + document.getElementById("bmail").value + "&bmessage=" + document.getElementById("bmessage").value  + "&comnkind=" + document.getElementById("comnkind").value + "&code1=" + document.getElementById("code1").value + "&code2=" + document.getElementById("code2").value;
    http.open('get',poststr);
    http.setRequestHeader('Content-Type', 'text/html; charset:windows-1256');
    http.onreadystatechange = handlecommentInfo;
    http.send(null);
}
function handlecommentInfo(){
    if(http.readyState == 4){
        var response = http.responseText;
        document.getElementById('commentresult').innerHTML = response;

    }
}
function hidden_all_sub_div(){
	for(i=1;i<=3;i++){
		var id_div = "div"+i;
		if(document.getElementById(id_div)){
			document.getElementById(id_div).style.display="none";
		}
	}
}
function view_sub_div(id){
	document.getElementById(id).style.display="block";
}

function sendmail() {
    var umail = document.mform.umail.value;
    var fmail = document.mform.fmail.value;
    var codea = document.mform.codea.value;
    var codec = document.mform.codec.value;
    if (umail == '') {
    formErrors = "أين بريدك؟";
    alert(formErrors);
    document.mform.umail.focus();
    return false;
    }
    if (fmail == '') {
    formErrors = "أين بريد صديقك؟";
    alert(formErrors);
    document.mform.fmail.focus();
    return false;
    }
    if (codec == '') {
    formErrors = "اين كود التأكيد؟";
    alert(formErrors);
    document.commentform.codec.focus();
    return false;
    }
    if (codea == '') {
    formErrors = "اين كود التأكيد؟";
    alert(formErrors);
    document.commentform.codea.focus();
    return false;
    }
    document.mform.send.disabled=true;
}

function gnote(not)
{
 alert(not);
}




