/*/////////////////////script in temp///////////////////////////////////*/
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/*/////////////////////end of script in temp///////////////////////////////////*/


//////////////////////////////////////////////////////////////
/*********************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='temp/code_amniyat/chek.php?code='+frm.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();}
      } 
    }
	
//contact//////////////////
function hoshmand_contact(){
       if(frm.txtname_tb.value=="" || frm.txttel_tb.value=="" || frm.txtcoment_tb.value==""){
            alert("فیلدهای ستاره دار را پر نمائید");
       }
       else{box_code();}
}//end fun hoshmand_contact

//order//////////////////
function hoshmand_order(){
	       if(frm.txtaddress.value=="" || frm.txttel.value=="" || frm.txtfamily.value=="" || frm.txtname.value==""   
	          || frm.slcformat.value=="" || frm.yb.value=="سال" || frm.mb.value=="ماه"
			   || frm.yr.value=="سال" || frm.mr.value=="ماه"){
            alert("فیلدهای ستاره دار را پر نمائید");
       }
        else{box_code();}
}//end fun hoshmand_order
/////////////////////////////////////


//localtor//////////////////
function hoshmand_localtor(){
	//alert("ffff");
if(document.getElementById('m1').checked!=""){
       if(frm.name.value=="" || frm.tel.value=="" || frm.yr.value=="" || frm.mr.value=="" || frm.yb.value=="" || frm.mb.value==""){
            alert("فیلدهای ستاره دار را پر نمائید");
       }
       else{box_code();}
}
else{
       if(frm.code_ozve.value=="" || frm.yr.value=="" || frm.mr.value=="" || frm.yb.value=="" || frm.mb.value==""){
            alert("فیلدهای ستاره دار را پر نمائید");
       }
       else{box_code();}
}
}//end fun hoshmand_localtor
//////////////////////////////////////

//tor//////////////////
function hoshmandtor(){
if(document.getElementById('m1').checked!=""){
       if(frm.name.value=="" || frm.tel.value=="" || frm.yr.value=="" || frm.mr.value=="" || frm.yb.value=="" || frm.mb.value==""){
            alert("فیلدهای ستاره دار را پر نمائید");
       }
       else{ box_code();}
}
else{
       if(frm.code_ozve.value=="" || frm.yr.value=="" || frm.mr.value=="" || frm.yb.value=="" || frm.mb.value==""){
            alert("فیلدهای ستاره دار را پر نمائید");
       }
       else{ box_code();}
}
}//end fun hoshmandtor

//////////////////////////////////////////////////////////////
/*********************end of security code*****************************/


