/**********
     TITLE: JavaScript Package for http://www.hut.fi/~ajkoivun/
   VERSION: May 6, 2000
  INCLUDES: magic-navigator.js, magic-layer.js, magic-css.js, magic-menu.js
    AUTHOR: Antti Koivunen <Antti.Koivunen@hut.fi>
 COPYRIGHT: 1999-2000 Antti Koivunen. All Rights Reserved.
**********/

/*** MagicNavigator Object - 2.1 (customized version) ***/

function mg_escapeFrame() { if (self != top) top.location.replace(self.location); }
function mg_getWindowWidth() { return this.width = (is.ie) ? document.body.offsetWidth-20 : window.innerWidth; }
function mg_getWindowHeight() { return this.height = (is.ie) ? document.body.offsetHeight-4 : window.innerHeight; }

/** Object Constructor **/

function MagicNavigator() {
	this.agt = navigator.userAgent.toLowerCase();
	this.name = navigator.appName;
	this.ver = navigator.appVersion;
	this.f = parseFloat(this.ver);
	this.i = parseInt(this.ver);
	this.ns  = ((this.agt.indexOf('mozilla') != -1) && (this.agt.indexOf('spoofer')==-1) && (this.agt.indexOf('compatible')==-1) && (this.agt.indexOf('opera')==-1) && (this.agt.indexOf('webtv')==-1));
	this.ns4 = (this.ns && (this.i == 4));
	this.ns4up = (this.ns && (this.f >= 4));
	this.ns406up = (this.ns && (this.f >= 4.06));
	this.ns5 = (this.ns && (this.i == 5));
	this.ie   = (this.agt.indexOf("msie") != -1);
	this.ie4  = (this.ie && (this.i == 4) && (this.agt.indexOf('msie 5') == -1));
	this.ie4up  = (this.ie && (this.f >= 4));
	this.ie5  = ((this.agt.indexOf('msie 5') != -1) && (this.agt.indexOf('msie 5.5') == -1));
	this.ie5up = (this.agt.indexOf('msie 5') != -1);	
	this.escapeFrame = mg_escapeFrame;
	this.getWidth = mg_getWindowWidth;
	this.getHeight = mg_getWindowHeight;
}

// Instantiate the Object
var is = new MagicNavigator();

/*** MagicLayer Object Component - Core - 2.5 ***/

// Necessary Browser Check
var mg_ie  = (document.all) ? true : false;
var mg_ns = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 4);

function mg_getLayerById(id, d) {
	var e = "", i;
	d = (d || document);
	if (d.getElementById) return d.getElementById(id);
	else if (d.all) return d.all[id];
	else if (d.layers && d.layers.length > 0) {
		if (d.layers[id]) return d.layers[id];
		for (i=0; i < d.layers.length; i++) {
			e = mg_getLayerById(id, d.layers[i].document);
			if (e) return e;
	}	}
	return false;
}

function mg_getCSSProperty(id, p) {
	var sheets = document.styleSheets, rules, i, j, v;
	for (i=0; i < sheets.length; i++) {
		rules = sheets[i].cssRules || sheets[i].rules;
		for (j=0; j < rules.length; j++) {
			if (rules[j].selectorText == id && rules[j].style[p]) v = rules[j].style[p];
	}	}
	return v;
}

function mg_getLayerCSSProperty(p) {
	if (this.styleRef[p]) return this.styleRef[p];
	else return mg_getCSSProperty("#" + this.id, p);
}

function mg_showLayer() { this.styleRef.visibility = mg_ns ? "show" : "visible"; }

function mg_hideLayer() { this.styleRef.visibility = mg_ns ? "hide" : "hidden"; }

function mg_setZ(z) { this.styleRef.zIndex = this.z = z; }

function mg_moveTo(x, y) {
	this.x = x;	this.y = y;
	x = Math.round(x); y = Math.round(y);
	this.styleRef.left = (mg_ns) ? x : x + "px";
	this.styleRef.top = (mg_ns) ? y : y + "px";
}

