function toggle(cell) {
	var cel="";

	if( document.getElementById(cell).style.display=='none' )
	{
		document.getElementById(cell).style.display = '';
	}
	else
	{
		document.getElementById(cell).style.display = 'none';
	}

}


//-----------------------------------------------------------------------------
//------------- Dima's module -------------------------------------------------
//-----------------------------------------------------------------------------
function popup(param){
 url="terms.php?param="+param;
 rnd=Math.round((Math.random()*10000000));
 var newwin = window.open(url, rnd, 'scrollbars=1,fullscreen=0,toolbar=0,menubar=0,status=1,resizable=1,location=0,directories=0,width=450,height=500');
 newwin.focus();
}
//-----------------------------------------------------------------------------
function new_popup(url){
 rnd=Math.round((Math.random()*10000000));
 var newwin = window.open(url, rnd, 'scrollbars=1,fullscreen=0,toolbar=0,menubar=0,status=1,resizable=1,location=0,directories=0,width=830,height=500');
 newwin.focus();
}
//-----------------------------------------------------------------------------
function setCheckboxes(do_check)
{
    var elts_cnt = parseInt( document.check.maxid.value );
    if (elts_cnt > 0) {
        for (var i = 0; i < elts_cnt; i++) {
            if (document.check.elements["id" + i]) document.check.elements["id" + i].checked = do_check;
        } // end for
    }
//    return false;
} // end of the 'setCheckboxes()' function
//-----------------------------------------------------------------------------
function help(c_action)
{
        url="help.php?action="+c_action;
        newwin = window.open(url, "Rotate", "scrollbars=yes,menubar=no,resizable=0,location=no,width=550,height=400,title='dSAP Help'") ;
}
//-----------------------------------------------------------------------------
function confirm_delete(frm,act)
{
    var is_confirmed = confirm("Are you sure you want to delete?");
    if (is_confirmed) {
    document.forms[frm].elements["action"].value=frm;
    document.forms[frm].elements["id"].value=act;
    document.forms[frm].submit();
    }
}
//-----------------------------------------------------------------------------
function do_action(act)
{
      document.check.elements["action"].value=act;
      document.check.submit();
}
//-----------------------------------------------------------------------------
function delete_group(act)
{
    var elts_cnt = parseInt( document.check.maxid.value );
    var is_checked = false;
    if (elts_cnt > 0) {
        for (var i = 0; i < elts_cnt; i++) {
            if (document.check.elements["id" + i])
                if (document.check.elements["id" + i].checked) is_checked=true;
        } // end for
    }
    if (is_checked) {
      var is_confirmed = confirm("Are you sure you want to delete?");
      if (is_confirmed) {
      document.check.elements["action"].value=act;
      document.check.submit();
    }
    }
}
//-----------------------------------------------------------------------------
function edit_group(act)
{
    var elts_cnt = parseInt( document.check.maxid.value);
    var is_checked = false;
    if (elts_cnt > 0) {
        for (var i = 0; i < elts_cnt; i++) {
            if (document.check.elements["id" + i])
                if (document.check.elements["id" + i].checked) is_checked=true;
        } // end for
    }
    if (is_checked) {
      document.check.elements["action"].value=act;
      document.check.submit();
    }
}
//------------- End Dima's module ---------------------------------------------
//-----------------------------------------------------------------------------
function over(src)
{
src.bgColor="#F2F2F2";
}
//-----------------------------------------------------------------------------
function out(src)
{
src.bgColor="#FFFFFF";
}
//-----------------------------------------------------------------------------

function new_win1(id_air)
{
url="descript.php?id_air="+id_air;
rnd=Math.round((Math.random()*10000000));
newwin = window.open(url, "Rotate", "scrollbars=no,menubar=no,resizable=1,location=no,width=450,height=300,title='Email Preview'") ;
//location.reload();
//newwin.focus() ;
}

//-----------------------------------------------------------------------------

function new_win(state,id_air)
{
url="extension.php?state="+state+"&id_air="+id_air;
rnd=Math.round((Math.random()*10000000));
newwin = window.open(url, "Rotate", "scrollbars=no,menubar=no,resizable=1,location=no,width=350,height=250,title='Email Preview'") ;
//location.reload();
//newwin.focus() ;
}

//-----------------------------------------------------------------------------

function confirm_del(url)
{
    var is_confirmed = confirm("Are you sure you want to delete Item?");
    if (is_confirmed) {
//    var url="login.php?action=delete_multi&&id="+id_usr;
    window.location=url;
    }

//    return is_confirmed;
} // end of the 'confirmLink()' function


