var activeMenu;
var activeMenu1;

function Navigate(cellElement,path)
{   
    //alert(cellElement.className);
    if (cellElement != activeMenu)
    {
        cellElement.className = 'menuTableCellActive';
        activeMenu = cellElement;
    }
    alert("here");
    alert(cellElement.className);
    window.navigate(path);
}

function onMenuCellMouseOver(cellElement) {
    if (cellElement.className == 'menuTableCellActive')
        activeMenu = cellElement;
    else
        cellElement.className = 'menuTableCellActive';
}

function onMenuCellMouseOut (cellElement) {
    if (cellElement != activeMenu)
        cellElement.className = 'menuTableCellInactive';
}

function onMenuCellMouseOver1(cellElement) {
    if (cellElement.className == 'menuTableCellActive1')
        activeMenu = cellElement;
    else
        cellElement.className = 'menuTableCellActive1';
}

function onMenuCellMouseOut1 (cellElement) {
    if (cellElement != activeMenu)
        cellElement.className = 'menuTableCellInactive1';
}

function onMenuSubCellMouseOver(cellElement) 
{
    if (cellElement.className == 'menuTableCellActiveSubMenu')    
        activeMenu1 = cellElement;
    else
        cellElement.className = 'menuTableCellActiveSubMenu';
}

function onMenuSubCellMouseOut(cellElement) 
{
    if (cellElement != activeMenu1)
        cellElement.className = 'menuTableCellInactiveSubMenu';
}


function makeControlVisible(controlID) {
    var element = document.getElementById(controlID);
    if (element != null)
        element.style.display = 'block';
}

function makeControlInVisible(controlID) {
    var element = document.getElementById(controlID);
    if (element != null)
        element.style.display = 'none';
}

function onCellClick(tdCellID, tblTitleID, tblContentID) {
    var titleTableElement = document.getElementById(tblTitleID);
    var contentTableElement = document.getElementById(tblContentID);
    var currentCellElement = document.getElementById(tdCellID);
    
    var radioElement = currentCellElement.firstChild;
    radioElement.checked = true;
    
    if (radioElement.value == '1') {
        contentTableElement.style.display = 'block';
    }
    else {
        contentTableElement.style.display = 'none';
    }
    
    for (var i=0; i<titleTableElement.rows[0].cells.length; i++) {
        if (titleTableElement.rows[0].cells[i].cellIndex == currentCellElement.cellIndex) {
            titleTableElement.rows[0].cells[i].className = 'titleCellTabActive';
        }
        else {
            titleTableElement.rows[0].cells[i].className = 'titleCellTabNormal';
        }
    }
}

function onTabCellClick(tdCellID, tblTitleID, tblActiveContentID, tblInactiveContentID) {
    var titleTableElement = document.getElementById(tblTitleID);
    var currentCellElement = document.getElementById(tdCellID);
    var activeContentTableElement = (tblActiveContentID == '') ? null : document.getElementById(tblActiveContentID);
    var inActiveContentTableElement = (tblInactiveContentID == '') ? null : document.getElementById(tblInactiveContentID);
    
    var radioElement = currentCellElement.firstChild;
    radioElement.checked = true;
    
    if (activeContentTableElement != null) activeContentTableElement.style.display = 'block';
    if (inActiveContentTableElement != null) inActiveContentTableElement.style.display = 'none';
    
    for (var i=0; i<titleTableElement.rows[0].cells.length; i++) {
        if (titleTableElement.rows[0].cells[i].cellIndex == currentCellElement.cellIndex && tblActiveContentID != '') {
            titleTableElement.rows[0].cells[i].className = 'titleCellTabActive';
        }
        else {
            titleTableElement.rows[0].cells[i].className = 'titleCellTabNormal';
        }
    }
}


var NS4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) < 5);

function addOption(theSel, theText, theValue)
{
  var newOpt = new Option(theText, theValue);
  var selLength = theSel.length;
  theSel.options[selLength] = newOpt;
}

function deleteOption(theSel, theIndex)
{ 
  var selLength = theSel.length;t
  if(selLength>0)
  {
    theSel.options[theIndex] = null;
  }
}

function moveOptions(theSelFrom, theSelTo)
{
  
  var selLength = theSelFrom.length;
  var selectedText = new Array();
  var selectedValues = new Array();
  var selectedCount = 0;
  
  var i;
  
  // Find the selected Options in reverse order
  // and delete them from the 'from' Select.
  for(i=selLength-1; i>=0; i--)
  {
    if(theSelFrom.options[i].selected)
    {
      selectedText[selectedCount] = theSelFrom.options[i].text;
      selectedValues[selectedCount] = theSelFrom.options[i].value;
      deleteOption(theSelFrom, i);
      selectedCount++;
    }
  }
  
  // Add the selected text/values in reverse order.
  // This will add the Options to the 'to' Select
  // in the same order as they were in the 'from' Select.
  for(i=selectedCount-1; i>=0; i--)
  {
    addOption(theSelTo, selectedText[i], selectedValues[i]);
  }
  
  if(NS4) history.go(0);
}