function mg_moveBy(dx, dy) { this.moveTo(this.x + dx, this.y + dy); }

function mg_roundCoords() {	this.moveTo(Math.round(this.x), Math.round(this.y)); }

function mg_setBgColor(color) {
	if (mg_ns) this.bgColor = this.styleRef.bgColor = color;
	else this.bgColor = this.styleRef.backgroundColor = color;
}

function mg_allEval(expr, type, not_id) {
	var m = MagicLayer.instances;
	if (type) {
		for (var i=0; i < m.length; i++) {
			if (m[i].type == type && m[i].id != not_id) eval("MagicLayer.instances[" + i + "]." + expr);
		}
	} else {
		for (var i=0; i < MagicLayer.instances.length; i++) {
			if (m[i].id != not_id) eval("MagicLayer.instances[" + i + "]." + expr);
}	}	}

function mg_hideAllLayers(type, not_id) { MagicLayer.all ('hide()', type, not_id) }

function mg_stopAllStatic(type, not_id) {
	for (var i=0; i < MagicLayer.activities.length; i++) {
		MagicLayer.all(MagicLayer.activities[i] + " = false", type, not_id);
}	}

function mg_stopAllInstance() {
	for (var i=0; i < MagicLayer.activities.length; i++) {
		eval("this." + MagicLayer.activities[i] + " = false");
}	}

function mg_addActivity(act) {
	MagicLayer.activities[act] = MagicLayer.activities[MagicLayer.activities.length] = act;
}

function mg_createInstances() {
	var a = arguments;
	for (var i=0; i < a.length; i++) {
		if (!a[i][2]) a[i][2] = "normal"; if (!a[i][3]) a[i][3] = "";
		eval("window."+a[i][0]+" = document."+a[i][0]+" = new MagicLayer('"+a[i][1]+"','"+a[i][2]+"','"+a[i][3]+"')");
}	}

/** MagicLayer Object Constructor **/

function MagicLayer(id, type, win) {

	this.id = id; this.type = type || "normal"; this.window = win || window;
	MagicLayer.instances[this.id] = MagicLayer.instances[MagicLayer.instances.length] = this;
	
	this.layerRef = mg_getLayerById(id, this.window.document);
	this.styleRef = this.layerRef.style || this.layerRef;
	this.layerRef.mgLayer = this;
	
	if (document.styleSheets) {
		var x = parseInt(this.getCSSProperty("left"));
		var y = parseInt(this.getCSSProperty("top"));
	} else {
		var x = parseInt(this.styleRef.left);
		var y = parseInt(this.styleRef.top);
	}
	this.x = this.origX = (x || x == 0) ? x : this.layerRef.offsetLeft;
	this.y = this.origY = (y || y == 0) ? y : this.layerRef.offsetTop;
	this.width = (this.layerRef.clip) ? this.layerRef.clip.width : this.layerRef.offsetWidth;
	this.height = (this.layerRef.clip) ? this.layerRef.clip.height : this.layerRef.offsetHeight;
}

/** Private Properties **/

MagicLayer.instances = new Array();
MagicLayer.activities = new Array();

/** Instance Methods **/

MagicLayer.prototype.show = mg_showLayer;
MagicLayer.prototype.hide = mg_hideLayer;
MagicLayer.prototype.setZ = mg_setZ;
MagicLayer.prototype.moveTo = mg_moveTo;
MagicLayer.prototype.moveBy = mg_moveBy;
MagicLayer.prototype.roundCoords = mg_roundCoords;
MagicLayer.prototype.setBgColor = mg_setBgColor;
MagicLayer.prototype.stopAll = mg_stopAllInstance;
MagicLayer.prototype.getCSSProperty = mg_getLayerCSSProperty;

/** Static Methods **/

MagicLayer.all = mg_allEval;
MagicLayer.hideAll = mg_hideAllLayers;
MagicLayer.stopAll = mg_stopAllStatic;
MagicLayer.addActivity = mg_addActivity;
MagicLayer.createInstances = mg_createInstances;

/*** MagicLayer Object Extension - Slide - 1.1 ***/

