var MessageMax='45000';
function AddName(str){var obj=document.mt.inpost;str='[b]'+str+'[/b]';if(document.selection){obj.focus();obj.document.selection.createRange().text=str;}else if(obj.selectionStart||obj.selectionStart=='0'){var startpos=obj.selectionStart;var endpos=obj.selectionEnd;obj.value=obj.value.substring(0,startpos)+str+obj.value.substring(endpos,obj.value.length);obj.selectionStart=obj.selectionEnd=startpos+str.length;obj.focus();}}
function smilie(str){var obj=document.mt.inpost;if(document.selection){obj.focus();obj.document.selection.createRange().text=str;}else if(obj.selectionStart||obj.selectionStart=='0'){var startpos=obj.selectionStart;var endpos=obj.selectionEnd;obj.value=obj.value.substring(0,startpos)+str+obj.value.substring(endpos,obj.value.length);obj.selectionStart=obj.selectionEnd=startpos+str.length;obj.focus();}}
function pastecode(text1,text2){var obj=document.mt.inpost;if(document.selection){sel=document.selection.createRange().text;obj.focus();obj.document.selection.createRange().text=text1+sel+text2;}else if(document.getSelection&&(obj.selectionStart||obj.selectionStart=='0')){var startpos=obj.selectionStart;var endpos=obj.selectionEnd;var txt=document.getSelection();if(!txt){txt=obj.value.substring(startpos,endpos);}obj.value=obj.value.substring(0,startpos)+text1+txt+text2+obj.value.substring(endpos,obj.value.length);obj.selectionStart=obj.selectionEnd=startpos+txt.length+text1.length+text2.length;obj.focus();}else{obj.value+=text1+text2;obj.focus();}}
function blocksubmit(){document.voting.submit();document.voting.Submit.disabled=true;}
function clckcntr(){var MessageLength=document.mt.inpost.value.length;if(MessageLength>MessageMax){alert("Текст сообщения не должен превышать "+MessageMax+" символов, а у вас их уже "+MessageLength+"!");return false;}else if(document.mt.inpost.value!=null&&document.mt.inpost.value.length==0){alert('Вы забыли ввести текст сообщения!');return false;}else{clckcnt++;if(clckcnt>1){if(clckcnt>2){return false;}alert('Отправка данных...\n\n'+'Дождитесь окончания процесса!');return false;}return true;}}
function previewpost(){MessageLength=document.mt.inpost.value.length;if(MessageLength>MessageMax){alert("Текст сообщения не должен превышать "+MessageMax+" символов, а у вас их уже "+MessageLength+"!");return false;}else if(document.mt.inpost.value!=null&&document.mt.inpost.value.length==0){alert('Вы забыли ввести текст сообщения!');return false;}else{document.mt.previewfirst.value="yes";document.mt.Preview.disabled=true;document.mt.submit();}}
function sendinfo(){var MessageLength=document.mt.newspost.value.length;if(MessageLength>MessageMax){alert("Текст сообщения не должен превышать "+MessageMax+" символов, а у вас их уже "+MessageLength+"!");return false;}else{clckcnt++;if(clckcnt>1){if(clckcnt>2){return false;}alert('Отправка данных...\n\n'+'Дождитесь окончания процесса!');return false;}return true;}}
function previewnews(){MessageLength=document.mt.newspost.value.length;if(MessageLength>MessageMax){alert("Текст новости не должен превышать "+MessageMax+" символов, а у вас их уже "+MessageLength+"!");return false;}else{document.mt.previewfirst.value="yes";document.mt.Preview.disabled=true;document.mt.submit();}}
function CheckLength(){MessageLength=document.mt.inpost.value.length;alert("Максимальный размер сообщения: "+MessageMax+" символов. В вашем сообщении "+MessageLength+" символов.");}