var htmin=0;
var imageTag = false;
var theSelection = false;
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;

var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);



// Define the bbCode tags
bbcode = new Array();
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[vip]','[/vip]','[img]','[/img]','[url]','[/url]','[left]','[/left]','[center]','[/center]','[right]','[/right]','[justify]','[/justify]','[vipp]','[/vipp]');
imageTag = false;




// Replacement for arrayname.length property
function getarraysize(thearray) {
        for (i = 0; i < thearray.length; i++) {
                if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
                        return i;
                }
        return thearray.length;
}

// Replacement for arrayname.push(value) not implemented in IE until version 5.5
// Appends element to the array
function arraypush(thearray,value) {
        thearray[ getarraysize(thearray) ] = value;
}

// Replacement for arrayname.pop() not implemented in IE until version 5.5
// Removes and returns the last element of an array
function arraypop(thearray) {
        thearraysize = getarraysize(thearray);
        retval = thearray[thearraysize - 1];
        delete thearray[thearraysize - 1];
        return retval;
}




function raw(text) {
        var txtarea = document.getElementById('text');
        text = '' + text + '';
        if (txtarea.createTextRange && txtarea.caretPos) {
                var caretPos = txtarea.caretPos;
                caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
                txtarea.focus();
        } else {
                txtarea.value  += text;
                txtarea.focus();
        }

}

function bbfontstyle(bbopen, bbclose) {
        var txtarea = document.getElementById('text');

        if ((clientVer >= 4) && is_ie && is_win) {
                theSelection = document.selection.createRange().text;
                if (!theSelection) {
                        txtarea.value += bbopen + bbclose;
                        txtarea.focus();
                        return;
                }
                document.selection.createRange().text = bbopen + theSelection + bbclose;
                txtarea.focus();
                return;
        }
        else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
        {
                mozWrap(txtarea, bbopen, bbclose);
                return;
        }
        else
        {
                txtarea.value += bbopen + bbclose;
                txtarea.focus();
        }
        storeCaret(txtarea);
}


function bbstyle(bbnumber) {
        var txtarea = document.getElementById('text');

        txtarea.focus();
        donotinsert = false;
        theSelection = false;
        bblast = 0;

        if (bbnumber == -1) { // Close all open tags & default button names
                while (bbcode[0]) {
                        butnumber = arraypop(bbcode) - 1;
                        txtarea.value += bbtags[butnumber + 1];

                }
                imageTag = false; // All tags are closed including image tags :D
                txtarea.focus();
                return;
        }

        if ((clientVer >= 4) && is_ie && is_win)
        {
                theSelection = document.selection.createRange().text; // Get text selection
                if (theSelection) {
                        // Add tags around selection
                        document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
                        txtarea.focus();
                        theSelection = '';
                        return;
                }
        }
        else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
        {
                mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
                return;
        }

        // Find last occurance of an open tag the same as the one just clicked
        for (i = 0; i < bbcode.length; i++) {
                if (bbcode[i] == bbnumber+1) {
                        bblast = i;
                        donotinsert = true;
                }
        }

        if (donotinsert) {                // Close all open tags up to the one just clicked & default button names
                while (bbcode[bblast]) {
                                butnumber = arraypop(bbcode) - 1;
                                txtarea.value += bbtags[butnumber + 1];
                                imageTag = false;
                        }
                        txtarea.focus();
                        return;
        } else { // Open tags

                if (imageTag && (bbnumber != 14)) {                // Close image tag before adding another
                        txtarea.value += bbtags[15];
                        lastValue = arraypop(bbcode) - 1;        // Remove the close image tag from the list
                        document.post.addbbcode14.value = "Img";        // Return button back to normal state
                        imageTag = false;
                }

                // Open tag
                txtarea.value += bbtags[bbnumber];
                if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
                arraypush(bbcode,bbnumber+1);
                txtarea.focus();
                return;
        }
        storeCaret(txtarea);
}

// From http://www.massless.org/mozedit/
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;
}

// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
function storeCaret(textEl) {
        if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

function sethtmtext(htmt) {
        var txtarea = document.getElementById('text');
    txtarea.value = '';
        htmin=htmt;
}

function show(id)
{
        obj=document.getElementById(id);
        obj.style.display='block';
}

function hide(id)
{
        obj=document.getElementById(id);
        obj.style.display='none';
}

function showhide(id)
{
        obj=document.getElementById(id);
        if(obj.style.display=='none')
                show(id);
        else
                hide(id);

}

function shswap(id1,id2)
{
        showhide(id1);
        showhide(id2);

}

function validatepost()
{

        error='';
        if(document.getElementById('title').value=='')
                error='Не заполнен заголовок публкации';
        mkcurl('title','curl');
        if(document.getElementById('curl').value=='')
                error+='\nНеправильно заполнен заголовок публкации - не удаёться сформировать url';
        if(document.getElementById('text').value=='')
                error+='\nДелать пустую публикацию плохая идея )';



        if(error=='')
                return true
        else
        {
                alert(error);
                return false;

        }


}

var tr='a b v g d e ["zh","j"] z i y k l m n o p r s t u f h c ch sh ["shh","shch"] | y | e yu ya | ["jo","e"]'.split(' ');
function trim(name) {
    name = name.replace( /^\s+/g, '');
    name = name.replace( /\s+$/g, '');
    return name;
}
function urlLit(w,v) {
    w = trim(w);
    var ww='';
    w=w.toLowerCase().replace(/ /g,'_');
    for(i=0; i<w.length; ++i) {
        cc=w.charCodeAt(i);
        if (cc>=1072) {
            che=tr[cc-1072];
        } else {
            che=w[i];
        }
        //alert(typeof(che));
        if (typeof(che)=='string') {
            if(che.length<3) ww+=che; else ww+=eval(che)[v];
        }
    }
    ww = ww.replace(/[^a-z0-9-_\~]/gi, '_');
    ww = ww.replace(/_{2,}/g, '_');
    return(ww);

}

function mkcurl(src,dst)
{
        var NewText = trim(document.getElementById(src).value);
        var separator = "_";
        NewText = NewText.toLowerCase();

        if (separator != "_")
        {
                NewText = NewText.replace(/\_/g, separator);
        }
        else
        {
                NewText = NewText.replace(/\-/g, separator);
        }

        NewText = urlLit( trim(NewText), 0);
        NewText = NewText.replace( /^\_+/g, '');
        NewText = NewText.replace( /\_+$/g, '');
        document.getElementById(dst).value = NewText;


}
function s_z(event, full){
        var x = event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
        var y = event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
        if(full){var elementid='icon-zoom';}else{{var elementid='icon-in';}}
        document.getElementById(elementid).style.display = '';
        document.getElementById(elementid).style.left = x - 16 + 'px';
        document.getElementById(elementid).style.top = y - 15 + 'px';
}
function h_z(full){
        if(full){var elementid='icon-zoom';}else{{var elementid='icon-in';}}
        document.getElementById(elementid).style.display = 'none';
}


function Insert(text,Id) {
var txtarea = document.getElementById(Id);
        text = '' + text + '';
        if (txtarea.createTextRange && txtarea.caretPos) {
                var caretPos = txtarea.caretPos;
                caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
                txtarea.focus();
        } else {
                txtarea.value  += text;
                txtarea.focus();
        }
}

function ob_new(id_ob) {
return document.getElementById? document.getElementById(id_ob) : document.all(id_ob);
}

if(typeof(bsn)=="undefined")_b=bsn={};if(typeof(_b.Autosuggest)=="undefined")_b.Autosuggest={};else alert("Autosuggest is already set!");_b.AutoSuggest=function(b,c){if(!document.getElementById)return 0;this.fld=_b.DOM.gE(b);if(!this.fld)return 0;this.sInp="";this.nInpC=0;this.aSug=[];this.iHigh=0;this.oP=c?c:{};var k,def={minchars:1,meth:"get",varname:"input",className:"autosuggest",timeout:2500,delay:500,offsety:-5,shownoresults:true,noresults:"No results!",maxheight:250,cache:true,maxentries:25};for(k in def){if(typeof(this.oP[k])!=typeof(def[k]))this.oP[k]=def[k]}var p=this;this.fld.onkeypress=function(a){return p.onKeyPress(a)};this.fld.onkeyup=function(a){return p.onKeyUp(a)};this.fld.setAttribute("autocomplete","off")};_b.AutoSuggest.prototype.onKeyPress=function(a){var b=(window.event)?window.event.keyCode:a.keyCode;var c=13;var d=9;var e=27;var f=1;switch(b){case c:this.setHighlightedValue();f=0;break;case e:this.clearSuggestions();break}return f};_b.AutoSuggest.prototype.onKeyUp=function(a){var b=(window.event)?window.event.keyCode:a.keyCode;var c=38;var d=40;var e=1;switch(b){case c:this.changeHighlight(b);e=0;break;case d:this.changeHighlight(b);e=0;break;default:this.getSuggestions(this.fld.value)}return e};_b.AutoSuggest.prototype.getSuggestions=function(a){if(a==this.sInp)return 0;_b.DOM.remE(this.idAs);this.sInp=a;if(a.length<this.oP.minchars){this.aSug=[];this.nInpC=a.length;return 0}var b=this.nInpC;this.nInpC=a.length?a.length:0;var l=this.aSug.length;if(this.nInpC>b&&l&&l<this.oP.maxentries&&this.oP.cache){var c=[];for(var i=0;i<l;i++){if(this.aSug[i].value.substr(0,a.length).toLowerCase()==a.toLowerCase())c.push(this.aSug[i])}this.aSug=c;this.createList(this.aSug);return false}else{var d=this;var e=this.sInp;clearTimeout(this.ajID);this.ajID=setTimeout(function(){d.doAjaxRequest(e)},this.oP.delay)}return false};_b.AutoSuggest.prototype.doAjaxRequest=function(b){if(b!=this.fld.value)return false;var c=this;if(typeof(this.oP.script)=="function")var d=this.oP.script(encodeURIComponent(this.sInp));else var d=this.oP.script+this.oP.varname+"="+encodeURIComponent(this.sInp);if(!d)return false;var e=this.oP.meth;var b=this.sInp;var f=function(a){c.setSuggestions(a,b)};var g=function(a){};var h=new _b.Ajax();h.makeRequest(d,e,f,g)};_b.AutoSuggest.prototype.setSuggestions=function(a,b){if(b!=this.fld.value)return false;this.aSug=[];if(this.oP.json){var c=eval('('+a.responseText+')');for(var i=0;i<c.results.length;i++){this.aSug.push({'id':c.results[i].id,'value':c.results[i].value,'info':c.results[i].info})}}else{var d=a.responseXML;var e=d.getElementsByTagName('results')[0].childNodes;for(var i=0;i<e.length;i++){if(e[i].hasChildNodes())this.aSug.push({'id':e[i].getAttribute('id'),'value':e[i].childNodes[0].nodeValue,'info':e[i].getAttribute('info')})}}this.idAs="as_"+this.fld.id;this.createList(this.aSug)};_b.AutoSuggest.prototype.createList=function(b){var c=this;_b.DOM.remE(this.idAs);this.killTimeout();if(b.length==0&&!this.oP.shownoresults)return false;var d=_b.DOM.cE("div",{id:this.idAs,className:this.oP.className});var e=_b.DOM.cE("div",{className:"as_corner"});var f=_b.DOM.cE("div",{className:"as_bar"});var g=_b.DOM.cE("div",{className:"as_header"});g.appendChild(e);g.appendChild(f);d.appendChild(g);var h=_b.DOM.cE("ul",{id:"as_ul"});for(var i=0;i<b.length;i++){var j=b[i].value;var k=j.toLowerCase().indexOf(this.sInp.toLowerCase());var l=j.substring(0,k)+"<em>"+j.substring(k,k+this.sInp.length)+"</em>"+j.substring(k+this.sInp.length);var m=_b.DOM.cE("span",{},l,true);if(b[i].info!=""){var n=_b.DOM.cE("br",{});var o=_b.DOM.cE("small",{},b[i].info);m.appendChild(o)}var a=_b.DOM.cE("a",{href:"#"});var p=_b.DOM.cE("span",{className:"tl"}," ");var q=_b.DOM.cE("span",{className:"tr"}," ");a.appendChild(p);a.appendChild(q);a.appendChild(m);a.name=i+1;a.onclick=function(){c.setHighlightedValue();return false};a.onmouseover=function(){c.setHighlight(this.name)};var r=_b.DOM.cE("li",{},a);h.appendChild(r)}if(b.length==0&&this.oP.shownoresults){var r=_b.DOM.cE("li",{className:"as_warning"},this.oP.noresults);h.appendChild(r)}d.appendChild(h);var s=_b.DOM.cE("div",{className:"as_corner"});var t=_b.DOM.cE("div",{className:"as_bar"});var u=_b.DOM.cE("div",{className:"as_footer"});u.appendChild(s);u.appendChild(t);d.appendChild(u);var v=_b.DOM.getPos(this.fld);d.style.left=v.x+"px";d.style.top=(v.y+this.fld.offsetHeight+this.oP.offsety)+"px";d.style.width=this.fld.offsetWidth+"px";d.onmouseover=function(){c.killTimeout()};d.onmouseout=function(){c.resetTimeout()};document.getElementsByTagName("body")[0].appendChild(d);this.iHigh=0;var c=this;this.toID=setTimeout(function(){c.clearSuggestions()},this.oP.timeout)};_b.AutoSuggest.prototype.changeHighlight=function(a){var b=_b.DOM.gE("as_ul");if(!b)return false;var n;if(a==40)n=this.iHigh+1;else if(a==38)n=this.iHigh-1;if(n>b.childNodes.length)n=b.childNodes.length;if(n<1)n=1;this.setHighlight(n)};_b.AutoSuggest.prototype.setHighlight=function(n){var a=_b.DOM.gE("as_ul");if(!a)return false;if(this.iHigh>0)this.clearHighlight();this.iHigh=Number(n);a.childNodes[this.iHigh-1].className="as_highlight";this.killTimeout()};_b.AutoSuggest.prototype.clearHighlight=function(){var a=_b.DOM.gE("as_ul");if(!a)return false;if(this.iHigh>0){a.childNodes[this.iHigh-1].className="";this.iHigh=0}};_b.AutoSuggest.prototype.setHighlightedValue=function(){if(this.iHigh){this.sInp=this.fld.value=this.aSug[this.iHigh-1].value;this.fld.focus();if(this.fld.selectionStart)this.fld.setSelectionRange(this.sInp.length,this.sInp.length);this.clearSuggestions();if(typeof(this.oP.callback)=="function")this.oP.callback(this.aSug[this.iHigh-1])}};_b.AutoSuggest.prototype.killTimeout=function(){clearTimeout(this.toID)};_b.AutoSuggest.prototype.resetTimeout=function(){clearTimeout(this.toID);var a=this;this.toID=setTimeout(function(){a.clearSuggestions()},1000)};_b.AutoSuggest.prototype.clearSuggestions=function(){this.killTimeout();var a=_b.DOM.gE(this.idAs);var b=this;if(a){var c=new _b.Fader(a,1,0,250,function(){_b.DOM.remE(b.idAs)})}};if(typeof(_b.Ajax)=="undefined")_b.Ajax={};_b.Ajax=function(){this.req={};this.isIE=false};_b.Ajax.prototype.makeRequest=function(a,b,c,d){if(b!="POST")b="GET";this.onComplete=c;this.onError=d;var e=this;if(window.XMLHttpRequest){this.req=new XMLHttpRequest();this.req.onreadystatechange=function(){e.processReqChange()};this.req.open("GET",a,true);this.req.send(null)}else if(window.ActiveXObject){this.req=new ActiveXObject("Microsoft.XMLHTTP");if(this.req){this.req.onreadystatechange=function(){e.processReqChange()};this.req.open(b,a,true);this.req.send()}}};_b.Ajax.prototype.processReqChange=function(){if(this.req.readyState==4){if(this.req.status==200){this.onComplete(this.req)}else{this.onError(this.req.status)}}};if(typeof(_b.DOM)=="undefined")_b.DOM={};_b.DOM.cE=function(b,c,d,e){var f=document.createElement(b);if(!f)return 0;for(var a in c)f[a]=c[a];var t=typeof(d);if(t=="string"&&!e)f.appendChild(document.createTextNode(d));else if(t=="string"&&e)f.innerHTML=d;else if(t=="object")f.appendChild(d);return f};_b.DOM.gE=function(e){var t=typeof(e);if(t=="undefined")return 0;else if(t=="string"){var a=document.getElementById(e);if(!a)return 0;else if(typeof(a.appendChild)!="undefined")return a;else return 0}else if(typeof(e.appendChild)!="undefined")return e;else return 0};_b.DOM.remE=function(a){var e=this.gE(a);if(!e)return 0;else if(e.parentNode.removeChild(e))return true;else return 0};_b.DOM.getPos=function(e){var e=this.gE(e);var a=e;var b=0;if(a.offsetParent){while(a.offsetParent){b+=a.offsetLeft;a=a.offsetParent}}else if(a.x)b+=a.x;var a=e;var c=0;if(a.offsetParent){while(a.offsetParent){c+=a.offsetTop;a=a.offsetParent}}else if(a.y)c+=a.y;return{x:b,y:c}};if(typeof(_b.Fader)=="undefined")_b.Fader={};_b.Fader=function(a,b,c,d,e){if(!a)return 0;this.e=a;this.from=b;this.to=c;this.cb=e;this.nDur=d;this.nInt=50;this.nTime=0;var p=this;this.nID=setInterval(function(){p._fade()},this.nInt)};_b.Fader.prototype._fade=function(){this.nTime+=this.nInt;var a=Math.round(this._tween(this.nTime,this.from,this.to,this.nDur)*100);var b=a/100;if(this.e.filters){try{this.e.filters.item("DXImageTransform.Microsoft.Alpha").opacity=a}catch(e){this.e.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='+a+')'}}else{this.e.style.opacity=b}if(this.nTime==this.nDur){clearInterval(this.nID);if(this.cb!=undefined)this.cb()}};_b.Fader.prototype._tween=function(t,b,c,d){return b+((c-b)*(t/d))};

var qiqb_timer = false;
function show_qiqb_popup(item)
{
    clearTimeout(qiqb_timer);
    var left=0,top=0;
    var style=item.parentNode.lastChild.style;
    var element=item.parentNode.firstChild;

    while (element) {
        left+=element.offsetLeft;
        top+=element.offsetTop;
        element=element.offsetParent;
    }
    style.left=left+'px';
    style.top=top+17+'px';
    style.visibility='visible';
        item.parentNode.lastChild.style.visibility = 'visible';
}
function hide_qiqb_popup(item)
{
    qiqb_timer = setTimeout(
                function() {
                        item.parentNode.lastChild.style.visibility = 'hidden';
                }
        ,1000);
}
function qiqb_selection()
{
        var sel='';
        if (window.getSelection)
                sel=window.getSelection();
        else if (document.selection)
                sel=document.selection.createRange();
        else
                sel='';
        if (sel.text)
                sel=sel.text;
        return sel;
}

function getBrowserInfo() {
 var t,v = undefined;
 if (window.opera) t = 'Opera';
 else if (document.all) {
  t = 'IE';
  var nv = navigator.appVersion;
  var s = nv.indexOf('MSIE')+5;
  v = nv.substring(s,s+1);
 }
 else if (navigator.appName) t = 'Netscape';
 return {type:t,version:v};
}

function bookmark(a){
 var url = window.document.location;
 var title = window.document.title;
 var b = getBrowserInfo();
 if (b.type == 'IE' && 7 > b.version && b.version >= 4) window.external.AddFavorite(url,title);
 else if (b.type == 'Opera') {
  a.href = url;
  a.rel = "sidebar";
  a.title = title;
  return true;
 }
 else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
 else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки браузера.");
 return false;
}

function qiqbtn()
{
        var title=encodeURIComponent(document.title);
        var url=encodeURIComponent(location.href);

        this.links = [
                {name:'Memory', link:'http://memori.qip.ru/link/?sm=1&u_data[url]='+url+'&u_data[name]='+title, pos:'-320px 0' },
                {name:'БобрДобр', link:'http://bobrdobr.ru/addext.html?url='+url+'&title='+title, pos:'-320px -144px' },
                {name:'Google', link:'http://www.google.com/bookmarks/mark?op=add&bkmk='+url+'&title='+title, pos:'-320px -16px' },
                {name:'Яндекс', link:'http://zakladki.yandex.ru/userarea/links/addfromfav.asp?bAddLink_x=1&lurl='+url+'&lname='+title, pos:'-320px -160px' },
                {name:'Twitter', link:'http://twitter.com/home?status='+title+' '+url, pos:'-320px -32px' },
                {name:'Delicious', link:'http://del.icio.us/post?v=4&noui&jump=close&url='+url+'&title='+title, pos:'-320px -176px' },
                {name:'Yahoo!', link:'http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+url+'&t='+title, pos:'-427px -112px' },
                {name:'Facebook', link:'http://www.facebook.com/share.php?u='+url+'&t='+title, pos:'-427px -144px' },
                {name:'LiveJournal', link:'http://www.livejournal.com/update.bml?subject='+title+'&event=%3Ca+href%3D%22'+url+'%22%3E'+title+'%3C%2Fa%3E%0A%0A', pos:'-427px -96px' },
                {name:'Текст 2.0', link:'http://text20.ru/add/?source='+url+'&title='+title+'&text='+qiqb_selection(), pos:'-320px -48px' },
                {name:'News 2', link:'http://news2.ru/add_story.php?url='+url, pos:'-320px -192px' },
                {name:'MySpace', link:'http://www.myspace.com/Modules/PostTo/Pages/?u='+url+'&t='+title+'&c=%3Ca+href%3D%22'+url+'%3E'+title+'%3C%2Fa%3E%0A', pos:'-427px -128px' },
                {name:'Мистер Вонг', link:'http://www.mister-wong.ru/index.php?action=addurl&bm_url='+url+'&bm_description='+title, pos:'-320px -64px' },
                {name:'Моё Место', link:'http://moemesto.ru/post.php?url='+url+'&title='+title, pos:'-427px 0' },
                {name:'СМИ 2', link:'http://smi2.ru/add/?url='+url+'&precaption='+title, pos:'-320px -80px' },
                {name:'Baay!', link:'http://www.vaau.ru/submit/?action=step2&url='+url, pos:'-427px -16px' },
                {name:'LinkStore', link:'http://www.linkstore.ru/servlet/LinkStore?a=add&url='+url+'&title='+title, pos:'-427px -32px' },
                {name:'RuSpace', link:'http://www.ruspace.ru/index.php?link=bookmark&action=bookmarkNew&bm=1&url='+url+'&title='+title, pos:'-320px -112px' },
                {name:'Сто закладок', link:'http://www.100zakladok.ru/save/?bmurl='+url+'&bmtitle='+title, pos:'-427px -48px' }
        ];

        var height = 126;
        var btype = '';
        if (btype == '')
        {
                var width = 320;
                btype = '.gif';
        } else {
                var width = 68;
                btype = '_small.png';
        }

        document.write('<div class="buttonbox">');
        document.write('<a id="qiqb" onmouseover="show_qiqb_popup(this)" onmouseout="hide_qiqb_popup(this)" style="display:-moz-inline-box; display:inline-block; width:'+width+'px; height:20px; padding:4px 0 0 27px; color:#000; font-family:arial; font-size:10px; font-style:normal; font-weight:normal; font-variant:normal; color:#000; text-decoration:none; text-transform:uppercase; line-height:normal; font-size-adjust:none; text-align:left; background:url(im/qiqbm1.png) no-repeat 0 0" title="Добавить в закладки">Закладки</a>');
        document.write('<div onmouseover="show_qiqb_popup(this)" onmouseout="hide_qiqb_popup(this)" id="qiqb_popup" style="position:absolute; left:0; top:17px; visibility:hidden;"><div style="height:'+height+'px;width:312px; z-index:1000; background:url(im/qiqbm.png) no-repeat 0 0; padding:8px 0 8px 8px; margin:0; border:0">');
        document.write('<a onclick="return bookmark(this)"  href="#" style="display:block; float:left; width:82px; height:16px; overflow:hidden; padding:0 0 0 21px; margin:0 0 1px 0; font-family:arial; font-size:12px; font-style:normal; font-weight:normal; font-variant:normal; color:#000; text-decoration:none; line-height:normal; font-size-adjust:none; text-align:left">Закладки</a>');

        for(var l in this.links)
        {
                document.write('<a href="'+this.links[l].link+'" style="display:block; float:left; width:82px; height:16px; overflow:hidden; padding:0 0 0 21px; margin:0 0 1px 0; background:url(im/qiqbm.png) no-repeat '+this.links[l].pos+'; font-family:arial; font-size:12px; font-style:normal; font-weight:normal; font-variant:normal; color:#000; text-decoration:none; line-height:normal; font-size-adjust:none; text-align:left">'+this.links[l].name+'</a>');
        }
        document.write('</div>');
        document.write('<div style="position:absolute; left:0; top:'+(height+8)+'px;width:320px;height:18px;background:url(im/qiqbm.png) no-repeat 0px -177px; clear:both; font-family:arial; font-size:11px; font-style:normal; font-weight:normal; font-variant:normal; color:#FF6600; text-decoration:none; line-height:normal; font-size-adjust:none; text-align:center">qiq</div>');
        document.write('</div></div>');

}