function mg_slideTo(end_x, end_y, n, t, e) {
	if (this.sliding) return "sliding";
	n = n || 25; t = t || 20; e = e || "";
	var dist_x = end_x - this.x, dist_y = end_y - this.y;
	var dx = dist_x / n, dy = dist_y / n;
	this.onSlideStart();
	this.sliding = true;
	this.doTheSlide(end_x, end_y, n, t, dx, dy, 0, e)
}

function mg_slideBy(dx, dy, n, t, e) { this.slideTo(this.x + dx, this.y + dy, n, t, e); }

function mg_doTheSlide(end_x, end_y, n, t, dx, dy, i, e) {
	if (!this.sliding) { this.roundCoords(); this.onSlideEnd(); return "stopped"; }
	if (i++ < n) {
		this.moveBy(dx, dy);
		this.onSlide();
		setTimeout("MagicLayer.instances['" + this.id + "'].doTheSlide("+end_x+","+end_y+","+n+","+t+","+dx+","+dy+","+i+",\""+e+"\")", t);
	} else {
		this.roundCoords();
		this.sliding = false;
		this.onSlideEnd();
		eval(e);
}	}

function mg_stopSlide() { this.sliding = false; }

function mg_stopAllSlide(type) { MagicLayer.all("sliding = false", type) }

/** Instance Methods **/

MagicLayer.prototype.slideTo = mg_slideTo;
MagicLayer.prototype.slideBy = mg_slideBy;
MagicLayer.prototype.doTheSlide = mg_doTheSlide;
MagicLayer.prototype.stopSlide = mg_stopSlide;
MagicLayer.prototype.onSlideStart = new Function();
MagicLayer.prototype.onSlide = new Function();
MagicLayer.prototype.onSlideEnd = new Function();

/** Instance Properties **/

MagicLayer.prototype.sliding = false;

MagicLayer.addActivity("sliding");

/** Static Methods **/

MagicLayer.stopAllSlide = mg_stopAllSlide;


/*** Magic CSS Functions - 1.31 (customized version) ***/

function mg_startCSS() { document.write("<style type=\"text/css\">\n"); }

function mg_endCSS() { document.write("</style>\n"); }

function mg_getCSS (e, str) {
	if (str.lastIndexOf(";") < str.length-2) str += ";";
	return str = e + " { " + str + " }\n";
}

function mg_getLayerCSS (e, str) {
	if (e.indexOf("#") == -1) e = "#" + e; if (str.lastIndexOf(";") < str.length-2) str += ";";
	if (document.layers) {
		str = str.replace(/background-color/i,"layer-background-color");
		str = str.replace(/background-image/i,"layer-background-image");
	}
	if (str.indexOf("clip") == -1 && str.indexOf("width") != -1 && str.indexOf("height") != -1) {
		var width = str.match(/[^\x2D]width:[\d|\s\d]+[\w|%]+/i)[0].match(/\d+[\w|%]+/)[0];
		var height = str.match(/[^\x2D]height:[\d|\s\d]+[\w|%]+/i)[0].match(/\d+[\w|%]+/)[0];
		str += " clip: rect(0px, " + width + ", " + height + ", 0px);";
	}
	return str = e + " { " + str + " }\n";
}

function mg_writeCSS(e, str) { document.write(mg_getCSS(e, str)); }

function mg_writeLayerCSS(e, str) { document.write(mg_getLayerCSS(e, str)); }

function mg_linkCSS(file) { document.write('<link rel="stylesheet" href="' + file + '" type="text/css">'); }

/*** MagicMenu Object Component - 1.31 (customized version) ***/

// Necessary Browser Check
var mg_ie4 = (mg_ie && !document.getElementById) ? true : false;
var mg_ns5 = (document.getElementById && !mg_ie) ? true : false;

