var busy_timer;

function openpop(url,x,y)
{
    if (!x) x = 600; if (!y) y = 600;
    var left = (screen.width-x)/2;
    var top  = 60;

    window.open(url, "", "width="+x+", height="+y+", left="+left+", top="+top+", menubar=no, status=no, scrollbars=yes");
    return(false);
}

function loginsubm()
{
    if (!loginform.login.value || !loginform.pass.value)
    {
       window.alert('Ââåäèòå ëîãèí/ïàðîëü');
       return false;
    }

    loginform.submit();
}

function showBusyLayer() {
        var busyLayer = document.getElementById("busy_layer");

    if (window.innerHeight && window.scrollMaxY) {    
        yScroll = window.innerHeight + window.scrollMaxY;
        var deff = document.documentElement;
        var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
        yScroll -= (window.innerHeight - hff);
    } else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth){
        yScroll = document.body.scrollHeight;
    } else { 
        yScroll = document.body.offsetHeight;
      }

    if (busyLayer != null) {
        busyLayer.style.visibility = "visible";
        busyLayer.style.height = yScroll;
    }
};

function hideBusyLayer() {
        var busyLayer = document.getElementById("busy_layer");
        if (busyLayer != null) {
            busyLayer.style.visibility = "hidden";
            busyLayer.style.height = "0px";
        }
};


function startbusytimer()
{
   busy_timer = window.setTimeout("dobusy(true);", 500);
}

function dobusy(busy)
{
  busy_frame = document.getElementById('busy_frame');

  if (busy)
  {
     busy_frame.style.display='';

     windowWidth  = window.navigator.userAgent.indexOf("MSIE") >= 0 ? document.body.clientWidth : document.documentElement.clientWidth;
     windowHeight = window.navigator.userAgent.indexOf("MSIE") >= 0 ? document.body.clientHeight : document.documentElement.clientHeight;

     busy_frame.style.top  = 300 + document.body.scrollTop;
     busy_frame.style.left = (windowWidth - 20) / 2;
  }
  else
  {
     busy_frame.style.display='none';
     clearInterval(busy_timer);
  }
}
