function ps_menu(id) {
	if (!document.getElementById || !document.getElementsByTagName)
		return false;
	if (id == "apple") {
		this.id = "thirdnav_apple";
		this.noid = "thirdnav_pc";
	}
	else {
		this.id = "thirdnav_pc";
		this.noid = "thirdnav_apple";
	}
	this.menu = document.getElementById(this.id);
	this.nomenu = document.getElementById(this.noid);
	this.speed = 1;
	this.timeout = 20;
	this.maxHeight = 38;
	this.maxMargin = 10;
	this.numberOfLinks = 5;
	return true;
}
ps_menu.prototype.init = function() {
};
ps_menu.prototype.toggleMenu = function() {
	var help;
	this.expandMenu(this.noid, this.id);
	help = this.id;
	this.id = this.noid;
	this.noid = help;
};
ps_menu.prototype.collapseMargin = function(id) {
	var mainInstance = this;
	var submenu = document.getElementById(id);
	var moveBy = this.speed;
	var newMargin = this.maxMargin - this.speed;
	var goMarginCollapse = setInterval(function() {
		if (newMargin > 0) {
			submenu.style.marginBottom = newMargin + "px";
		}
		else {
			submenu.style.marginBottom = "0px";
			clearInterval(goMarginCollapse);
			mainInstance.collapseMenu(id);
		}		
		var curMargin = submenu.style.marginBottom.split("p");
		newMargin = curMargin[0] - moveBy;
	}, this.timeout);
	return false;
};
ps_menu.prototype.collapseMenu = function(id) {
	var submenu = document.getElementById(id);
	var moveBy = this.speed;
	var goCollapse = setInterval(function() {
		var newHeight = submenu.offsetHeight - moveBy;
		if (newHeight > 0) {
			submenu.style.height = newHeight + "px";
		}
		else {
			submenu.style.height = "0px";	
			clearInterval(goCollapse);
		}				

	}, this.timeout);
};
ps_menu.prototype.expandMenu = function(noid,id) {
	var mainInstance = this;
	var submenu = document.getElementById(noid);
	var moveBy = this.speed;
	maxHeight = this.maxHeight;
	var newHeight = 0;
	var goExpand = setInterval(function() {
		newHeight = submenu.offsetHeight + moveBy;
		if (newHeight < maxHeight)
			submenu.style.height = newHeight + "px";
		else {
			submenu.style.height = this.maxHeight + "px";
			clearInterval(goExpand);
			mainInstance.expandMargin(noid,id);
		}	
	}, this.timeout);
	return false;
};
ps_menu.prototype.expandMargin = function(noid,id) {
	var mainInstance = this;
	var submenu = document.getElementById(noid);
	var moveBy = this.speed;
	var maxMargin = this.maxMargin;
	var newMargin = moveBy;
	var goExpandMargin = setInterval(function() {
		if (newMargin < maxMargin) {
			submenu.style.marginBottom = newMargin + "px";
		}
		else {
			submenu.style.marginBottom = maxMargin + "px";
			clearInterval(goExpandMargin);
			mainInstance.collapseMargin(id);
		}
		var curMargin = submenu.style.marginBottom.split("p");
		newMargin = Number(curMargin[0]) + moveBy;
	}, this.timeout);
	return false;
};
ps_menu.prototype.collapseMarginQuick = function(id) {
	var mainInstance = this;
	var submenu = document.getElementById(id);
	submenu.style.marginBottom = "0px";
	this.collapseMenuQuick(id);
	return false;
};
ps_menu.prototype.collapseMenuQuick = function(id) {
	var submenu = document.getElementById(id);
	submenu.style.height = "0px";
	return false;
};
