// JavaScript Document
var basePosition = 0;
var stopPosition = 0;
var obj;

PulldownInit('pulldown_box');

function PulldownInit(boxid){
	Elements = document.getElementById(boxid);
	if(Elements != null){
		basePosition = parseInt(Elements.style.marginTop.substring(0,Elements.style.marginTop.length-2));
	}
	HideObj('btn_close');
}

function PullDown(boxid){
	Elements = document.getElementById(boxid);
	if(Elements != null){
		obj = Elements;
		stopPosition = 0;
		MoveBox();
		HideObj('btn_open');
		ShowObj('btn_close');
	}
	return false;
}

function PullUp(boxid){
	Elements = document.getElementById(boxid);
	if(Elements != null){
		obj = Elements;
		stopPosition = basePosition;
		MoveBox();
		HideObj('btn_close');
		ShowObj('btn_open');
	}
	return false;
}

function MoveBox(){
	topMargin= parseInt(obj.style.marginTop.substring(0,obj.style.marginTop.length-2));
	if(topMargin > stopPosition) {
		obj.style.marginTop = topMargin-20+"px";
		setTimeout('MoveBox()', 5);
	}else if(topMargin < stopPosition) {
		obj.style.marginTop = topMargin+20+"px";
		setTimeout('MoveBox()', 5);
	}else {
		obj.style.marginTop = stopPosition;
		clearTimeout();
	}
}