MMenu.Reg = []
function MMenu(id, dir, left, top, width, height)
{
	this.ie = 0;
	this.ns4 = 0;
	this.dom = 0;
	if (document.all)
		this.ie =1;
	else if (document.layers)
		this.ns4 = 1;
	else
		this.dom =	1;
	
	if (!this.ie && !this.ns4 && !this.dom)
		return false;

	this.id			 = id;
	this.dir		 = dir;
	if (dir == "left"){
		this.orien = "h";
	}
	else if (dir == "right"){
		this.orien = "v";	
		this.type = "-";
	}
	if (dir == "down")
		this.type = "+";	
	if (dir == "left")
		this.dim = width;
	else
		this.dim = height;		

	this.gRef = "MMenu_"+id
	eval(this.gRef+"=this")

	MMenu.Reg[id] = this

	var doc = document
	doc.writeln('<style type="text/css">')
	doc.writeln('#f' + this.id + ' { visibility:hidden;overflow:hidden; } ')
	doc.writeln('#f' + this.id + ' { position:absolute; left:' + left + 'px; top:' + top + 'px; width:' + width + 'px; height:' + height + 'px; }')
	doc.writeln('</style>')

	this.load()


}

MMenu.prototype.load = function() {
	var d = document
	var layer1 = "f" + this.id
	var layer2 = "s" + this.id
	var obj1;
	var obj2;
	if (this.dom){
		obj1 = d.getElementById(layer1);
		if (obj1)
			obj2 = d.getElementById(layer2);
	}
	else if(this.ns4){
		obj1 = d.layers[layer1];
		if (obj1)
			obj2 = d.obj1.layers[layer2];
	}
	else{
		obj1 = d.all[layer1];
		if (obj1)		
			obj2 = d.all[layer2];	
	}
	
	var temp

	if (!obj1 || !obj2)
		window.setTimeout(this.gRef + ".load()", 100);
	else {
		this.con = obj1;
		this.menu = obj2;
			if (this.ns4 == 1)
				this.style = this.menu;
			else
				this.style = this.menu.style;
		this.homePos = eval("0" + this.type + this.dim)
		this.outPos	= 0
		this.accelConst	= (this.outPos - this.homePos)

		if (this.ns4 == 1) 
			this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
		this.es()
	}
}
MMenu.sM = function(id)
{
	var reg = MMenu.Reg;
	var obj = MMenu.Reg[id];

	if (obj.con) {
		obj.over = true

		if (obj.hideTimer) { 
			reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }
		
		if (!obj.open && !obj.aT) 
			obj.ss(true)
	}
}

MMenu.hM = function(id)
{
	var obj = MMenu.Reg[id]
	if (obj.con) {
		obj.over = false;
		if (obj.open && !obj.aT) 
			obj.ss(false);
	}
}

MMenu.prototype.ss = function(open) {
	this.open = open
	if (open) {
		var s;
		if (this.ns4 ==1)
			s = this.con;
		else
			s = this.con.style;
		s.visibility = "visible"
	}
	this.st = (new Date()).getTime()	
	this.aT = window.setInterval(this.gRef + ".s()", 1)
}

MMenu.prototype.s = function() {
	var elaps = (new Date()).getTime() - this.st;
	if (elaps > 1) 
		this.es();
	else {
		var setstyle;
		if (this.orien == "h")
			setstyle = "left";
		else
			setstyle = "top";
		if (this.ns4 == 1)
			this.style[setstyle] = p;
		else
			this.style[setstyle] = (p) + "px";
	}
}
MMenu.prototype.es = function() {
	this.aT = window.clearTimeout(this.aT);
	var p;
	if (this.open)
		p =this.outPos;
	else
		p =this.homePos;
	var setstyle;
	if (this.orien == "h")
		setstyle = "left";
	else
		setstyle = "top";
	if (this.ns4 == 1)
		this.style[setstyle] = p;
	else
		this.style[setstyle] = (p) + "px";
	if (!this.open) {
		var s
		if (this.ns4 == 1)
			s = this.con;
		else
			s = this.con.style;
		s.visibility = "hidden";
	}
	if ((this.open && !this.over) || (!this.open && this.over)) {
		this.ss(this.over);
	}
}


function tdOver(td){
	td.style.backgroundColor = '#44CC11';
	td.style.cursor ='hand';
	fontOver(td)
}

function tdOut(td){
	td.style.backgroundColor = '#F1F9EC';
	fontOut(td)
}

function fontOver(td){
	td.style.color = "#FFFFFF";
}

function fontOut(td){
	td.style.color = "#000000";
}

function LinkUrl(url , mode){
	if (mode == 1)
		window.open(url,"_blank");
	else
		location.href = url;
}