//-------------------------------------
//check form ersal payam
//-------------------------------------
function set_message()
{

sw=is_empty(message[6],document.all('rname').value,1)
if (sw==false )
{
return false;
};


sw=is_empty(message[8],document.forms[0].elements('pm').value,1)
if (document.all('pm').value=='' )
{
return false;
};

sw=is_empty(message[7],document.all('remail').value,0)
if (sw==true )
{
sw1=email_validate(document.all('remail').value,1)
if (sw1==false )return false;
};
document.all('mode').value="add";
document.forms[0].submit();
return true;
}
//-------------------------------------
//check that the email address is valid
//-------------------------------------
function email_validate(f,pm_show)
{
	var str = f;
	var isEmail = /^.+@.+\..{2,3}$/;
	if (str != "")
	{
		if (!(isEmail.test(str)))
		{
		   if(pm_show==1) alert(message[3]);
		   //f.email.select(); f.email.focus();
		   return false
		}
		return true;
	}
}

//-------------------------------------
//check that the field is empty
//-------------------------------------
function is_empty(field_name,field_value,pm_show)
{
 var m1,str;
    str=field_value;
   m1=str.indexOf(" ");
   while (m1!=-1)
   {
  str=str.replace(" ","");
  m1=str.indexOf(" ");
   
   }
  if (str=="")
  {
   if(pm_show==1)  alert(message[5]+field_name);
   return false;
   }
  return true;
} 
//-------------------------------------
//check that the field is number
//-------------------------------------
 /*function is_number(field_name,field_value)
  { len=field_value.length;
    for (i=0;i<=len;i++) 
    {
       char1=field_value.charAt(i);
       if (isNaN(char1))   
          {
            alert(message[5]+field_name);
            return false;
          }
    }
    return true;
  }*/
//-------------------------------------
//check that the field is tellefon
//-------------------------------------
