function show_big_map(id, width, height)
{ 
 url = "http://aidb.ru/uploads/maps/"+id+".jpg";
 window.open(url, "screen", "width="+width+", height="+height+", resizable=no, scrollbars=no");
}
function show_big_npc(id, width, height)
{ 
 url = "http://aidb.ru/uploads/mobs/"+id+".jpg";
 window.open(url, "screen", "width="+width+", height="+height+", resizable=no, scrollbars=no");
}
function show_big_item(id, width, height)
{ 
 url = "http://aidb.ru/uploads/items/"+id+".jpg";
 window.open(url, "screen", "width="+width+", height="+height+", resizable=no, scrollbars=no");
}
function show_big_loc(id, loc_id)
{ 
 url = "http://aidb.ru/engine/user/view_map.php?id="+id+"&loc_id="+loc_id+"&big";
 window.open(url, "screen", "width=620, height=495, resizable=no, scrollbars=no");
}
function show_gath_loc(id, loc_id)
{ 
 url = "http://aidb.ru/engine/user/gath_map.php?id="+id+"&loc_id="+loc_id+"&big";
 window.open(url, "screen", "width=620, height=495, resizable=no, scrollbars=no");
}
function show_big(id, width, height)
{ 
 url = "http://aidb.ru/uploads/gallery/"+id+"_big.jpeg";
 window.open(url, "screen", "width="+width+", height="+height+", resizable=no, scrollbars=no");
}
var clientPC = navigator.userAgent.toLowerCase();
var clientVer = parseInt(navigator.appVersion);
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);



function mozWrap(txtarea, open, close, somevalue)
{
    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);
    if (s2!='') {
        txtarea.value = s1 + open + s2 + close + s3;
    }
    else {
        if(somevalue) txtarea.value = s1 + open + somevalue + close + s3;
    }
    return;
}


function tags(context, tag)
{
    var m=document.getElementById(context);
    if(m){
        m.focus();
        if ((clientVer >= 4) && is_ie && is_win)
        {
            sel = document.selection.createRange();
            sel.text = '['+tag+']'+sel.text+'[/'+tag+']';
        }
        else {
            mozWrap(m, '['+tag+']', '[/'+tag+']');
        }
        m.focus();
    }
}


function resize(id, act){
var current_height = document.getElementById(id).style.height.replace('px', '')-0;
if(act=="plus"){
document.getElementById(id).style.height=(current_height+50)+'px';
}
if(act=="minus" && current_height > 130){
document.getElementById(id).style.height=(current_height-50)+'px';
}
}