
var max_post_text_len=500;function CheckPostForm(toForm)
{var lcText=toForm.edtPostText.value;if(toForm.txtPostTitle.value==""){alert("Укажите заголовок объявления!");toForm.txtPostTitle.focus();return false;}
if(lcText==""){alert("Укажите текст объявления!");toForm.edtPostText.focus();return false;}
if(lcText!=""&&lcText.length>max_post_text_len){alert("Слишком длинный текст объявления!\nРазрешено не более '+max_post_text_len+' символов\nСейчас "+lcText.length);toForm.edtPostText.focus();return false;}
if(toForm.txtFoto1.value!='')if(!check_post_foto(toForm.txtFoto1))return false;if(toForm.txtFoto2.value!='')if(!check_post_foto(toForm.txtFoto2))return false;if(toForm.txtPostEmail.value==""&&toForm.txtPostPhones.value==""){alert("Укажите e-mail или телефон(ы) для связи!");toForm.txtPostEmail.focus();return false;}
return true;}
function check_post_foto(toObj)
{var lcFExt=get_file_ext(toObj.value).toLowerCase();if(!(lcFExt=='jpg'||lcFExt=='jpeg'||lcFExt=='gif'||lcFExt=='png'))
{alert('Допустимы только файлы с расширением JPG, GIF, PNG!');toObj.focus();return false;}
return true;}
function check_ptext_len(toObj)
{var lcText=toObj.value;var loOut=document.getElementById('chars_left');if(lcText.length>max_post_text_len)toObj.value=lcText.substring(0,max_post_text_len);loOut.innerHTML=parseInt(max_post_text_len-lcText.length);}
function post_foto_change(toField,tnNum)
{if(toField.value!='')
{var lcValue=toField.value.replace(' ','%20');alert(lcValue);}}