function onsubmcard(){
$ret=true;

if (document.cardform.title.value==''){$ret=false;alert("Вы не указали заголовок объявления.");
 document.cardform.title.focus();}

if ($ret && (document.cardform.text.value=='')){$ret=false;alert("Вы не указали текст объявления.");
 document.cardform.text.focus();}

if ($ret && (document.cardform.text.value.length>2048)){$ret=false;alert("Текст объявления слишком большой, просьба уменьшить его.");
document.cardform.text.focus();}

if ($ret && (document.cardform.email.value=='')){$ret=false;alert("Вы не указали адрес электронной почты.");
 document.cardform.email.focus();}

if ($ret){
 $i=0;
 $str=document.cardform.email.value;

 while (
 (($str.charAt($i)>='A') && ($str.charAt($i)<='Z')) ||
 (($str.charAt($i)>='a') && ($str.charAt($i)<='z')) ||
 (($str.charAt($i)>='0') && ($str.charAt($i)<='9')) ||
 ($str.charAt($i)=='-') ||
 ($str.charAt($i)=='_') ||
 ($str.charAt($i)=='.')
 ) $i++;

 if ($i==0) $ret=false;

 if ($ret && ($str.charAt($i)!='@')) $ret=false;

 if ($ret){
 $j=0;
 while (
 (($str.charAt($i+$j+1)>='A') && ($str.charAt($i+$j+1)<='Z')) ||
 (($str.charAt($i+$j+1)>='a') && ($str.charAt($i+$j+1)<='z')) ||
 (($str.charAt($i+$j+1)>='0') && ($str.charAt($i+$j+1)<='9')) ||
 ($str.charAt($i+$j+1)=='-') ||
 ($str.charAt($i+$j+1)=='_') ||
 ($str.charAt($i+$j+1)=='.')
 ) $j++;

 if ($j==0) $ret=false;

}// if ($ret)

if (!$ret){alert("Вы указали некорректный адрес электронной почты.");
 document.cardform.email.focus();}

}// if ($ret)

return $ret;}