function mg_setMenuColors(t_bg_color, m_bg_color) {
	t_bg_color = t_bg_color || new Array(2); m_bg_color = m_bg_color || new Array(2);
	this.titleBgColor = new Array(2); this.subMenuBgColor = new Array(2);
	this.titleBgColor[0] = t_bg_color[0] || "#336699";
	this.subMenuBgColor[0] = m_bg_color[0] || "#6699CC";
	this.titleBgColor[1] = t_bg_color[1] || this.subMenuBgColor[0];
	this.subMenuBgColor[1] = m_bg_color[1] || this.subMenuBgColor[0];
}

function mg_setFontStyles(t_f_style, m_f_style) {
	t_f_style = t_f_style || new Array(3); m_f_style = m_f_style || new Array(3);
	this.titleFont = new Array(3); this.subMenuFont = new Array(3);
	this.titleFont[0] = t_f_style[0] || "font-family:Verdana,Arial,sans-serif; font-size:12px; font-weight:bold; color:#FFCC66; text-decoration:none;";
	this.titleFont[1] = t_f_style[1] || this.titleFont[0];
	this.titleFont[2] = t_f_style[2] || this.titleFont[1];
	this.subMenuFont[0] = m_f_style[0] || "font-family:Verdana,Arial,sans-serif; font-size:12px; color:#FFCC66; text-decoration:none;";
	this.subMenuFont[1] = m_f_style[1] || this.subMenuFont[0];
	this.subMenuFont[2] = m_f_style[2] || this.subMenuFont[1];
}

function mg_addSubMenu(id, title, title_url, desc, t_bg_color, m_bg_color, t_f_style, m_f_style) {
	title_url = title_url || "javascript://";
	this.subMenus[id] = this.subMenus[this.subMenus.length] = new mg_SubMenu(id, title, title_url, this, t_bg_color, m_bg_color, t_f_style, m_f_style);
	this.subMenus[id].titleDescStr = (desc) ? '" onMouseOver="window.status = \'' + desc + '\'; return true;' : "";
}

function mg_addSubMenuItem(link, url, desc) {
	var n = this.items.length;
	this.items[n] = new Array(2);
	this.items[n][0] = link;
	this.items[n][1] = url;
	this.items[n][2] = (desc) ? ' window.status = \'' + desc + '\'; return true;' : "";
}

function mg_getSubMenuSize() {
	var chars = 0;
	this.titleFontSize = eval(this.titleFont[0].match(/font-size:[\d|\s\d]+/i)[0].match(/\d+/)[0]);
	this.menuFontSize = eval(this.menuFont[0].match(/font-size:[\d|\s\d]+/i)[0].match(/\d+/)[0]);
	this.titleWidth = Math.round((this.title.length * this.titleFontSize) / 1.2);
	this.titleHeight = Math.round(this.titleFontSize * 1.7);
	for (var i = 0; i < this.items.length; i++)
		chars = Math.max(chars, this.items[i][0].length);
	this.menuWidth = Math.round((chars * this.menuFontSize) / this.menu.menuFontC);
}

function mg_getMenuCSS() {
	var title_x = 0, title_h = 0, str = "<style type=\"text/css\">\n", m;
	for (var i = 0; i < this.subMenus.length; i++) {
		this.subMenus[i].getSize();
		this.subMenus[i].titleX = title_x;
		this.width = title_x += this.subMenus[i].titleWidth;
		this.height = title_h = Math.max(title_h, this.subMenus[i].titleHeight);
	}
	if (this.fixedHeight) this.height = title_h = this.fixedHeight;
	if (this.fixedWidth) {
		var k = this.fixedWidth / this.width;
		this.width = this.fixedWidth;
		for (var i = 0; i < this.subMenus.length; i++) {
			m = this.subMenus[i];
			m.titleX = Math.round(k * m.titleX);
			m.titleWidth = Math.round(k * m.titleWidth);
	}	}
	str += mg_getLayerCSS(this.id, "position:absolute; left:0px; top:0px; z-index:" + this.zIdx + "; width:" + this.width + "px; visibility:hidden;");
	for (var i = 0; i < this.subMenus.length; i++) {
		m = this.subMenus[i];
		m.titleCSS = mg_getLayerCSS(m.titleId, "position:absolute; left:"+m.titleX+"px; top:0px; z-index:" + this.zIdx + "; width:"+m.titleWidth+"px; height:"+title_h+"px; background-color:"+m.titleBgColor[0]+"; text-align:center; padding:2px;");
		m.titleCSS += mg_getCSS("#"+m.titleId+" A", m.titleFont[0]);
		m.titleCSS += mg_getCSS("#"+m.titleId+" A:hover", m.titleFont[1]);
		str += m.titleCSS += mg_getCSS("#"+m.titleId+" A:active", m.titleFont[2]);
		if (m.items.length > 0) {
			m.menuCSS = mg_getLayerCSS(m.menuId, "position:absolute; left:0px; top:"+title_h+"px; z-index:" + this.zIdx + "; width:"+((mg_ns5 || mg_ie4) ? m.menuWidth+"px" : "auto")+"; background-color:"+m.menuBgColor[0]+"; padding:3px; visibility:hidden;");
			m.menuCSS += mg_getCSS("#"+m.menuId+" A", m.menuFont[0]);
			m.menuCSS += mg_getCSS("#"+m.menuId+" A:hover", m.menuFont[1]);
			str += m.menuCSS += mg_getCSS("#"+m.menuId+" A:active", m.menuFont[2]);
	}	}
	return str += "</style>\n";
}

