	var myMenu;
	window.onload = function() 
        {
	 myMenu = new SDMenu("my_menu");
	 myMenu.init();
	};


var $expandMaxHeight = 0;
var $expandInterval;

var GROW = 3.5;
var SHRINK = -3.5;


function smoothChange(object, factor) {
    var k = Math.abs((1 - object.offsetHeight/$expandMaxHeight) - object.offsetHeight/$expandMaxHeight);
    
    if (k<0.4) {
        var growth = 4*factor; //? ???????? ???????? ???????? ???????? ?????? ???????
    } else {
        var growth = 2*factor; // ??? ? ?????? ? ????? ????????
    }
    
    if (
        ( (factor == GROW) && ((object.offsetHeight + growth) > $expandMaxHeight) ) ||
        ( (factor == SHRINK) && ((object.offsetHeight + growth) < 0) )
        )
    {
        growth = factor>0 ? ($expandMaxHeight - object.offsetHeight) : 0;
        clearInterval($expandInterval);
        $expandInterval = null;
    }
    
    object.style.height = object.offsetHeight + growth + 'px';
    if (factor == SHRINK && !$expandInterval) {
        object.style.height = $expandMaxHeight + 'px';
        object.style.display = 'none';
    }
}

function smoothShowVertical(object) {
    if ($expandInterval)
        return false;
        
    object.style.height = '0px';
    $expandInterval = setInterval(function(object) { return function () { smoothChange(object, GROW) } }(object), 20);
}

function smoothHideVertical(object) {    
    if ($expandInterval)
        return false;

    $expandInterval = setInterval(function(object) { return function () { smoothChange(object, SHRINK) } }(object), 20);
}

var CURRENT_TARGET;
function show(aID) {
    if ($expandInterval)
        return false;

    var target = document.getElementById(aID).style;
    var value = target.display == 'block' ? 'none' : 'block';
        
    if (CURRENT_TARGET && CURRENT_TARGET != target) {
        CURRENT_TARGET.display = 'none';
    };
    
    if (target.display == 'none') {
        CURRENT_TARGET = target;
        target.display = 'block';
    
        //---
        object = document.getElementById(aID);
        $expandMaxHeight = object.offsetHeight;
        object.style.height = '0px';

        smoothShowVertical(document.getElementById(aID));
        //---
    } else {
        $expandMaxHeight = object.offsetHeight;
        smoothHideVertical(document.getElementById(aID));
        //target.display = 'none';
    }
    

};

var browserName = '';
var browserNew = '';
function getIdProperty(id,property) {
        var styleObject = document.getElementById( id );
        if (styleObject != null) {
            styleObject = styleObject.style;
                if (styleObject[property]) {
                    return styleObject[ property ];
                }
            }
        return (styleObject != null) ?
        styleObject[property] :
        null;
    }
function setIdProperty(id,property,value) {
        var styleObject = document.getElementById( id );
        if (styleObject != null) {
            styleObject = styleObject.style;
            styleObject[ property ] = value;
        }
    }
function getDisplay(id) {
        if (browserNew) {
            return getIdProperty(id,"display");
        }
        else {
            if (browserName == "NS") {
                return document.layers[id].display;
            }
            else {
                return document.all[id].style.display;
            }
        }
    }
function switchDisplay(id,value) {
        if (browserNew) {
            setIdProperty(id,"display",value);
        }
        else {
            if (browserName == "NS") {
                document.layers[id].display = value;
            }
            else {
                document.all[id].style.display = value;
            }
        }
    }
function expandContent(id, param){
    if (getDisplay('t' + id) == 'none') {
        switchDisplay('t'+id,'block');
        setIdProperty('a'+id, 'color', '#000000')

    } else {
        switchDisplay('t'+id,'none');                          
        setIdProperty('a'+id, 'color', '#444444')
    }
}