///////////////////////temp////////////////////////////////////////////////////
function form_delmatn(){
 hid1=document.frmsms.txname_sms;
 hid2=document.frmsms.txmail_sms;
  hid3=document.frmsms.txmobile_sms;
  hid4=document.frmsms.textfieldsms;
  if(hid1.value==""){
  hid1.value="نام";
  }

  if(hid2.value==""){
  hid2.value="ایمیل";
  }
 if(hid3.value==""){
  hid3.value="موبایل";
  } 
  
  if(hid4.value==""){
  hid4.value="رمزعبور";
  }

}
//*************baraye java txt sms **************************************/
function changematn(txt){
if(txt=='1'){
 hid2=document.frmsms.txmail_sms;
  hid3=document.frmsms.txmobile_sms;
  hid4=document.frmsms.textfieldsms;
  if(hid2.value==""){
  hid2.value="ایمیل";
  }
 if(hid3.value==""){
  hid3.value="موبایل";
  } 
  
  if(hid4.value==""){
  hid4.value="رمزعبور";
  }
}

if(txt=='2'){
 hid1=document.frmsms.txname_sms;
  hid3=document.frmsms.txmobile_sms;
  hid4=document.frmsms.textfieldsms;
  if(hid1.value==""){
  hid1.value="نام";
  }
 if(hid3.value==""){
  hid3.value="موبایل";
  } 
  
  if(hid4.value==""){
  hid4.value="رمزعبور";
  }
}
if(txt=='3'){
 hid1=document.frmsms.txname_sms;
  hid2=document.frmsms.txmail_sms;
  hid4=document.frmsms.textfieldsms;
  if(hid1.value==""){
  hid1.value="نام";
  }
 if(hid2.value==""){
  hid2.value="ایمیل";
  } 
  
  if(hid4.value==""){
  hid4.value="رمزعبور";
  }
}
if(txt=='4'){
hid1=document.frmsms.txname_sms;
  hid2=document.frmsms.txmail_sms;
  hid3=document.frmsms.txmobile_sms;
  if(hid1.value==""){
  hid1.value="نام";
  }
 if(hid2.value==""){
  hid2.value="ایمیل";
  } 
  
  if(hid3.value==""){
  hid3.value="موبایل";
  }
}

}
//////////////////////////////////////
function deletematn(txt){
 hid1=document.frmsms.txname_sms;
 if(txt=='1' && hid1.value=="نام" ){
   hid1.value="";
}
 hid2=document.frmsms.txmail_sms;
if(txt=='2' && hid2.value=="ایمیل" ){
   hid2.value="";
}
 hid3=document.frmsms.txmobile_sms;
if(txt=='3' && hid3.value=="موبایل" ){
   hid3.value="";
}
 hid4=document.frmsms.textfieldsms;
if(txt=='4' && hid4.value=="رمزعبور"){
   hid4.value="";
}
}
//*************baraye java txt package **************************************/
function changematnpackage(txt){
if(txt=='2'){
 hid1=document.frm_input.txtmail_in;
  if(hid1.value==""){
  hid1.value="نام کاربری";
  }
}

if(txt=='1'){
 hid1=document.frm_input.txtpass_in;
  if(hid1.value==""){
  hid1.value="رمز عبور";
  }
}
}
////////////////////////////////////////////////////
function deletematnpackage(txt){
 hid1=document.frm_input.txtmail_in;
 if(txt=='1' && hid1.value=="نام کاربری" ){
   hid1.value="";
}
 hid2=document.frm_input.txtpass_in;
 if(txt=='2' && hid2.value=="رمز عبور" ){
   hid2.value="";
}
}
/////////////////////////////////////////////////-->


<!--
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.frm.hiddenField;
  var s1="0";
    if((document.getElementById('textfield').name)===(document.getElementById('textfield').value))
  {
  hid.value="0";
 document.frm.submit();
  }
  else
  {
  alert(".لطفا رمز را درست وارد کنید");
  hid.value="1";

  }
  }

<!------------------------------
function alertNamesms()
  {
  b=document.frmsms.Submit;
   hid=document.frmsms.hiddenFieldsms;
  var s1="0";
    if((document.getElementById('textfieldsms').name)===(document.getElementById('textfieldsms').value))
  {
  hid.value="0";
 document.frmsms.submit();
  }
  else
  {
  alert(".لطفا رمز را درست وارد کنید");
  hid.value="1";
  }
  }
<!------------------------------

///check kardan email sahih//////////////////////////////////////
///////////////////////////////////////////////////////
function echeck2(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert(".لطفا ایمیلتان را درست وارد نمائید")
  
	   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert(".لطفا ایمیلتان را درست وارد نمائید")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert(".لطفا ایمیلتان را درست وارد نمائید")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert(".لطفا ایمیلتان را درست وارد نمائید")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert(".لطفا ایمیلتان را درست وارد نمائید")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert(".لطفا ایمیلتان را درست وارد نمائید")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert(".لطفا ایمیلتان را درست وارد نمائید")
		    return false
		 }

 		 return true					
	}
	

function ValidateForm2(){
	var emailID=document.frm.email
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert(".لطفا ایمیلتان را وارد نمائید")
		emailID.focus()
		return false
	}
	if (echeck2(emailID.value)==false){
		emailID.focus()
		return false
	}
	
	box_code();
	return true
 }
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////

// hoshmand_moshtari/////////////////////////////////////////////////
function hoshmand_moshtari(){
       if(frm.txtname.value=="" || frm.txtcodemeli.value=="" || frm.email.value=="" ){
            alert("فیلدهای ستاره دار را پر نمائید");
       }
 
 else{ValidateForm2();} 
}//end fun  hoshmand_moshtari

/*////////////code-rahgiri////////////////*/
function changematn_rah(){
  document.rah_frm.txtsearch.value=" ";
}
////////////////////////////////////////////////////////////////////////
function isdigit(entry)
{
  key=window.event.keyCode;
  if(key>=48 && key<=57)
     return;
  else 	 {
    alert("در این فیلد فقط عدد وارد نمائید");
     window.event.keyCode=null;}
}
