isDOM=document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
isOpera=isOpera5=window.opera && isDOM //Opera 5+
isOpera6=isOpera && window.print //Opera 6+
isOpera7=isOpera && document.readyState //Opera 7+
isMSIE=document.all && document.all.item && !isOpera //Microsoft Internet Explorer 4+
isMSIE5=isDOM && isMSIE //MSIE 5+
isNetscape4=document.layers //Netscape 4.*
isMozilla=isDOM && navigator.appName=="Netscape" //Mozilla или Netscape 6.*


function initScroller() {
  if (window.document.body.clientHeight && window.document.body.scrollHeight) {
    var docAvail  = window.document.body.clientHeight;
    var docInNeed = window.document.body.scrollHeight;

    if (docInNeed<=docAvail) {
      if (window.document.getElementById("goOnTop1")) {
        window.document.getElementById("goOnTop1").style.display = "none";
        window.document.getElementById("goOnTop2").style.display = "none";
        window.document.getElementById("goOnTop3").style.display = "none";
      }
    }
  }
}

// function for popup ---------------------------
function advOpen(openUrl, openWidth, openHeight) {

  if (screen) {
    var s   = screen;
    var srw = s.width-50;
    var srh = s.height-36;
  } else {
    var srw = 750;
    var srh = 564;
  }

  if ((openWidth>srw) || (openHeight>srh)) {
    openScroll  = "1";
    if (openHeight>srh) { openWidth  = openWidth+16; openHeight = srh-50; }
    if (openWidth>srw)  { openHeight = openHeight+16; openWidth = srw-50; }
  } else {
    openScroll  = "0";
  }

  srw     = (srw - openWidth)/2;
  srh     = (srh - openHeight)/5;

  var UTCstring;
  Today = new Date();
  UTCstring = Today.getUTCHours()*Today.getUTCMinutes()*Today.getUTCSeconds();
  
  var openName;
  openName        = "openPopup"+UTCstring;
  openParameters  = "left="+srw+",top="+srh+",outerHeight=0,innerWidth,width="+openWidth+",innerHeight,height="+openHeight+",scrollbars="+openScroll+",titlebar=1,resizable=0";


//  if (window.openPopup) { if (!window.openPopup.closed) { window.openPopup.close(); } }
  
  openPopup = open(openUrl, openName, openParameters);

  return false;
}




// functions for layers -------------------------
function layerStyle(layerObject){
  if(layerObject.style) return layerObject.style //доступ через style
  return layerObject //доступ без style
}
function layer(layerName){
  if(document.getElementById) return document.getElementById(layerName)
  if(document.all) return document.all[layerName]
  if(document.layers) return document.layers[layerName]
  return null
}

function advOpenPrint(openUrl, openWidth, openHeight) {
  if (screen) {
    var s   = screen;
    var srw = s.width-50;
    var srh = s.height-36;
  } else {
    var srw = 750;
    var srh = 564;
  }

  if ((openWidth>srw) || (openHeight>srh)) {
    openScroll  = "1";
    if (openHeight>srh) { openWidth  = openWidth+16; openHeight = srh-50; }
    if (openWidth>srw)  { openHeight = openHeight+16; openWidth = srw-50; }
  } else {
    openScroll  = "0";
  }

  srw     = (srw - openWidth)/2;
  srh     = (srh - openHeight)/5;

  var UTCstring;
  Today = new Date();
  UTCstring = Today.getUTCHours()*Today.getUTCMinutes()*Today.getUTCSeconds();
  
  var openName;
  openName        = "openPopup"+UTCstring;
  openParameters  = "left="+srw+",top="+srh+",outerHeight=0,innerWidth,width="+openWidth+",innerHeight,height="+openHeight+",scrollbars=1,titlebar=1,resizable=0,menubar=1";

  if (window.openPopup) { if (!window.openPopup.closed) { window.openPopup.close(); } }
  
  openPopup = open(openUrl, openName, openParameters);

  return false;
}


function printPage() {
  var pr = (window.print) ? 1 : 0;
  if (pr) // NS4, IE5
    window.print()
  else if (da && !mac) // IE4 (Windows)
    vbPrintPage()
  else // muut
    alert("Can't Print");
}
