wmtt = null;
document.onmousemove = updateWMTT;

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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";
}
}

window.onerror = null;

tooltip = {

	/* НАЧАЛО НАСТРОЕК */

	attr_name: "tooltip", // наименование создаваемого tooltip'ого атрибута
	blank_text: "(откроется в новом окне)", // текст для ссылок с target="_blank"
	newline_entity: "#", // укажите пустую строку (""), если не хотите использовать в tooltip'ах многострочность; ежели хотите, то укажите тот символ или символы, которые будут заменяться на перевод строки
	max_width: 0, // максимальная ширина tooltip'а в пикселах; обнулите это значение, если ширина должна быть нелимитирована
	delay: 10, // задержка при показе tooltip'а в миллисекундах
	
	/* КОНЕЦ НАСТРОЕК */

	t: document.createElement("DIV"),
	c: null,
	g: false,

	m: function(e){
		if (tooltip.g){
			oCanvas = document.getElementsByTagName(
			(document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY"
			)[0];
			x = window.event ? event.clientX + oCanvas.scrollLeft : e.pageX;
			y = window.event ? event.clientY + oCanvas.scrollTop : e.pageY;
			tooltip.a(x, y);
		}
	},

	d: function(){
		tooltip.t.setAttribute("id", "tooltip");
		//tooltip.t.style.filter = "alpha(opacity=5)"; // buggy in ie5.0
		document.body.appendChild(tooltip.t);
		a = document.all ? document.all : document.getElementsByTagName("*");
		aLength = a.length;
		for (var i = 0; i < aLength; i++){

			//if (a[i].tagName == "A" || a[i].tagName == "BUTTON" || (a[i].tagName == "INPUT" && (a[i].type == "submit" || a[i].type == "button" || a[i].type == "reset"))) a[i].onclick = self.focus;

			if (!a[i]) continue;

			tooltip_title = a[i].getAttribute("title");
			tooltip_alt = a[i].getAttribute("alt");
			tooltip_blank = a[i].getAttribute("target") && a[i].getAttribute("target") == "_blank" && tooltip.blank_text;
			if (tooltip_title || tooltip_blank){
				a[i].setAttribute(tooltip.attr_name, tooltip_blank ? (tooltip_title ? tooltip_title + " " + tooltip.blank_text : tooltip.blank_text) : tooltip_title);
				if (a[i].getAttribute(tooltip.attr_name)){
					a[i].removeAttribute("title");
					if (tooltip_alt && a[i].complete) a[i].removeAttribute("alt");
					tooltip.l(a[i], "mouseover", tooltip.s);
					tooltip.l(a[i], "mouseout", tooltip.h);
				}
			}else if (tooltip_alt && a[i].complete){
				a[i].setAttribute(tooltip.attr_name, tooltip_alt);
				if (a[i].getAttribute(tooltip.attr_name)){
					a[i].removeAttribute("alt");
					tooltip.l(a[i], "mouseover", tooltip.s);
					tooltip.l(a[i], "mouseout", tooltip.h);
				}
			}
			if (!a[i].getAttribute(tooltip.attr_name) && tooltip_blank){
				//
			}
		}
		document.onmousemove = tooltip.m;
		window.onscroll = tooltip.h;
		tooltip.a(-99, -99);
	},

	s: function(e){
		d = window.event ? window.event.srcElement : e.target;
		if (!d.getAttribute(tooltip.attr_name)) return;
		s = d.getAttribute(tooltip.attr_name);
		if (tooltip.newline_entity){
			s = s.replace(/\&/g,"&amp;");
			s = s.replace(/\</g,"&lt;");
			s = s.replace(/\>/g,"&gt;");
			s = s.replace(eval("/" + tooltip.newline_entity + "/g"), "<br />");
			tooltip.t.innerHTML = s;
		}else{
			if (tooltip.t.firstChild) tooltip.t.removeChild(tooltip.t.firstChild);
			tooltip.t.appendChild(document.createTextNode(s));
			//tooltip.t.innerText = s;
		}
		tooltip.c = setTimeout("tooltip.t.style.visibility = 'visible';", tooltip.delay);
		tooltip.g = true;
	},

	h: function(e){
		tooltip.t.style.visibility = "hidden";
		if (!tooltip.newline_entity && tooltip.t.firstChild) tooltip.t.removeChild(tooltip.t.firstChild);
		clearTimeout(tooltip.c);
		tooltip.g = false;
		tooltip.a(-99, -99);
	},

	l: function(o, e, a){
		if (o.addEventListener) o.addEventListener(e, a, false); // was true--Opera 7b workaround!
		else if (o.attachEvent) o.attachEvent("on" + e, a);
			else return null;
	},

	a: function(x, y){
		oCanvas = document.getElementsByTagName(
		(document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY"
		)[0];
		
		w_width = oCanvas.clientWidth ? oCanvas.clientWidth + oCanvas.scrollLeft : window.innerWidth + window.pageXOffset;
		w_height = window.innerHeight ? window.innerHeight + window.pageYOffset : oCanvas.clientHeight + oCanvas.scrollTop; // should be vice verca since Opera 7 is crazy!

		tooltip.t.style.width = ((tooltip.max_width) && (tooltip.t.offsetWidth > tooltip.max_width)) ? tooltip.max_width + "px" : "auto";
		
		t_width = tooltip.t.offsetWidth;
		t_height = tooltip.t.offsetHeight;

		tooltip.t.style.left = x + 5 + "px";
		tooltip.t.style.top = y + 5 + "px";
		
		if (x + t_width > w_width - 20) tooltip.t.style.left = w_width - t_width - 50 + "px";
		if (y + t_height > w_height - 20) tooltip.t.style.top = w_height - t_height - 50 + "px";
	}
}

var root = window.addEventListener || window.attachEvent ? window : document.addEventListener ? document : null;
if (root){
	if (root.addEventListener) root.addEventListener("load", tooltip.d, false);
	else if (root.attachEvent) root.attachEvent("onload", tooltip.d);

}

function redirect(url)
	{ location.href = url.options[url.selectedIndex].value; }


function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=1000,height=700,screenX=5,screenY=5,top=5,left=5')
}

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(/&lt;/g,'<');
 tag=tag.replace(/&gt;/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 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 high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",50)
}

function low(which2){
clearInterval(highlighting)
which2.filters.alpha.opacity=55
}

function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=20
else if (window.highlighting)
clearInterval(highlighting)
}

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=="club"){if (!theSelection) { document.newmsg.text_club.focus(); document.newmsg.text_club.value += text1 + text2; document.newmsg.text_club.focus(); return; } else {document.newmsg.text_club.focus(); document.selection.createRange().text = text1 + b + text2; document.newmsg.text_club.focus(); return; } }
    if(area=="auto"){if (!theSelection) { document.newmsg.text_auto.focus(); document.newmsg.text_auto.value += text1 + text2; document.newmsg.text_auto.focus(); return; } else {document.newmsg.text_auto.focus(); document.selection.createRange().text = text1 + b + text2; document.newmsg.text_auto.focus(); return; } }
    if(area=="service"){if (!theSelection) { document.newmsg.text_service.focus(); document.newmsg.text_service.value += text1 + text2; document.newmsg.text_service.focus(); return; } else {document.newmsg.text_service.focus(); document.selection.createRange().text = text1 + b + text2; document.newmsg.text_service.focus(); return; } }
    if(area=="price"){if (!theSelection) { document.newmsg.text_price.focus(); document.newmsg.text_price.value += text1 + text2; document.newmsg.text_price.focus(); return; } else {document.newmsg.text_price.focus(); document.selection.createRange().text = text1 + b + text2; document.newmsg.text_price.focus(); return; } }
    if(area=="transfer"){if (!theSelection) { document.newmsg.text_transfer.focus(); document.newmsg.text_transfer.value += text1 + text2; document.newmsg.text_transfer.focus(); return; } else {document.newmsg.text_transfer.focus(); document.selection.createRange().text = text1 + b + text2; document.newmsg.text_transfer.focus(); return; } }
    if(area=="welcome"){if (!theSelection) { document.newmsg.text_welcome.focus(); document.newmsg.text_welcome.value += text1 + text2; document.newmsg.text_welcome.focus(); return; } else {document.newmsg.text_welcome.focus(); document.selection.createRange().text = text1 + b + text2; document.newmsg.text_welcome.focus(); return; } }
    
if(area=="shortc"){if (!theSelection) { document.newmsg.stat_k.focus(); document.newmsg.stat_k.value += text1 + text2; document.newmsg.stat_k.focus(); return; } else {document.newmsg.stat_k.focus(); document.selection.createRange().text = text1 + b + text2; document.newmsg.stat_k.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 code(icon)
{
var b=getSel();
document.newmsg.user_text.focus();
document.selection.createRange().text = '[' + icon + ']' + b + '[/' + icon + ']';
document.newmsg.user_text.focus();
}

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
}
}

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)<lpos)
crossobj.top=parseInt(crossobj.top)+25+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)
}
}

function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}

function truebody(){
return (document.compatMode!="BackCompat")? document.documentElement : document.body
}
function delay(x)
{
var d=new Date()
d=d.getSeconds()+x
if (d>=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));
}
}
