//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// NEXON GATE
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function gate(Id, interval, to) {
    var obj = document.getElementById('gate_menu');
		var bt = document.getElementById('bt_gate');
    var H, step = 4;

    if (obj == null) return;
    if (to == undefined) { // user clicking
        if (obj._slideStart == true) return;
        if (obj._expand == true) {
            to = 0;
            obj.style.overflow = "hidden";
						bt.src = "/images/main/main_quick_01.gif";
        } else {
            obj.style.height = "";
            obj.style.overflow = "";
            obj.style.display = "block";
            to = obj.offsetHeight; // ÀÌ°ÅÀÌ°Å
            obj.style.overflow = "hidden";
            obj.style.height = "1px";
						bt.src = "/images/main/main_quick_02.gif";
        }
        obj._slideStart = true;
    }
    
    step             = ((to > 0) ? 1:-1) * step;
    interval         = ((interval==undefined)?1:interval);

    obj.style.height = (H=((H=(isNaN(H=parseInt(obj.style.height))?0:H))+step<0)?0:H+step)+"px";
    
    
    if (H <= 0) {
        obj.style.display = "none";
        obj.style.overflow = "hidden";
        obj._expand = false;
        obj._slideStart = false;
    } else if (to > 0 && H >= to) {
        obj.style.display = "block";
        obj.style.overflow = "visible";
        obj.style.height = H + "px";
        obj._expand = true;
        obj._slideStart = false;
    } else {
        setTimeout("gate('"+Id+"' , "+interval+", "+to+")", interval);
    }
}

function gateLoad(){
	gate("gate_menu");
	setTimeout("gate('gate_menu')", 2000);
}