globalNS = (document.layers);
globalIE = (document.all);

globalNSIE = (globalNS || globalIE);
globalNoMac = (navigator.appVersion.indexOf("Mac") == -1);

ResearchGroup = (globalNSIE && globalNoMac);

if (!ResearchGroup) event = null;

//array º¯¼ö ÃÊ±âÈ­
arena = new Array (
	['Frame.aspx?mID=101', '<span style="font-size:9pt"><font color=black>&nbsp\;Áö±Þ°áÁ¦¿¬±¸È¸</font></span>'],
	['Frame.aspx?mID=177', '<span style="font-size:9pt"><font color=black>&nbsp\;±ÝÀ¶»ê¾÷Á¶Á÷¿¬±¸È¸</font></span>']
);


//if (globalIE) { Window.onload = MakeMenu; }

var finished = false;
var timer = null;
var width = 120;
var y_offset = 610;
var layerName;
var prev = "";
var j = 0;

function MakeMenu() {	
	CreateContainer("ResearchGroup", arena);
	
	finished = true;
}


function CreateContainer(elName, ar) {
	if (globalNS) {
		document.layers[elName] = new Layer(width); 
		container = document.layers[elName];
		container.bgColor = "#000000";
		container.visibility = "hidden";
	
		container.onmouseover = OverLayer;  
		container.onmouseout = OutLayer;
		container.hide = Hide;
	} else {
		container = "<div id=" +  elName + " style='position:absolute; width:" + width + ";'></div>";
		window.document.body.insertAdjacentHTML("BeforeEnd",container);
		container = document.all[elName];
		container.style.left = 50;
		container.style.top = 50;
		container.style.backgroundColor = "#000000";
		container.style.visibility = "hidden";
	
		container.onmouseover = OverLayer;
		container.onmouseout = OutLayer;
		container.hide = Hide;

	}
	
	CreateLayers(elName, ar);
}


function CreateLayers (elName, ar) {
	if (globalNS) {	
		width = width - 2;
		var totalLayerHeight = 1;
	
		for (i = 0; i < ar.length; i++) {
			layerName = elName + i;
			layerName = new Layer(width, container);
			layerName.left = 1;
			layerName.clip.width = width;
			layerName.top = totalLayerHeight;
			layerName.bgColor = "white";        //"#0099cc";
			layerName.newUrl = ar[i][0];
			layerName.visibility = "inherit";
			totalLayerHeight += layerName.clip.height + 14;
			//alert(layerName.clip.height);
			layerName.onmouseover = OnState;  
			layerName.onmouseout = OffState;
			layerName.captureEvents(Event.MOUSEUP);
			layerName.onmouseup = NavTo;

			layerName.document.open();
			layerName.document.write(ar[i][1]);
			layerName.document.close();
		}
	
		container.clip.height = totalLayerHeight;		
	} else {
		var totalLayerHeight = 1;

		for (i = 0; i < ar.length; i++) {
			layerName = "popupNavBar" + (j + i);

			var tempName = "<div id= " + layerName + " style='position:relative; width:" + width + ";'>" + ar[i][1] + "</div>";
			document.all[elName].insertAdjacentHTML("BeforeEnd",tempName);
			layerName = document.all[layerName];	
		
			layerName.style.borderStyle = "solid";
			layerName.style.borderColor = "#111111";
			layerName.style.borderWidth = 1;
			
			if (i != 0) {
				layerName.style.borderTopWidth = 0;
			}
			
			layerName.style.backgroundColor = "white";   //"#4499cc";

			layerName.newUrl = ar[i][0];
			layerName.style.cursor = "hand";
			layerName.onmouseover = OnState;
			layerName.onmouseout = OffState;
			layerName.onmouseup = NavTo;		
		}
	
		j += i;
	}
}


function ShowLayer(el, event) {
	if (globalNS) {		
		if (prev != "") {
			wh = document.layers[prev];
			wh.hide();
		}
	
		if (!finished) return;
		isOver = true;
		whichLayer = document.layers[el];	
		whichLayer.left = 860;
		whichLayer.top = event.pageY + 5 + (y_offset - event.pageY);
		whichLayer.visibility = "visible";
	} else {
		if (prev != "") {
			wh = document.all[prev];
			wh.hide();
		}
		
		clearTimeout(timer);
		if (!finished) return;
		whichEl = document.all[el].style;
		//whichEl.left = event.x - width;
		//whichEl.left = event.x + 1;
		whichEl.left = 860;
		whichEl.top = event.y + 5 + (y_offset - event.y) ;
		whichEl.visibility = "visible";
		//alert(event.y);
	}
	
	prev = el;	
}


function OverLayer() {clearTimeout(timer); isOver = true;}


function OutLayer() {
	isOver = false;
	
	if (globalNS) {
		whichLayer = this;
		timer = setTimeout("whichLayer.hide()",300); 
	} else {
		whichEl = this;
		timer = setTimeout("whichEl.hide()",300);	
	}
}


function HideLayer(el) {
	if (!finished) return;
	isOver = false;	

	if (globalNS) {
		whichLayer = document.layers[el];
		timer = setTimeout("whichLayer.hide()",300);	
	} else {
		whichEl = document.all[el];
		timer = setTimeout("whichEl.hide()",300);	
	}
}


function Hide() {
	if (globalNS) {
		if (!isOver) this.visibility = "hidden";
	} else {
		if (!isOver) this.style.visibility = "hidden";
	}
}


function OnState() {
	if (globalNS) {	
		this.bgColor = "#E3D1BE";
	} else {	
		this.style.backgroundColor = "#E3D1BE";
	}
}


function OffState() {

	if (globalNS) {		
		this.bgColor = "white";     //"#0099cc";
	} else {	
		this.style.backgroundColor = "white";     //"#0099cc";
	}


}


function NavTo(newUrl) {
	window.location.href = this.newUrl;
}
