/************************************************************************************************/
/* Default Select Box Object                                                                    */
/* tle : Title / value : Value / vDir : Direction / child : Sub Object / tDir : Link Target     */
/* tDir : 0-_top, 1-_self, 2-popup, 3-_blank                                                    */
/************************************************************************************************/
function selectBox(tle, value, vDir, child, tDir) {
	this.tle = tle;
	this.value = value;
	this.vDir = vDir;
	this.child = child;
	this.tDir = tDir;
}


/************************************************************************************************/
/* Default Select Box List                                                                      */
/************************************************************************************************/
var arrSelBox = new Array(
	new selectBox("Family Site","",0,
		new Array(
			new selectBox("Family Site","")
			,new selectBox("»ïÃ»°¢","http://www.samcheonggak.or.kr/",0,"",3)
			,new selectBox("±³Çâ¾Ç´Ü","http://www.seoulphil.co.kr/",0,"",3)
			,new selectBox("±¹¾Ç°üÇö¾Ç´Ü","http://www.koreanmusic.or.kr/",0,"",3)
			,new selectBox("±Ø´Ü","http://www.smtc.or.kr/",0,"",3)
			,new selectBox("¹ÂÁöÄÃ´Ü","http://www.seoulmusical.or.kr/",0,"",3)
			,new selectBox("ÇÕÃ¢´Ü","http://www.seoulmetchorus.com/",0,"",3)
			,new selectBox("¹«¿ë´Ü","http://www.sejongpac.or.kr/artistic/dance_contents_01.html",0,"",3)
			,new selectBox("¿ÀÆä¶ó´Ü","http://www.seoulmetopera.co.kr/",0,"",3)
			,new selectBox("Ã»¼Ò³â±³Çâ¾Ç´Ü","http://www.sejongpac.or.kr/artistic/y_orchestra_contents_01.html",0,"",3)
			,new selectBox("¼Ò³â¼Ò³àÇÕÃ¢´Ü","http://www.sejongpac.or.kr/artistic/y_choir_contents_01.html",0,"",3)
		)
	)
);


/************************************************************************************************/
/* Default Variable                                                                             */
/************************************************************************************************/
var selBoxUnits = 18; // Box Units 19pixel
var selBoxWidth = 180;
var selBoxAlign = "right";
var icoSelBox = "/Img/Common/"; // Box Right Icon
var tdFontColor1 = "#666666"; // onMouseOut Td Color
var tdFontColor2 = "#666666"; // onMouseOver Td Color
var tdBgColor1 ="#ffffff"; // onMouseOut Td Color
var tdBgColor2 ="#eeeeee"; // onMouseOver Td Color
var tdBorderColor = "#c7c7c7"; // Box Border Color
var UserAgent = navigator.userAgent;
var AppVersion = (((navigator.appVersion.split('; '))[1].split(' '))[1]);


/************************************************************************************************/
/* Select Box Mouse Over&Out State Change Function                                              */
/************************************************************************************************/
function selBoxColorChg(idx,state) {
	var fColor = (state=="over")?tdFontColor2:tdFontColor1;
	var bColor = (state=="over")?tdBgColor2:tdBgColor1;
	var aImg = (state=="over")?icoSelBox+"icoArrowGray00Over.gif":icoSelBox+"icoArrowGray00Out.gif";
	tdChgColor(document.getElementById("selText"+idx), fColor, bColor);
	tdChgColor(document.getElementById("selBox"+idx), fColor, bColor);
	document.getElementById("selBoxArrow"+idx).src = aImg;
}


/************************************************************************************************/
/* Background & Font Color Change Function                                                      */
/************************************************************************************************/
function tdChgColor(obj,fColor,bColor) {
	obj.style.color = fColor;
	obj.style.backgroundColor = bColor;
}


/************************************************************************************************/
/* View & Hide Select Box List Function                                                         */
/************************************************************************************************/
function viewList(idx,idy) {
	var tempStr = "";
	var selObj = document.getElementById("outDivSel"+idx);
	var selPosObj = document.getElementById("divSel"+idx);
	var selTopPos = arrSelBox[idx].child.length*selBoxUnits;
	selPosObj.style.top = (arrSelBox[idx].vDir)?selBoxUnits+1:-(selTopPos+1);
	selObj.style.display = "block";
}


function hideList(idx,idy) {
	var tempStr = "";
	var selObj = document.getElementById("outDivSel"+idx);
	var selPosObj = document.getElementById("divSel"+idx);
	var selTopPos = arrSelBox[idx].child.length*selBoxUnits;
	selPosObj.style.top = (arrSelBox[idx].vDir)?selBoxUnits+1:-(selTopPos+1);
	selObj.style.display = "none";
}

/************************************************************************************************/
/* Set Selected Value Function                                                                  */
/************************************************************************************************/
function setSelBox(idx,idy) {
	hideList(idx, idy);
	document.getElementById("selText"+idx).innerHTML = arrSelBox[idx].child[idy].tle;
	selAfterAction(idx,idy);
}


