var menu1obj=null;
var menu2obj=null;
var menu3obj=null;

function setupObjs() {
	maincontentobj=new objLayer("maincontent")
	menu1obj=new objLayer("menu1","maincontent")
	menu1obj.moveTo(5,62)
	menu2obj=new objLayer("menu2","maincontent")
	menu2obj.moveTo(50,62)
	menu3obj=new objLayer("menu3","maincontent")
	menu3obj.moveTo(150,62)
}

function animate(n) {
	if (n==1) {
		if (menu1obj) {menu1obj.dropdown(83,0,'menu1obj')}
		if (menu2obj) {menu2obj.dropdown(62,0,'menu2obj')}
		if (menu3obj) {menu3obj.dropdown(62,0,'menu3obj')}
	} else if (n==2) {
		if (menu2obj) {menu2obj.dropdown(83,0,'menu2obj')}
		if (menu1obj) {menu1obj.dropdown(62,0,'menu1obj')}
		if (menu3obj) {menu3obj.dropdown(62,0,'menu3obj')}
	} else {
		if (menu3obj) {menu3obj.dropdown(83,0,'menu3obj')}
		if (menu1obj) {menu1obj.dropdown(62,0,'menu1obj')}
		if (menu2obj) {menu2obj.dropdown(62,0,'menu2obj')}
	} 
}

function closeup() {
	if (menu1obj) {menu1obj.dropdown(62,0,'menu1obj')}
	if (menu2obj) {menu2obj.dropdown(62,0,'menu2obj')}
	if (menu3obj) {menu3obj.dropdown(62,0,'menu3obj')}
}

function obj_dropdown(n,d,l) {//animate a layer through a given distance at a given speed
	this.timerdelay=d
	this.endpoint=n;
	this.label=l
	this.doanimate()
}

function obj_doanimate() {
	if (this.y>this.endpoint) {
		amt=Math.floor(((this.y-this.endpoint)/10)*-1)
		if (amt>-1) {amt=-1}
	} else if (this.y<this.endpoint) {
		amt=Math.floor(((this.y-this.endpoint)/10)*-1)
		if (amt<1) {amt=1}
	} else {
		amt=0
	}
	this.moveBy(0,amt)
	if (amt!=0) {
		this.timerid=setTimeout(this.label+".doanimate()",this.timerdelay)
	}
}

objLayer.prototype.dropdown=obj_dropdown
objLayer.prototype.doanimate=obj_doanimate