function confirm_arch(url)
{
    var is_confirmed = confirm("Are you sure you want to move file to Archieve?");
    if (is_confirmed) {
//    var url="login.php?action=delete_multi&&id="+id_usr;
    window.location=url;
    }

//    return is_confirmed;
} // end of the 'confirmLink()' function

function confirm_unarch(url)
{
    var is_confirmed = confirm("Are you sure you want to Unarchieve File?");
    if (is_confirmed) {
    window.location=url;
    }

//    return is_confirmed;
} // end of the 'confirmLink()' function

//-----------------------------------------------------------------------------
function confirm111_i(frm,act,id)
{
    var is_confirmed = confirm("Are you sure you want to delete?");
    if (is_confirmed) {
    document.forms[frm].elements["action"].value=act;
    document.forms[frm].elements["id"].value=id;
    document.forms[frm].submit();
    }

//    return is_confirmed;
} // end of the 'confirmLink()' function


function confirm111(frm,act)
{
    var is_confirmed = confirm("Are you sure you want to delete?");
    if (is_confirmed) {
    document.forms[frm].elements["action"].value=act;
    document.forms[frm].submit();
    }

//    return is_confirmed;
} // end of the 'confirmLink()' function

//-----------------------------------------------------------------------------
function menu(frm,act,id)
{
document.forms[frm].elements["action"].value=act;
document.forms[frm].elements["id"].value=id;
document.forms[frm].submit();
}

function menu(frm,act)
{
document.forms[frm].elements["action"].value=act;
document.forms[frm].submit();
}

