function $i(id)
{
    return document.getElementById(id);
}
function $V(id)
{
    return document.getElementById(id).value;
}

function FormEnable(form,param)
{
    if (param==true)
    {
        param=false;
    }else if(param==false)
    {
        param=true;
    }
    for(j=0; j<window.document.forms[form].elements.length; j++)
    {
        formObj=window.document.forms[form].elements[j];
        formObj.disabled=param;
    }
}
//***************************************************************************
function onShow(msg)
{
Page.getPageCenterX();
if (!msg)
{
    msg="&nbsp;&nbsp;Загрузка...";
}
$('loading').style.top = (Page.top + Page.height/2)-100;
$('loading').style.left = Page.width/2-75;
$('loading').style.position = "absolute";
$('loading').innerHTML = "<table border=0 cellpadding=0 cellspacing=0 width=160 style='border:1px solid grey'><tr><td align=center class=loading height=45 bgcolor=#ffffff><img src='"+tpl_dir+"/images/snake_transparent.gif' width=16px height=16px/></td><td align=center valign=middle height=45 bgcolor=#ffffff><span class='text2'>"+msg+"</span></td></tr></table>";
}

function onHide()
{
    Page.loadOut();
}

var Page = new Object();
Page.width;
Page.height;
Page.top;

Page.loadOut = function ()
{
    $('loading').innerHTML ='';
}
Page.getPageCenterX = function ()
{
        var fWidth;
        var fHeight;
        //For old IE browsers
        if(document.all)
        {
        fWidth = document.body.clientWidth;
        fHeight = document.body.clientHeight;
        }
        //For DOM1 browsers
        else if(document.getElementById &&!document.all)
        {
        fWidth = innerWidth;
        fHeight = innerHeight;
        }
        else if(document.getElementById)
        {
        fWidth = innerWidth;
        fHeight = innerHeight;
        }
        //For Opera
        else if (is.op)
        {
        fWidth = innerWidth;
        fHeight = innerHeight;
        }
        //For old Netscape
        else if (document.layers)
        {
        fWidth = window.innerWidth;
        fHeight = window.innerHeight;
        }
    Page.width = fWidth;
    Page.height = fHeight;
    Page.top = window.document.body.scrollTop;
}
//***************************************************************************
function DoShowMsg(msg,hide,link)
{
    //message]
    var window=$('messageWindow');
    if (!hide)
    {
        window.style.display="";        
    }else
    {
        window.style.display="none";
        show_msg_doing=1;
        if (link)
        {
            top.location.href=link;
        }
        return;
    }
    document.body.scrollTop = 0;
    window.innerHTML="<span class=\"text\"><b>"+msg+"</b></span>";
    setTimeout('DoShowMsg(0,1,\''+(link?link:"")+'\');',3000);
} 
function open_window(link,win_name,w,h,plus)
{
   if (!plus) plus=0;   
   var width=(screen.width/2)-w/2;
   var height=(screen.height/2)-h/2;
   var win = "width="+(w)+",height="+(h)+",menubar=no,location=no,resizable=yes,scrollbars=no,top="+height+",left="+width;
   newWin = window.open("",win_name,win);
   newWin.document.write("<html><body topmargin='0' leftmargin='0'><a href='javascript:window.close();'><img src='"+link+"' width='"+w+"' height='"+h+"' border='0'></a></body></html>");
};
function showObject(obj) { 
					obj.className = "visible"
				}
				function hideObject(obj) { 
					obj.className = "hidden"
				}
