com_div_view=0;var glob_form;var glob_mark=0;var glob_margin=0;var glob_fio;var glob_msg;var glob_user_id;var glob_mail;var com_forms_edit;var sex=0;var adress=0;(navigator.userAgent.indexOf('Opera')>-1)?opera=1:opera='';(navigator.userAgent.indexOf('Gecko')>-1)?ff=1:ff='';ierr='';function getCom(com_div,mark,margin){if(mark==0){location.href='#post_comm'}if(com_div==com_div_view){document.getElementById(com_div_view).innerHTML='';document.getElementById(com_div_view).style.display='none';com_div_view=0;glob_mark=0;glob_margin=0}else{glob_mark=mark;glob_margin=(margin*1+1);if(document.getElementById('captcha')){document.getElementById('ncnum').value=com_div;document.getElementById('captcha').value=100;if(com_div_view!=0){glob_fio?document.getElementById(com_div_view).innerHTML='<div id="forum_preview"><div id="forum_coms"><table id=com_tab><tr><td id=com_anchor></td><td><div id=com_author>'+glob_fio+'</div><div id=com_msg>'+temp_msg.replace(/\r\n|\r|\n/g,"<br>")+'</div></td></tr></table></div></div>':document.getElementById(com_div_view).innerHTML=''}com_forms=document.getElementById("com_form").innerHTML}else{com_forms='<p><div class=info>Нужно <a href=http://uppod.ru/auth >войти</a> или <a href=http://uppod.ru/auth/sign/ >зарегистрироваться</a></div></p>'}document.getElementById(com_div).style.display='block';document.getElementById(com_div).innerHTML=com_forms;com_div_view=com_div}}function close_form(){document.getElementById(com_div_view).innerHTML='';document.getElementById(com_div_view).style.display='none';com_div_view=0}function preview(form,rt,pl,iknow){fstp=0;fstpm='';glob_form=form;if(iknow==0){if(form.fio.value==''){fstp=1;fstpm+='Вы не представились\n'}if(form.fio.value.match("admin")|form.fio.value.match("админ")){fstp=1;fstpm+='Такое имя зарезервировано\n'}if(form.mail.value==''){fstp=1;fstpm+='Не введен e-mail\n'}else{if(!(/^([a-z0-9])(([\-.]|[_]+)?([a-z0-9]+))*(@)([a-z0-9])((([-]+)?([a-z0-9]+))?)*((.[a-z]{2,3})?(.[a-z]{2,6}))$/i.test(form.mail.value))){fstp=1;fstpm+='Ошибка в e-mail\n'}}}if(form.msg.value==''){fstp=1;fstpm+='Не введен текст\n'}if(fstp==1){alert(fstpm)}else{glob_fio=form.fio.value;glob_msg=form.msg.value;glob_mail=form.mail.value;opera|ff?captcha=100:captcha=form.captcha.value;var ajax=new sack();ajax.AjaxFailedAlert='Включите JavaScript в браузере для корректной работы сайта';ajax.requestFile=rt+'ajax/a_forum.php';ajax.method='POST';ajax.setVar('name',form.name.value);ajax.setVar('fio',form.fio.value);ajax.setVar('msg',form.msg.value);ajax.setVar('sex',sex);ajax.setVar('mail',form.mail.value);ajax.setVar('user_id',form.user_id.value);ajax.setVar('mark',glob_mark);ajax.setVar('margin',glob_margin);ajax.setVar('captcha',captcha);ajax.setVar('adress',adress);ajax.setVar('key_post',form.key_post.value);ajax.setVar('key_link',form.key_link.value);ajax.setVar('rem',form.rem.checked);ajax.onCompletion=function(){if(ajax.response.match("ok")){form.submit.disabled=false;form.close.style.display='none';com_forms_edit=document.getElementById(com_div_view).innerHTML;sex=0;sex_edit=ajax.response.replace('ok',"");tmp_com_div_view=document.getElementById(com_div_view).innerHTML;temp_msg=htmlspecialchars(glob_msg);document.getElementById(com_div_view).innerHTML='<div id="forum_preview"><div id="forum_coms"><table id=com_tab><tr><td id=com_anchor></td><td><div id=com_author>'+glob_fio+'</div><div id=com_msg>'+temp_msg.replace(/\r\n|\r|\n/g,"<br>")+'</div><div id=com_edit> (<a href="" onClick="editCom(); return false;">править</a>) (<a href="'+pl+'">обновить</a>)</div></td></tr></table></div></div>'}else{alert(ajax.response);form.submit.disabled=false;form.close.disabled=false}};form.close.disabled=true;form.submit.disabled=true;ajax.runAJAX()}}function editCom(){if(ff){com_forms_edit=com_forms_edit.replace(/forum_ta\">.*?<\/textarea>/i,"forum_ta\">"+glob_msg+"</textarea>");com_forms_edit=com_forms_edit.replace(/fio\" value=\".*?\"/i,"fio\" value=\""+glob_fio+"\"");com_forms_edit=com_forms_edit.replace(/mail\" value=\".*?\"/i,"mail\" value=\""+glob_mail+"\"")}document.getElementById(com_div_view).innerHTML=com_forms_edit;sex=sex_edit;if(opera){mail.value=glob_mail;fio.value=glob_fio;user_id.value=glob_user_id;msg.value=glob_msg}}function go2(){document.getElementById('submit').style.display='none';document.getElementById('pre').style.display='none';document.getElementById('preview').innerHTML='Подожите минутку...'}function getK(){adress=500}ipreview2=0;function preview2(form,edit){fstpm='';fstp2=0;if(form.title.value==''){fstp2=1;fstpm+='Не введен заголовок\n'}if(fstp2==1){alert(fstpm)}else{if(ipreview2==0){prev_msg=document.getElementById('forum_ta2').value;prev_title=document.getElementById('title').value;temp_msg=htmlspecialchars(prev_msg);document.getElementById('preview').innerHTML='<b>'+prev_title+"</b><p>"+temp_msg.replace(/\r\n|\r|\n/g,"<br>");document.getElementById('form').style.display='none';document.getElementById('pre').value='Править';document.getElementById('submit').style.display='inline';ipreview2=1}else{document.getElementById('preview').innerHTML='';document.getElementById('form').style.display='block';document.getElementById('pre').value='Предпросмотр';document.getElementById('submit').style.display='none';ipreview2=0}}}function htmlspecialchars(html){html=html.replace(/&/g,"&amp;");html=html.replace(/</g,"&lt;");html=html.replace(/>/g,"&gt;");html=html.replace(/"/g,"&quot;");return html}