//-----------------------------------------------------------------------------

    ////////////////////////////////////////////////////////////////////////////////////////////////////////
    //                                                                                                    //
    // Copyright www.interakt.ro 2000 -2001                                                               //
    //                                                                                                    //
    ////////////////////////////////////////////////////////////////////////////////////////////////////////

   parentWindow = this;
   lastElement = this;

   fii = new Array();
   layerN = 0;

   function show(l){
     l.style.display = "block";
   }

   function hide(l){
     l.style.display = "none";
   }

   function scrie(l, text){
     l.insertAdjacentHTML("beforeEnd", text);
   }

   function Leiar(x, tata){
    var temp;
     src = "<div id=leiar"+parentWindow.layerN+" class=ieLeiar></div>";
     if(tata == parentWindow){
      document.body.insertAdjacentHTML("beforeEnd", src);
      parentWindow.layerN++;
      return(eval("document.all.leiar"+(parentWindow.layerN-1)));
     }
     else{
      tata.insertAdjacentHTML("beforeEnd", src);
      parentWindow.layerN++;
      return(eval("tata.all.leiar"+(parentWindow.layerN-1)));
     }
   }

   function arrayPush(a, l){
     a[a.length]=l;
   }

   function addMenu(eSusParam, text, img, exe, w, mw, x, y){
    if(!w){
     w = 60;
    }
    if(!mw){
     mw = 40;
    }
    if(this.fiu){
     return this.fiu.addMenu(0, text, img, exe, w, mw, x, y);
    }
    var aux;
    if(this == parentWindow){
     if(!x){
      if(this.fii.length != 0){
       aux = this.fii[this.fii.length-1];
       if(eSusParam){
        x = aux.style.pixelLeft + aux.style.pixelWidth;
        y = aux.style.pixelTop;
       }
       else{
        x = aux.style.pixelLeft;
        y = aux.style.pixelTop + 16;
       }
      }
      else{
       x=0;
       y=0;
      }
     }
     aux = new MenuButton(text, x, y, mw, this);
     aux.eSus = eSusParam;
     show(aux);
     auxx = new Menu(w, this)
     aux.fiu = auxx;
     aux.addMenuItem = addMenuItem;
     aux.addMenu = addMenu;
     aux.addMenuSeparator = addMenuSeparator;
     auxx.tata = aux;
     arrayPush(this.fii, aux);
     show(aux);
    }
    else{
     aux = this.addMenuItem("<table border=0 cellspacing=0 cellpadding=0><tr><td width=100% class=item>"+text+"</td><td valign=center class=item> "+menuNext+" </td></table>", img, exe);
     auxx = new Menu(w, parentWindow);
     aux.fiu = auxx;
     auxx.tata = aux;
     aux.addMenuItem = addMenuItem;
     aux.addMenu = addMenu;
     aux.addMenuSeparator = addMenuSeparator;
    }
    return aux;
   }

   function addMenuItem(text, img, exe){
           if (img == "") text = "<table style='cursor:hand' height=22 width=100% border=0 cellspacing=0 cellpadding=0><tr><td width=21 align=center bgcolor='#DDE1E6'></td><td width=100% class=item>"+text+"</td></tr></table>";
           else text = "<table style='cursor:hand' height=22 width=100% border=0 cellspacing=0 cellpadding=0><tr><td width=21 align=center bgcolor='#DDE1E6'><img src='"+img+"' width=16 height=16></td><td class=item>"+text+"</td></tr></table>";
    if(this.fiu){
     return this.fiu.addMenuItem(text, "", exe);
    }
    var aux;
    aux = new MenuItem(text, this, exe);
    arrayPush(this.fii, aux);
    return aux;
   }

   function addMenuSeparator(ceFel){
     var aux = new MenuSeparator(this.fiu, this.fiu.latsime-2, ceFel);
   }

   function showMenu(l){
    show(l);
    for(i=0;i<l.fii.length;i++){
     show(l.fii[i]);
    }
   }

   function hideFii(fii){
   }

   function Menu(w, tata){
    var aux;
    aux = new Leiar(w, tata);
    aux.fii = new Array();
    aux.style.pixelWidth=w;
    txt = "<table border=0 cellspacing=0 cellpadding=0 bgcolor='#30559C' id=tablou width="+w+"><tr><td colspan=3 height=1><img src='images/nimic.gif' height=1></td></tr><tr><td width=1 height=1><img src='images/nimic.gif' height=1></td><td colspan=2 bgcolor='#30559C' height=1><img src='images/nimic.gif' height=1></td></tr></table>";
    scrie(aux, txt);
    aux.addMenuItem = parentWindow.addMenuItem;
    aux.addMenu = parentWindow.addMenu;
    aux.addMenuSeparator = addMenuSeparator;
    aux.onmouseover = menuMouseOver;
    aux.onmouseout = menuMouseOut;
    aux.tata = tata;
    aux.tip = "Menu";
    aux.latsime=w;
    return aux;
   }

   function MenuItem(text, tata, exe){
    var aux;
    var w;
    text = "<a class=item>"+text+"</a>";
    var nr = tata.all.tablou.rows.length;
    var tr = tata.all.tablou.insertRow(nr-1);
    var cel = tr.insertCell(0);
    cel.innerHTML = "<img src='images/nimic.gif' width=1 height=1>";
    cel.style.width="1";
    cel.style.height="1";
    var cel1 = tr.insertCell(1);
    cel1.innerHTML = text;
    cel1.style.backgroundColor = parentWindow.itemOffColor;
    cel1.style.width="100%";
    cel = tr.insertCell(2);
    cel.innerHTML = "<img src='images/nimic.gif' width=1 height=1>";
    cel.style.backgroundColor = "#30559C";
    cel.style.width="1";
    cel.style.height="1";
    if(!(tata.ien)){
     tata.ien = 0;
    }
    cel1.ien = tata.ien;
    tata.ien++;
    aux = cel1;
    aux.onmouseover=menuItemMouseOver;
    aux.onmouseout=menuItemMouseOut;
    aux.onmousedown = click;
    if(exe){
     aux.exe = exe;
    }
    aux.tata = tata;
    aux.tip = "MenuItem";
    return aux;
   }

   function MenuSeparator(tata, x, ceFel){
    var nr = tata.all.tablou.rows.length;
    var tr = tata.all.tablou.insertRow(nr-1);
    var cel = tr.insertCell(0);
    cel.innerHTML = "<img src='images/nimic.gif' height=1 width=1>";
    cel.style.width = "1";
    cel.style.height = "1";
    cel = tr.insertCell(1);
    cel.innerHTML = "<img src='images/nimic.gif' height=1 width=1>";
    if(ceFel!=0){
        cel.style.backgroundColor = parentWindow.menuBgColor;
    }else{
        cel.style.backgroundColor = parentWindow.itemOffColor;
    }
    cel.style.width="100%";
    cel = tr.insertCell(2);
    cel.innerHTML = "<img src='images/nimic.gif' height=1 width=1>";
    cel.style.backgroundColor = "#30559C";
    cel.style.width = "1";
    cel.style.height = "1";
     tr = tata.all.tablou.insertRow(nr);
    cel = tr.insertCell(0);
    cel.innerHTML = "<img src='images/nimic.gif' height=1 width=1>";
    cel.style.width = "1";
    cel.style.height = "1"; 
    cel = tr.insertCell(1);
    cel.innerHTML = "<img src='images/nimic.gif' height=1 width=1>";
    if(ceFel==0){
        cel.style.backgroundColor = parentWindow.itemOffColor;
    }
    cel.style.width="100%";
    cel = tr.insertCell(2);
    cel.innerHTML = "<img src='images/nimic.gif' height=1 width=1>";
    cel.style.backgroundColor = "#30559C";
    cel.style.width = "1";
    cel.style.height = "0";
  }

   function MenuButton(text, x, y, w, tata){
    var aux;
    aux = new Leiar(w, tata);
    aux.style.backgroundColor=parentWindow.itemOffColor;
    aux.style.pixelTop = y;
    aux.style.pixelLeft = x;
    if(w){
      aux.style.pixelWidth = w;
    }
    scrie(aux, "<table style='cursor:hand' border=0 cellspacing=0 cellpadding=0 height=25 width="+w+"><tr><td colspan=3 bgcolor="+parentWindow.menuFgColor+" height=1><img src=images/nimic.gif height=1></td></tr><tr><td bgcolor="+parentWindow.menuFgColor+" height=100%  width=1><img src=images/nimic.gif width=1></td><td width=100% align=center class=item>"+text+"</td><td bgcolor="+parentWindow.menuBgColor+" width=1 height=1><img src=images/nimic.gif width=1 height=1></td></tr><tr><td colspan=3 bgcolor="+parentWindow.menuBgColor+" height=1><img src=images/nimic.gif height=1></td></tr></table>");
    aux.onmouseover=menuButtonMouseOver;
    aux.onmouseout=menuButtonMouseOut;
    aux.menuItemMouseOut = menuItemMouseOut;
    aux.menuItemMouseOver = menuItemMouseOver;
    aux.menuMouseOut = menuMouseOut;
    aux.menuMouseOver = menuMouseOver;
    aux.tip = "MenuButton";
    return aux;
   }

   function hideRec(ce, panaUnde){
    if(ce.tip != "MenuButton"){
     if(ce.tata != panaUnde){
      if(ce.fii){
       hideFii(ce.fii);
      }
      hide(ce);
      hideRec(ce.tata, panaUnde);
     }
    }
   }

   function menuItemMouseOver(e){

    if(this.fiu && this.tip=="MenuItem"){
      this.fiu.style.pixelLeft = this.tata.style.pixelLeft + this.tata.clientWidth + parentWindow.newMenuXDepl;
      var a = this.offsetTop;
      if(a==0){
       a=this.tata.clientHeight/(this.tata.ien)*this.ien + 1;
      }
      this.fiu.style.pixelTop = this.tata.style.pixelTop + a - 1 + parentWindow.newMenuYDepl;
    }

    this.style.backgroundColor=parentWindow.itemOnColor;
    if(parentWindow.lastElement != parentWindow){
     if(this.tip == "MenuButton"){
      if(parentWindow.lastElement != this){
       if(parentWindow.lastElement.fiu){
        hideFii(parentWindow.lastElement.fiu.fii);
        hide(parentWindow.lastElement.fiu);
       }
       hideRec(parentWindow.lastElement, this);
      }
     }
     else{
      if(this.tata.tata != parentWindow.lastElement){
       if(parentWindow.lastElement.fiu){
        hideFii(parentWindow.lastElement.fiu.fii);
        hide(parentWindow.lastElement.fiu);
       }
       if(parentWindow.lastElement.tata != this.tata){
        hideRec(parentWindow.lastElement, this.tata);
       }
      }
     }
     parentWindow.lastElement = this;
    }
    if(this.fiu){
     showMenu(this.fiu);
    }
   }

   function menuItemMouseOut(e){
    this.style.backgroundColor=parentWindow.itemOffColor;
    parentWindow.lastElement = this;
   }

   function menuMouseOver(){
    if(parentWindow.toID != -1){
     clearTimeout(parentWindow.toID);
     parentWindow.toID = -1;
    }
   }

   function menuMouseOut(){
    parentWindow.toID = setTimeout("timeout();", 1000);
   }

   function timeout(){
    if(parentWindow.lastElement != parentWindow){
     if(parentWindow.lastElement.fiu){
      hideRec(parentWindow.lastElement.fiu, parentWindow);
     }
     else{
      hideRec(parentWindow.lastElement, parentWindow);
     }
    }
    parentWindow.toID = -1;
   }

   function menuButtonMouseOut(){
    if(myStatus == 1){
     this.menuItemMouseOut();
     this.menuMouseOut();
    }
   }

   function menuButtonMouseOver(){
    if(myStatus == 1){
      if(this.eSus){
        this.fiu.style.pixelLeft = this.style.pixelLeft;
        this.fiu.style.pixelTop = this.style.pixelTop + this.clientHeight;
      }else{
        this.fiu.style.pixelLeft = this.style.pixelLeft + this.clientWidth;
        this.fiu.style.pixelTop = this.style.pixelTop;
      }
     this.menuMouseOver();
     this.menuItemMouseOver();
    }
   }

   function click(){
    timeout();
    if(this.exe){
     eval(this.exe);
    }
    return false;
   }