function mg_getMenuDIV() {
	var str = "", m, b=0;
	str += "<div id=\"" + this.id + "\">\n";
	for (var i = 0; i < this.subMenus.length; i++) {
		m = this.subMenus[i];
		str += "<div id=\"" + m.titleId + "\">\n" + "<a href=\"" + m.titleUrl + m.titleDescStr + "\">" + m.title + "</a>" + "</div>\n";
	}
	str += "</div>\n";
	for (var i = 0; i < this.subMenus.length; i++) {
		m = this.subMenus[i];
		if (m.items.length > 0) {
			str += "<div id=\"" + m.menuId + "\">\n";
			for (var j = 0; j < m.items.length; j++)
				str += '<img name="topMenuImg'+b+'" id="topMenuImg'+b+'" src="images/bullet_arrow6.gif" width="10" height="10" alt="" border="0" /> <a href="' + m.items[j][1] + '" onmouseover="topMenuImg' + b + '.src = \'images/bullet_arrow7.gif\';' + m.items[j][2] + '" onmouseout="topMenuImg' + b++ + '.src = \'images/bullet_arrow6.gif\';">' + m.items[j][0] + '</a><br />\n';
			str += "</div>\n";
	}	}
	return str;
}

function mg_createMenuMgLayers() {
	var m;
	this.mgLayer = new MagicLayer(this.id, "mgLayer");
	this.mgLayer.menu = this;
	for (var i = 0; i < this.subMenus.length; i++) {
		m = this.subMenus[i];
		m.titleLayer = new MagicLayer(m.titleId, this.titleType);
		m.titleLayer.menu = m; m.titleLayer.bgColor0 = m.titleLayer.menu.titleBgColor[0]; m.titleLayer.bgColor1 = m.titleLayer.menu.titleBgColor[1];
		if (m.items.length > 0) {
			m.menuLayer = new MagicLayer(m.menuId, this.subMenuType);
			m.menuLayer.menu = m; m.menuLayer.bgColor0 = m.menuLayer.menu.menuBgColor[0]; m.menuLayer.bgColor1 = m.menuLayer.menu.menuBgColor[1];
}	}	}

function mg_placeSubMenus() {
	var m;
	for (var i = 0; i < this.subMenus.length; i++) {
		m = this.subMenus[i];
		if (m.menuLayer) {
			m.menuLayer.origX = m.menuX = Math.min(m.titleX+this.mgLayer.x, this.mgLayer.x + this.width - ((m.menuLayer.width) ? m.menuLayer.width : m.menuWidth));
			m.menuLayer.origY = m.menuY = this.mgLayer.y + this.height;
			m.menuLayer.moveTo(m.menuLayer.origX, m.menuLayer.origY);
}	}	}

function mg_setBgColor0() {	this.setBgColor(this.bgColor0); }

