<!--

var tmpInt = 0;

var curMenu = -1;
var curTotal = 5;
var curStart = -1;
var curFinish = -1;
var curStep = 5;
var Done = false;

var curInterval = 1;

var debugMessage = "";

var look_at_code = 0;

function OffsetLeft( obj ) {
    var coordLeft = 0;
    while( obj.offsetParent != null ) {
        coordLeft += obj.offsetLeft * 1;
        if ( obj.style.position == "absolute" || obj.tagName == "BODY" )
            break;
        obj = obj.offsetParent;
    }
    return coordLeft;
}

function OffsetTop( obj ) {
    var coordTop = 0;
    while( obj.offsetParent != null ) {
        coordTop += obj.offsetTop * 1;
        if ( obj.style.position == "absolute" || obj.tagName == "BODY" )
            break;
        obj = obj.offsetParent;
    }
    return coordTop;
}

function GetFinish( obj ) {
    return OffsetTop(obj) * 1 + obj.offsetHeight * 1;
}

function MoveDown () {
    if ( curMenu < 0 || curTotal <=0 || curStart <= 0 || curStep <= 0 ) {
        clearInterval(tmpInt);
    look_at_code -= 1;
        tmpInt = 0;
        return;
    }
    for( var i = curStart ; i < curTotal ; i++ ) {
        obj = document.getElementById("divMenu_" + curMenu.toString() + "_" + i.toString());
        obj.style.top = OffsetTop(obj) * 1 + curStep * 1;
        if ( obj.offsetTop * 1 >= curFinish ) {
            obj.style.top = curFinish;
            Done = true;
        }
    }
    if ( Done ) {
        obj = document.getElementById("divMenu_" + curMenu.toString() + "_" + curStart.toString());
        curFinish = GetFinish(obj);
        curStart += 1;
        Done = false;
    }
    if ( curStart >= curTotal ) {
        curStart = 0;
        clearInterval(tmpInt);
    look_at_code -= 1;
        tmpInt = 0;
    }
}

function PullDown() {
    obj = document.getElementById("divMenu_" + curMenu.toString());
    curLeft  = OffsetLeft(obj) * 1 - 1;
    curTop   = OffsetTop(obj) * 1 + obj.offsetHeight * 1 + 1;
    curWidth = obj.offsetWidth * 1;
    for( var i = 0 ; i < curTotal ; i++ ) {
        obj = document.getElementById("divMenu_" + curMenu.toString() + "_" + i.toString());
        obj.style.left = curLeft;
        obj.style.top = curTop;
        obj.style.width = curWidth;
        obj.style.zIndex = curTotal - i;
        obj.style.position = "absolute";
        obj.style.visibility = "visible";
        if ( i == 0 )
            curFinish = GetFinish(obj);
    }
    curStart = 1; Done = false;
    if ( tmpInt != 0 ) {
        clearInterval(tmpInt);
        look_at_code -= 1;
    }
    tmpInt = setInterval("MoveDown()",curInterval);
    look_at_code += 1;
}




function HideMenu() {
    if ( tmpInt > 0 ) {
        clearInterval(tmpInt);
        look_at_code -= 1;
    }
    tmpInt = 0;
    if ( curMenu < 0 )
        return;
    for( var i = 0 ; i < curTotal ; i++ ) {
        obj = document.getElementById("divMenu_" + curMenu.toString() + "_" + i.toString());
        obj.style.visibility = "hidden";
    }
    curMenu = -1;
}

function ShowMenu( ind , total ) {
    if ( curMenu == ind )
        return;
    if ( curMenu >= 0 )
        HideMenu();
    curMenu = ind; curTotal = total;
    PullDown(curMenu,curTotal);
}








function showLayer( pre , i , j , flag_row ) {
    if ( typeof(flag_row) == 'undefined' )
        flag_row = false;
    img = document.getElementById("img_" + pre + "_" + i + "_" + j);
    if( img != undefined )
        img.src = Selected.src;
    if ( flag_row ) {
        row = document.getElementById("row_" + pre + "_" + i + "_" + j);
        if( row != undefined && row.className != 'active' && row.className != 'active2' )
            row.style.backgroundColor = "#000000";
    }
}

function hideLayer( pre , i , j , flag_row ) {
    if ( typeof(flag_row) == 'undefined' )
        flag_row = false;
    img = document.getElementById("img_" + pre + "_" + i + "_" + j);
    if( img != undefined )
        img.src = NonSelected.src;
    if ( flag_row ) {
        row = document.getElementById("row_" + pre + "_" + i + "_" + j);
        if( row != undefined && row.className != 'active' && row.className != 'active2' )
            if ( i > 99 )
                row.style.backgroundColor = "#ffffff";
            else
                row.style.backgroundColor = "#000000";
    }
}

function OnClick() {
    if ( curMenu >= 0 )
        HideMenu();
}

document.onclick = OnClick;


function divSelect( obj ) {
    obj.style.backgroundImage='url(im/0.gif)';
}

function divUnSelect( obj ) {
    obj.style.backgroundImage='url(im/00.gif)';
}



--> 

