function switchUserStatus(userID) { 
    o = new XMLHttpRequest();
    o.onload = null;
    o.open("GET", "/my/user/"+userID+"/screen", false);
    o.send(null);
    st = document.getElementById('a_status_'+userID).innerHTML;
    st = ("screen" == st) ? "unscreen" : "screen";
    document.getElementById('a_status_'+userID).innerHTML=st;
    }
function switchNodeStatus(nodeID) {
//return    alert('rec='+nodeID);
    o = new XMLHttpRequest();
    o.onload = null;
    o.open("GET",nodeID,false);
    o.send(null);
    //st = document.getElementById('a_status_'+nodeID).innerHTML;
    //st = ("screen" == st) ? "unscreen" : "screen";
    //document.getElementById('a_status_'+nodeID).innerHTML=st;
    vbmenu_close();
    }
function fa_baseIDs () {
    o = new XMLHttpRequest();
    o.onload = null;
    o.open("POST", "/base.php", false);
    o.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    a = document.forms['setID'].elements;
    var param = '';
    for (i=0;i<a.length;i++) {
        if ((0 != a[i].value) && ("setIDs" != a[i].name) ) {
            param = param+a[i].name+'='+a[i].value+'&';
            document.getElementsByName(a[i].name)[0].parentNode.parentNode.style.display = 'none';
            }
        }
    if (param != '') {
        param = param+'setIDs=on'; 
        o.send(param);
        }
    else {
        alert('Nothing to submit');
        }
    }
function doGenerateActionsMenu(that,elemid) {
    //var elm = that.parentNode;
//   alert('n='+elm.tagName);
//    that.style.display = 'block';
//    that.innerHTML = "<div style='z-index:15;display:none;' id='small_manageNode_menu'>test</div>";
//    that.innerHTML += "<a href='#'>Действия</a> <script type='text/javascript'> vbmenu_register('small_manageNode'); </script>";
//    that.innerHTML += "<div style='z-index:15;display:none;' id='small_manageNode_menu'>test</div>";
    }


function __getScrollY (document) {
    var scrollY = 0;
  if( document.documentElement && document.documentElement.scrollTop ) {
    return document.documentElement.scrollTop;
  }
  else if( document.body && document.body.scrollTop ) {
    return document.body.scrollTop;
  }
  else if( window.pageYOffset ) {
    return window.pageYOffset;
  }
  else if( window.scrollY ) {
    return window.scrollY;
  }
  return scrollY;

    }
function is_IE6() {
    var agt=navigator.userAgent.toLowerCase();
    var is_major = parseInt(navigator.appVersion);
    return  (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
    }

function ya_GBdoCalc() {
    trans   = document.getElementById('ya_gbCalc');
    trans.style.height = Math.max(document.body.clientHeight,document.documentElement.clientHeight)+'px';
//    trans.style.height = (document.body.clientHeight)+'px';
    trans.style.width = (document.body.clientWidth)+'px'; // ### @fixme : doesn't work !!!
    trans.style.display='block';
    return true;
    }   

function setPositionX (block,marge,shift) {
    if (is_IE6()) { block.style.width=(document.documentElement.clientWidth-2*marge)+'px'; }
    else { block.style.right = (marge-shift)+'px'; }
    return true;
    }
function setPositionY (block,marge,shift) {
    scrollY = document.documentElement.scrollTop;
    if (is_IE6()) { block.style.height=(document.documentElement.clientHeight-3*marge)+'px'; }
    else { block.style.bottom = (marge-shift-scrollY)+'px'; }
    return true;

    }

function ya_showGB(url,message) {
    if (is_IE6()) {
   //     return ya_showGB_ie6(url,message);
        }
//    document.body.style.scroll='no';
    scrollY = document.documentElement.scrollTop;
    ya_GBdoCalc();
    dc      = document.getElementById('ya_gbContainer');
    title   = document.getElementById('ya_gbTitle');
    shad    = document.getElementById('ya_gbShadow');

    dc.innerHTML = "<iframe id='ya_gbFrame' scrolling='yes' src=''></iframe>";
    iframe  = document.getElementById('ya_gbFrame');

    dc.style.top=(scrollY+25)+'px';
    dc.style.left='25px';
    setPositionX(dc,25,0);
    setPositionY(dc,25,0);

    shad.style.left='35px';
    shad.style.top=(scrollY+35)+'px';
    setPositionX(shad,25,10);
    setPositionY(shad,25,10);

    title.style.top=(scrollY+25)+'px';
    title.style.left='25px';
    setPositionX(title,25,0);
//    title.style.display='block';

    shad.style.display='block';
 

    dc.style.display='block';

    title.innerHTML = "<img src='/my/images/close.png' onClick='javascript:ya_GBLocalClose_();'><span>"+message+"</span>";
    title.style.display = 'block';

//        if (message) {
//            document.getElementById('ya_gbTitle').elements[0].innerHTML='toto';
//            }
//    alert('w='+iframe.parentNode.style.width);
//    alert('ri='+iframe.parentNode.style.left);
    iframe.style.width=iframe.parentNode.style.width;
    iframe.src=url;
//    shad.style.display='block';    
    }
function ya_GBLocalClose_() {
    document.getElementById('ya_gbFrame').src='';
    document.getElementById('ya_gbCalc').style.display='none';
    document.getElementById('ya_gbContainer').style.display='none';
    document.getElementById('ya_gbShadow').style.display='none';
    document.getElementById('ya_gbTitle').style.display='none';
    }   
function ya_GBRemoteClose_ () {
    parent.document.getElementById('ya_gbFrame').src='';
    parent.document.getElementById('ya_gbCalc').style.display='none';
    parent.document.getElementById('ya_gbContainer').style.display='none';
    parent.document.getElementById('ya_gbShadow').style.display='none';
    parent.document.getElementById('ya_gbTitle').style.display='none';
    }