function mg_setBgColor1() {	this.setBgColor(this.bgColor1); }

function mg_hideSubMenu() {
	if (this.menu.menuLayer) {
		this.menu.menuLayer.hide();
		this.menu.menuLayer.styleRef.display = "none";
}	}

function mg_showSubMenu() {
	if (this.menu.menuLayer) {
		this.menu.menuLayer.show();
		this.menu.menuLayer.styleRef.display = "block";
}	}

function mg_getMgLayerOnEvent(e, c) {
	if (e && e.relatedTarget) e.relatedNode = e.relatedTarget;
	if ((mg_ns || (mg_ns5 && e.relatedNode.nodeName != "#text" && (e.relatedNode.nodeName != "IMG" || e.relatedNode.nodeName == "IMG" && e.relatedNode.id.indexOf("topMenu") == -1)) && e.target.mgLayer)) return e.target.mgLayer;
	else if (mg_ie && event.srcElement.mgLayer && event.toElement && event.fromElement && event.toElement.tagName != "A" && event.fromElement.tagName != "A" && event.toElement.tagName != "IMG" || (event.toElement.tagName == "IMG" && event.toElement.id.indexOf("topMenu") == -1)) return event.srcElement.mgLayer;
	else if (c == 1 && mg_ie && event.toElement.tagName == "A" && event.fromElement && event.fromElement.mgLayer) return event.fromElement.mgLayer;
	else return false;
}

function mg_onMouseOverTitle(e) {
	var mgLayer = mg_getMgLayerOnEvent(e, 1);
	if (mgLayer) {
		MagicLayer.all("setBgColor0()", mgLayer.menu.menu.titleType, mgLayer.id);
		MagicLayer.all("hideSubMenu()", mgLayer.menu.menu.titleType, mgLayer.id);
		mgLayer.setBgColor1();
		mgLayer.showSubMenu();
}	}

function mg_onMouseOutTitle(e) {
	var mgLayer = mg_getMgLayerOnEvent(e);
	if (mgLayer) {
		if (!mgLayer.menu.menuLayer) mgLayer.setBgColor0();
		else if ((mg_ie && event.toElement != mgLayer.menu.menuLayer.layerRef) || ((mg_ns || mg_ns5) && e.layerY > mgLayer.menu.menu.height)) {
			MagicLayer.all("setBgColor0()", mgLayer.menu.menu.titleType);
			MagicLayer.all("hideSubMenu()", mgLayer.menu.menu.titleType);
}	}	}

function mg_onMouseOverSubMenu(e) {
	var mgLayer = mg_getMgLayerOnEvent(e, 1);
	if (mgLayer) mgLayer.setBgColor1();
}

function mg_onMouseOutSubMenu(e) {
	var mgLayer = mg_getMgLayerOnEvent(e);
	if (mgLayer) {
		mgLayer.setBgColor0();
		if ((mg_ns && e.layerY > mgLayer.menu.menu.height) || (mg_ie && event.toElement != mgLayer.menu.titleLayer.layerRef) || (mg_ns5 && e.relatedNode != mgLayer.menu.titleLayer.layerRef)) {		
			MagicLayer.all("setBgColor0()", mgLayer.menu.menu.titleType);
			MagicLayer.all("hideSubMenu()", mgLayer.menu.menu.titleType);
}	}	}

function mg_setMenuEvents() {
	MagicLayer.all("layerRef.onmouseover = mg_onMouseOverTitle", this.titleType);
	MagicLayer.all("layerRef.onmouseout = mg_onMouseOutTitle", this.titleType);
	MagicLayer.all("layerRef.onmouseover = mg_onMouseOverSubMenu", this.subMenuType);
	MagicLayer.all("layerRef.onmouseout = mg_onMouseOutSubMenu", this.subMenuType);
}

