function $i(id)
{
    return document.getElementById(id);
}
function $V(id)
{
    return document.getElementById(id).value;
}
var Page = new Object();
Page.width=0;
Page.height=0;
Page.top=0;

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();
}

Page.loadOut = function ()
{
    $('loading').innerHTML ='';
}
Page.getPageCenterX = function ()
{
        var fWidth;
        var fHeight;
        var width;
        var top;
        //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 DoMsg(msg,hide,win)
{
    //message]
    if (!win || win=="")
    {
      var win='';
     var window=$('msgInfo');
    }else if ($(win))
    {
          var window=$(win);
    }
    if (!hide)
    {
        window.style.display="";        
    }else
    {
        window.style.display="none";
        show_msg_doing=1;
        return;
    }
    window.innerHTML="<span class=\"text\"><b>"+msg+"</b></span>";
    setTimeout('DoMsg(0,1,\''+win+'\');',3000);
}

