/*********************security code*****************************/
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 $(id)
{
    return(document.getElementById(id));
}
/************************************************************************************************/

function box_code()

    { 
      xmlHttp=GetXmlHttpObject();
      if (xmlHttp==null)
      {
        alert ("Browser does not support HTTP Request");
        return;
      }
    
      url='web-folder/code_amniyat/chek.php?code='+document.getElementById('code').value;
      //alert(url);
      xmlHttp.onreadystatechange=state_nazar;
      xmlHttp.open("GET",url,true);
      xmlHttp.send(null);

    }
    
    function state_nazar() 
    { 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
     { 
        if (xmlHttp.responseText==1){ alert("کد امنیتی را درست وارد نمائید");}
		else{ 
		 document.frm.submit();}
      } 
    }
// hoshmand_moshtari/////////////////////////////////////////////////
function hoshmand_moshtari(){
       if(document.getElementById('txtname').value=="" || document.getElementById('txtcodemeli').value=="" || document.getElementById('email').value=="" ){
            alert("فیلدهای ستاره دار را پر نمائید");
       }
 
 else{box_code();} 
}//end fun  hoshmand_moshtari

function popUpWindow(URLStr , left, top, width, height)
{
   popUpWin = open(URLStr, 'popUpWin', 'dependent=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
//-->
function alertName()
{
  b=document.frm.Submit;
   hid=document.getElementById('hiddenField');
    if((document.getElementById('textfield').name)===(document.getElementById('textfield').value))
  {
 hid.value="0";
  document.frm.submit();
  }
  else
  {
  alert(".لطفا کد امنیتی را درست وارد کنید");
  hid.value="1";
  }
}

///////////////////////////////////////////////////////////////////////////////
function isdigit(entry)
{
  key=window.event.keyCode;
  if(key>=48 && key<=57)
     return;
  else 	 {
    alert(". لطفا در اين فيلد فقط عدد وارد کنید");
     window.event.keyCode=null;}
}
/////////////////////////////////////////////////////////////////////////////////////////
var ttt,tttt
function init() {
	ttt= (document.all) ? document.all.tt : document.getElementById("tt")
	tttt = ttt.tBodies[0]
}
function color(trr,i){
   tttt.rows[trr].cells[i].style.backgroundColor = "#758A9A"		
}
function color1(trr,i){
			tttt.rows[trr].cells[i].style.backgroundColor = ""		
}

function alertNamesms()
  {
	     if(document.getElementById('txname_sms').value=="نام" || document.getElementById('txmail_sms').value=="ایمیل" ||
     document.getElementById('txmobile_sms').value=="موبایل" ){
            alert("فیلدها را پر نمائید");
   }
  else{
  b=document.frmsms.Submit;
   hid=document.getElementById('hiddenFieldsms');
  var s1="0";
    if((document.getElementById('textfieldsms').name)===(document.getElementById('textfieldsms').value))
  {
  hid.value="0";
 document.frmsms.submit();
  }
  else
  {
  alert(".لطفا کد امنیتی را درست وارد کنید");
  hid.value="1";
  }
  }
  }
/**box_tarh_link haaaaaaa**************************************************************************/
function fun_close(){
            $('.div_link_right').css("display","block").fadeOut("slow");
}