function mg_buildMenu(x_loc, y_loc) {
	document.write(this.getCSS());
	document.write(this.getDIV());
	this.createMgLayers();
	this.setEvents();
	this.xLoc = x_loc || this.xLoc; this.yLoc = y_loc || this.yLoc;
	if (this.xLoc == "right") this.xLoc = mg_getWindowWidth() - this.width;
	else if (typeof(this.xLoc) == "string") this.xLoc = eval(this.xLoc);
	if (typeof(this.yLoc) == "string") this.yLoc = eval(this.yLoc);
	this.mgLayer.moveTo(this.xLoc, this.yLoc);
	this.placeSubMenus();
	this.mgLayer.show();
	this.onBuild();
}

/** MagicMenu Object Constructor **/

function MagicMenu(t_bg_color, m_bg_color, t_f_style, m_f_style, id) {
	this.id = id = id || "mgMenu" + MagicMenu.instances.length;
	MagicMenu.instances[id] = MagicMenu.instances[MagicMenu.instances.length] = this;

	this.subMenus = new Array();
	this.titleType = id + "Title";
	this.subMenuType = id + "SubMenu";
	
	this.setBgColors(t_bg_color, m_bg_color);
	this.setFontStyles(t_f_style, m_f_style);
	this.fixedHeight = this.fixedWidth = false;
	this.xLoc = this.yLoc = 0;
	this.zIdx = 700; this.menuFontC = 1.4;
}

function mg_SubMenu(id, title, title_url, menu, t_bg_color, m_bg_color, t_f_style, m_f_style) {
	this.id = id;
	this.titleId = menu.id + id + "Title";
	this.menuId = menu.id + id + "Menu";
	this.title = title;
	this.titleUrl = title_url;
	this.menu = menu;
	this.items = new Array();
	eval("this.menu." + id + " = this");
	
	if (!t_bg_color) t_bg_color = new Array(2); if (!m_bg_color) m_bg_color = new Array(2);
	this.titleBgColor = new Array(2); this.menuBgColor = new Array(2);
	
	this.titleBgColor[0] = t_bg_color[0] || menu.titleBgColor[0];
	this.menuBgColor[0] = m_bg_color[0] || menu.subMenuBgColor[0];
	this.titleBgColor[1] = t_bg_color[1] || menu.titleBgColor[1];
	this.menuBgColor[1] = m_bg_color[1] || menu.subMenuBgColor[1];
	
	if (!t_f_style) t_f_style = new Array(3); if (!m_f_style) m_f_style = new Array(3);
	this.titleFont = new Array(3); this.menuFont = new Array(3);

	this.titleFont[0] = t_f_style[0] || menu.titleFont[0]
	this.titleFont[1] = t_f_style[1] || menu.titleFont[1];
	this.titleFont[2] = t_f_style[2] || menu.titleFont[2];
	this.menuFont[0] = m_f_style[0] || menu.subMenuFont[0];
	this.menuFont[1] = m_f_style[1] || menu.subMenuFont[1];
	this.menuFont[2] = m_f_style[2] || menu.subMenuFont[2];
	
	this.addMenuItem = mg_addSubMenuItem;
	this.getSize = mg_getSubMenuSize;
}

/** Private Properties **/

MagicMenu.instances = new Array();

/** Instance Methods **/

MagicLayer.prototype.setBgColor0 = mg_setBgColor0;
MagicLayer.prototype.setBgColor1 = mg_setBgColor1;
MagicLayer.prototype.hideSubMenu = mg_hideSubMenu;
MagicLayer.prototype.showSubMenu = mg_showSubMenu;

MagicMenu.prototype.setBgColors = mg_setMenuColors;
MagicMenu.prototype.setFontStyles = mg_setFontStyles;
MagicMenu.prototype.addSubMenu = mg_addSubMenu;
MagicMenu.prototype.getCSS = mg_getMenuCSS;
MagicMenu.prototype.getDIV = mg_getMenuDIV;
MagicMenu.prototype.createMgLayers = mg_createMenuMgLayers;
MagicMenu.prototype.placeSubMenus = mg_placeSubMenus;
MagicMenu.prototype.build = mg_buildMenu;
MagicMenu.prototype.setEvents = mg_setMenuEvents;
MagicMenu.prototype.onBuild = new Function();
















