/************************************************************************************************/
/* Selected Action Function                                                                     */
/************************************************************************************************/
function selAfterAction(idx, idy) {
	if (arrSelBox[idx].child[idy].value == "") return;
	if (arrSelBox[idx].child[idy].tDir == 2) {
		window.top.document.location.href = arrSelBox[idx].child[idy].value;
	}
	if (arrSelBox[idx].child[idy].tDir == 3) {
		window.open(arrSelBox[idx].child[idy].value,'');
	}
//	document.getElementById("selText"+idx).innerHTML = arrSelBox[idx].tle;
}


/************************************************************************************************/
/* Normal SelectBox Action Function                                                             */
/************************************************************************************************/
function selNormalAction(idx, idy) {
	if (arrSelBox[idx].child[idy].value == "") return;
	if (arrSelBox[idx].child[idy].tDir == 2) {
		window.top.document.location.href = arrSelBox[idx].child[idy].value;
	}
	if (arrSelBox[idx].child[idy].tDir == 3) {
		window.open(arrSelBox[idx].child[idy].value,'');
	}
//	document.getElementById("selBox"+idx).selectedIndex = 0;
}



/************************************************************************************************/
/* Draw Select Box Function                                                                     */
/************************************************************************************************/
function drawSelectBox(idx) {
	var strTemp = "";
	if ( UserAgent.indexOf( "MSIE" ) < 0 || AppVersion < 5 ) {
		strTemp += "<select id=\"selBox"+idx+"\" style=\"width:"+selBoxWidth+";text-align:"+selBoxAlign+"\" onChange=\"selNormalAction("+idx+",this.selectedIndex)\">";
		for (var i=0; i < arrSelBox[idx].child.length; i++) {
			strTemp += "	<option value=\""+arrSelBox[idx].child[i].value+"\">"+arrSelBox[idx].child[i].tle+"</option>";
		}
		strTemp += "</select>";
	} else {
		strTemp += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width='"+selBoxWidth+"'>";
		strTemp += "	<tr>";
		strTemp += "		<td>";
		strTemp += "			<div id=\"outDivSel"+idx+"\" name=\"outDivSel"+idx+"\" style=\"position:absolute;width:100%;display:none;\" onMouseOver=\"viewList("+idx+")\" onMouseOut=\"hideList("+idx+")\">";
		strTemp += "				<div id=\"divSel"+idx+"\" name=\"divSel"+idx+"\" style=\"position:relative;width:100%;top:0\">";
		strTemp += "					<table cellpadding=\"1\" cellspacing=\"0\" border=\"1\" width=\""+selBoxWidth+"\" bordercolor=\""+tdBorderColor+"\" style=\"border-collapse:collapse;\" frame=\"vside\" rules=\"cols\" bgcolor=\""+tdBgColor1+"\">";

		for (var i=0; i < arrSelBox[idx].child.length; i++) {
			strTemp += "						<tr height=\""+selBoxUnits+"\">";
			strTemp += "							<td style=\"cursor:hand;padding:0 5 0 5;color:"+tdFontColor1+";\" onMouseOver=\"tdChgColor(this,'"+tdFontColor2+"','"+tdBgColor2+"')\" onMouseOut=\"tdChgColor(this,'"+tdFontColor1+"','"+tdBgColor1+"')\" onClick=\"setSelBox("+idx+","+i+")\" align=\""+selBoxAlign+"\">"+arrSelBox[idx].child[i].tle+"</td>";
			strTemp += "						</tr>";
		}

		strTemp += "					</table>";
		strTemp += "				</div>";
		strTemp += "			</div>";
		strTemp += "			<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" width=\""+selBoxWidth+"\" bordercolor=\""+tdBorderColor+"\" style=\"border-collapse:collapse;\" onMouseOver=\"selBoxColorChg("+idx+",'over')\" onMouseOut=\"selBoxColorChg("+idx+",'out')\" onClick=\"viewList("+idx+")\" frame=\"vside\" rules=\"rows\">";
		strTemp += "				<tr height=\""+selBoxUnits+"\">";
		strTemp += "					<td bgcolor=\""+tdBgColor1+"\" style=\"cursor:hand;padding:2 5 0 5;color:"+tdFontColor1+"\" id=\"selText"+idx+"\" align=\""+selBoxAlign+"\">"+arrSelBox[idx].child[0].tle+"</td>";
		strTemp += "					<td width=\""+(selBoxUnits-1)+"\" id=\"selBox"+idx+"\" align=\"center\"><img src=\""+icoSelBox+"icoArrowGray00Out.gif\" border=\"0\" id=\"selBoxArrow"+idx+"\"></td>";
		strTemp += "				</tr>";
		strTemp += "			</table>";
		strTemp += "		</td>";
		strTemp += "	</tr>";
		strTemp += "</table>";
	}
	document.write(strTemp);
}
