function openViewPage(url, w, h, l, t)
{
  open(url, "_blank", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=' + w + ',height=' + h + ',left=' + l + ', top=' + t + ',screenX=' + l + ',screenY=' + t);

}

//  ---------------------------------------

function getNextSibling(startBrother)
{
  endBrother = startBrother.nextSibling;
  while(endBrother && endBrother.nodeType != 1)
  {
    endBrother = endBrother.nextSibling;
  }
  return endBrother;
}

//  ---------------------------------------

function getFirstChild(startParent)
{
  endNode = startParent.firstChild;
  while(endNode && endNode.nodeType != 1)
  {
    endNode = endNode.firstChild;
  }
  return endNode;
}

//  ---------------------------------------

function ShowArticleImagePopup(e, w, h, p)
{
  var desc = '';
  try
  {
    var el = getNextSibling(e.parentNode.parentNode);
    // tr
    el = el.offsetParent;
    // table
    if (el.rows.length > 1)
    {
      el = el.rows[1].cells[0];
      if (el.className == 'sgtoimageleft')
      desc = el.innerHTML;
    }
  }
  catch (err)
  {
    desc = '';
  }
  
  

  myLightWindow.activateWindow(
  {
    loadingAnimation : false,
    href : p,
    caption : desc,
    title : '',
    height : h,
    width : w,
    author : '(C) SGTO'
  }
  );
}

//  ---------------------------------------

function CheckAll(objName, checked)
{
  for (var i = 0; i < document.forms[0].elements.length; i ++ )
  {
    var e = document.forms[0].elements[i];
    if (e.name == objName)
    e.checked = checked;
  }
}

//  ---------------------------------------

function Chk_BeforeSubmit(objName, Msg)
{
  for (var i = 0; i < document.forms[0].elements.length; i ++ )
  {
    var e = document.forms[0].elements[i];
    if (e.name == objName)
    if(e.checked)
    return true;
  }
  alert(Msg);
  return false;
}

//  ---------------------------------------

function CountChecked(objName)
{
  var n = 0;
  for (var i = 0; i < document.forms[0].elements.length; i ++ )
  {
    var e = document.forms[0].elements[i];
    if (e.name == objName)
    if(e.checked)
    n ++
  }
  return n;
}

//  ---------------------------------------

function SelectedAll(objName)
{
  for (var i = 0; i < document.forms[0].elements.length; i ++ )
  {
    var e = document.forms[0].elements[i];
    if (e.name == objName)
    if( ! e.checked)
    return false;
  }
  return true;
}

//  ---------------------------------------

function Item_Select(obj, Lobj)
{
  var objTemp = document.getElementById(obj);
  if(objTemp)
  objTemp.checked = SelectedAll(Lobj);
}

//  ---------------------------------------

function Messages(msg)
{
  alert(msg);
  return false;
}

//  ---------------------------------------

function ConfirmOption(msgEmty, msgQuestion)
{
  if( ! Chk_BeforeDelete(msgEmty))
  return false;
  return confirm(msgQuestion);
}

//  ---------------------------------------

function Chk_BeforeDelete(msgEmty)
{
  for (var i = 0; i < document.forms[0].elements.length; i ++ )
  {
    var e = document.forms[0].elements[i];
    if (e.name == 'iptSelect')
    if(e.checked)
    return true;
  }
  alert(msgEmty);
  return false;
}

function getInnerSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return [ myWidth,  myHeight ];
}


function GetContentHTML(target, strURL){
    AjaxRequest.get(
    {
        'url':strURL
        ,'onLoading':function() { target.innerHTML = "" }
        ,'onSuccess':function(req){ 
            target.innerHTML = req.responseText;
        }
        ,'onError':function(req){ target.innerHTML = "" ;}
      }
    );
}

function GetXML1(obj, c, m)
{
    var now = new Date();
   GetContentHTML(document.getElementById(obj), "/XML/1.aspx?d=" + now + "&c=" + c + "&m=" +m);
}


function GetXML2(obj, c, l, t)
{
    var now = new Date();
    GetContentHTML(document.getElementById(obj), "/XML/2.aspx?d=" + now + "&c=" + c + "&l=" + l + "&t=" + t);
}

function GetXML2(obj, c, l, t, vt)
{
    var now = new Date();
    GetContentHTML(document.getElementById(obj), "/XML/2.aspx?d=" + now + "&c=" + c + "&l=" + l + "&t=" + t + "&vt=" + vt);
}


function GetXML3(obj, t, m)
{
    var now = new Date();
   GetContentHTML(document.getElementById(obj), "/XML/3.aspx?d=" + now + "&t=" + t + "&m=" + m);
}

function GetXML4(obj, s)
{
    var now = new Date();
   GetContentHTML(document.getElementById(obj), "/XML/4.aspx?d=" + now + "&s=" + s);
}

function GetXML5(obj, s)
{
    var now = new Date();
   GetContentHTML(document.getElementById(obj), "/XML/5.aspx?d=" + now + "&s=" + s);
}

function GetXML6(obj, s)
{
    var now = new Date();
   GetContentHTML(document.getElementById(obj), "/XML/6.aspx?d=" + now);
}

function GetXML7(obj, c, m)
{
    var now = new Date();
   GetContentHTML(document.getElementById(obj), "/XML/7.aspx?d=" + now + "&c=" + c + "&m=" +m);
}

function GetXML8(obj, c, m)
{
    var now = new Date();
   GetContentHTML(document.getElementById(obj), "/XML/8.aspx?d=" + now + "&c=" + c + "&m=" +m);
}

function GetXML9(obj, c, m)
{
    var now = new Date();
   GetContentHTML(document.getElementById(obj), "/XML/9.aspx?d=" + now + "&c=" + c + "&m=" +m);
}

function GetXML10(obj, c, m)
{
    var now = new Date();
   GetContentHTML(document.getElementById(obj), "/XML/10.aspx?d=" + now + "&c=" + c + "&m=" +m);
}

function GetXML11(obj, c, m)
{
    var now = new Date();
   GetContentHTML(document.getElementById(obj), "/XML/11.aspx?d=" + now + "&c=" + c + "&m=" +m);
}