wmtt = null;
document.onmousemove = updateWMTT;
function updateWMTT(e) {
x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
y = (document.all) ? window.event.y + document.body.scrollTop : e.pageY;
if (wmtt != null) {
wmtt.style.left = (x + 20) + "px";
wmtt.style.top = (y + 20) + "px";
}
}
function showWMTT(id) {
wmtt = document.getElementById(id);
wmtt.style.visibility = "visible";
wmtt.style.display = "block";
}
function hideWMTT() {
wmtt.style.visibility = "hidden";
wmtt.style.display = "none";
}
function showhide(obj){
if(obj == 'none') return 'inline';
else return 'none';
}
function news_preview()
{
window.open('modules/news/preview.php','Preview','resizable=yes,scrollbars=yes,menubar=no,status=no,location=no,width=640,height=480');
}
function cont_preview()
{
window.open('modules/content/preview.php','Preview','resizable=yes,scrollbars=yes,menubar=no,status=no,location=no,width=640,height=480');
}
function checktag(tag){
tag=tag.substring(0,tag.length-1).toLowerCase(); //Extract tag
if (tag=="br") return "\n";
if (tag=="b") return "[b]";
if (tag=="/b") return "[/b]";
if (tag=="i") return "[i]";
if (tag=="/i") return "[/i]";
if (tag=="u") return "[u]";
if (tag=="/u") return "[/u]";
if (tag=="div class=quote") return "[q]";
if (tag=="/div") return "[/q]";
return '';
}
function checktag2(tag){
tag=tag.replace(/</g,'<');
tag=tag.replace(/>/g,'>');
return tag;
}
function getSel() {
if (window.getSelection)
return window.getSelection();
else if (document.selection)
return document.selection.createRange().text;
else if (document.getSelection)
return document.getSelection();
else return '';
}
function quotmsg(id) {
var m=document.all['quot_'+id].innerHTML;
var a=document.all['aut_'+id].innerHTML;
var b="";
var tag="";
var c=true;
for (var i=0; i < m.length; i++) {
if (m.charAt(i)=='<') {
c=false;
tag="";
continue;
}
if (c) b+=m.charAt(i); else if (m.charAt(i)!='"') tag+=m.charAt(i);
if (m.charAt(i)=='>') {
c=true;
b+=checktag(tag); //Replace tag
}
}
ins("\n[q][b]"+a+" писал(а)[/b]\n"+b+"[/q]\n");
}
function ins2(txt1,txt2) {
var txtarea;
txtarea=document.newmsg.user_text;
txtarea.focus();
if (document.selection) {
theSelection = document.selection.createRange().text; // Get text selection
document.selection.createRange().text = txt1 + theSelection + txt2;
theSelection = '';
return;
}
else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
mozWrap(txtarea, txt1, txt2);
else txtarea.value=txtarea.value+txt1+txt2;
}
function copyQ(name) {
txt=''
if (document.getSelection) {txt=document.getSelection()}
else if (document.selection) {txt=document.selection.createRange().text;}
}
function ins(txt){
ins2(txt,'');
}
function quote(id){
var a=document.all['aut_'+id].innerHTML;
if (txt!='')
ins("\n[q][b]"+a+":[/b]\n"+txt+"[/q]\n");
else quotmsg(id);
}
function insertext(text1,text2,area){
var b=getSel();
theSelection = document.selection.createRange().text;
if(area=="short"){if (!theSelection) { document.newmsg.text_news_short.focus(); document.newmsg.text_news_short.value += text1 + text2; document.newmsg.text_news_short.focus(); return; } else {document.newmsg.text_news_short.focus(); document.selection.createRange().text = text1 + b + text2; document.newmsg.text_news_short.focus(); return; } }
if(area=="full"){if (!theSelection) { document.newmsg.text_news.focus(); document.newmsg.text_news.value += text1 + text2; document.newmsg.text_news.focus(); return; } else {document.newmsg.text_news.focus(); document.selection.createRange().text = text1 + b + text2; document.newmsg.text_news.focus(); return; } }
if(area=="shortc"){if (!theSelection) { document.newmsg.con_short.focus(); document.newmsg.con_short.value += text1 + text2; document.newmsg.con_short.focus(); return; } else {document.newmsg.con_short.focus(); document.selection.createRange().text = text1 + b + text2; document.newmsg.con_short.focus(); return; } }
if(area=="fullc"){if (!theSelection) { document.newmsg.con_full.focus(); document.newmsg.con_full.value += text1 + text2; document.newmsg.con_full.focus(); return; } else {document.newmsg.con_full.focus(); document.selection.createRange().text = text1 + b + text2; document.newmsg.con_full.focus(); return; } }
}
function mozWrap(txtarea, open, close)
{
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2)
selEnd = selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
return;
}
function smile(icon)
{
opener.document.newmsg.user_text.value = document.newmsg.user_text.value + icon + ' ';
opener.document.newmsg.user_text.focus();
}
function past_name(name)
{
var b=getSel();
document.newmsg.user_text.focus();
document.selection.createRange().text = '[b]' + name + '[/b], '+b;
document.newmsg.user_text.focus();
}
function code(icon)
{
var b=getSel();
document.getElementById("add_user").value += '[' + icon + ']' + b + '[/' + icon + ']';
}
var ns6=document.getElementById&&!document.all
function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}
function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}
function displaylimit(theform,thelimit){
var limit_text=''+thelimit+''
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true);
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true);
}
}
// Code to display window every time broser opens this page language="JavaScript1.2"
var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var ns6=document.getElementById&&!document.all
var calunits=document.layers? "" : "px"
var bouncelimit=32 //(must be divisible by 8)
var direction="up"
var lpos
function initbox(){
if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}
function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)=60) d=d-60
while (true)
{
var d1=new Date()
if(d==d1.getSeconds())
break;
}
}
function DropIn(main_bgcolor,main_texttype,main_textsize,main_textcolor,textbar,height,width,top,left,bordercolor,borderstyle,borderwidth,sec)
{
lpos = top
ans="no"
//delay(sec)
var chkshow=false;
if(!chkshow)
{
if (ns4)
{
templayer=document.layers[0]
templayer.left=left
templayer.top=top
templayer.width=width
templayer.height=height
}
else if (ns6)
{
document.getElementById("tbl").style.border = bordercolor+' '+borderwidth+'px '+borderstyle
document.getElementById("dragtext").innerHTML=textbar
document.getElementById("dropin").style.height=height +'px'
document.getElementById("dropin").style.width =width +'px'
document.getElementById("dropin").style.left =left +'px'
document.getElementById("dropin").style.top =top +'px'
document.getElementById("dragtext").style.backgroundColor=main_bgcolor
document.getElementById("dragtext").style.color = main_textcolor
document.getElementById("dragtext").style.fontFamily = main_texttype
document.getElementById("dragtext").style.fontSize = main_textsize+'px'
}
else
{
document.getElementById("tbl").style.border = bordercolor+' '+borderwidth+'px '+borderstyle
document.getElementById("dragtext").innerHTML=textbar
document.getElementById("dropin").style.height=height +'px'
document.getElementById("dropin").style.width =width +'px'
document.getElementById("dropin").style.left =left +'px'
document.getElementById("dropin").style.top =top +'px'
document.getElementById("dragtext").style.backgroundColor=main_bgcolor
document.getElementById("dragtext").style.color = main_textcolor
document.getElementById("dragtext").style.fontFamily = main_texttype
document.getElementById("dragtext").style.fontSize = main_textsize+'px'
}
setTimeout("initbox()",(sec*1000));
}
}
function code1(icon)
{
var b=getSel();
document.getElementById("add_user").value += '[' + icon + '=' + b + ']' + b + '[/' + icon + ']';
}