//SuckerTree Horizontal Menu (Sept 14th, 06)
//By Dynamic Drive: http://www.dynamicdrive.com/style/
var menuids=["treemenu1"] //Enter id(s) of SuckerTree UL menus, separated by commas
function buildsubmenus_horizontal(){
for (var i=0; i<menuids.length; i++){
	if ( document.getElementById(menuids[i]) )
	{
	
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul");
    for (var t=0; t<ultags.length; t++){
	    if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
				ultags[t].style.top=(ultags[t].parentNode.offsetHeight-5)+"px" ;//dynamically position first level submenus to be height of main menu item
			}
    }
  }
}
}

function mouseOver(menuId, imgNum){
	var obj = document.getElementById(menuId);
	var otherObj = document.getElementsByName("maintopmenu");
	var temp = "" ;
	for(var i=0;i<otherObj.length;i++){		
		if(otherObj[i].id != obj.id ){
      if(otherObj[i].parentNode.getElementsByTagName("ul")[0].style.display=="block"){
  			temp = otherObj[i].id.replace('topmenu',"")
  			fncOff(otherObj[i], temp);
  			//otherObj[i].style.backgroundImage='url(../files/images/korean/common/tm_00' + temp+ '.gif)';  			
  			//otherObj[i].parentNode.getElementsByTagName("ul")[0].style.display="none";
  		}
    }else{
    	 if(otherObj[i].parentNode.getElementsByTagName("ul")[0].style.display=="none"){
  			temp = otherObj[i].id.replace('topmenu',"")
  			fncOn(otherObj[i], temp);
  			//otherObj[i].style.backgroundImage='url(../files/images/korean/common/tm_00' + temp+ '_on.gif)';  			 
  			//otherObj[i].parentNode.getElementsByTagName("ul")[0].style.display="block";
  		}
    	//obj.style.paddingTop = '10px';
    }
	}	
}

function mouseOutIE(){
	if( navigator.appName.indexOf("Microsoft") > -1 ){         // ë§ˆì´í¬ë¡œì†Œí""íŠ¸ ìµìŠ¤í"Œë¡œëŸ¬ì¸ì§€ í™•ì¸
		var currentObj = document.getElementById("currentCheck");
		var otherObj = document.getElementsByName("maintopmenu");
		var temp = "";
		for(var i=1;i<=otherObj.length;i++){		
				temp = otherObj[i-1].id.replace("topmenu","")
			if(i == currentObj.value ){
        if(otherObj[i-1].parentNode.getElementsByTagName("ul")[0].style.display=="none"){
        	fncOn(otherObj[i-1], temp);
  				//otherObj[i-1].style.backgroundImage='url(../files/images/korean/common/tm_00' + temp + '_on.gif)';
  				//otherObj[i-1].parentNode.getElementsByTagName("ul")[0].style.display="block";
          }
			}else {
				if(otherObj[i-1].parentNode.getElementsByTagName("ul")[0].style.display=="block"){
					fncOff(otherObj[i-1], temp);
					//otherObj[i-1].style.backgroundImage='url(../files/images/korean/common/tm_00' + temp + '.gif)';
					//otherObj[i-1].parentNode.getElementsByTagName("ul")[0].style.display="none";
          }
			}
		}
  }else{                                                                               // ìµìŠ¤í"Œë¡œëŸ¬ê°€ ì•"ë‹ ê²½ìš°
	}
}

function mouseOutFF(){
	 if( navigator.appName.indexOf("Microsoft") > -1 ){         // ë§ˆì´í¬ë¡œì†Œí""íŠ¸ ìµìŠ¤í"Œë¡œëŸ¬ì¸ì§€ í™•ì¸
    }else{    	                                                                               // ìµìŠ¤í"Œë¡œëŸ¬ê°€ ì•"ë‹ ê²½ìš°		
			var currentObj = document.getElementById("currentCheck");
  		var otherObj = document.getElementsByName("maintopmenu");
  		var temp = "";
  		for(var i=1;i<=otherObj.length;i++){		
  				temp = otherObj[i-1].id.replace("topmenu","")
  			if(i == currentObj.value ){
          if(otherObj[i-1].parentNode.getElementsByTagName("ul")[0].style.display=="none"){
        	  fncOn(otherObj[i-1], temp);
    				//otherObj[i-1].style.backgroundImage='url(../files/images/korean/common/tm_00' + temp + '_on.gif)';
    				//otherObj[i-1].parentNode.getElementsByTagName("ul")[0].style.display="block";
            }
  			}else {
  				if(otherObj[i-1].parentNode.getElementsByTagName("ul")[0].style.display=="block"){
  					fncOff(otherObj[i-1], temp);
  					//otherObj[i-1].style.backgroundImage='url(../files/images/korean/common/tm_00' + temp + '.gif)';
  					//otherObj[i-1].parentNode.getElementsByTagName("ul")[0].style.display="none";
            }
  			}
  		}
		}
}
function fncOn(obj, temp) {
	//obj.style.backgroundImage='url(../files/images/korean/common/tm_00' + temp + '_on.gif)';
	//obj.className = "topmenu topmenu"+temp+"on";
//	document.getElementById("anc"+temp).src = "../files/images/korean/common/tm_00"+temp+"_on.gif";
	if ( document.getElementById("and"+temp) )
	{	
	document.getElementById("anc"+temp+"").style.display="none";
	document.getElementById("anc"+temp+"_on").style.display="inline";	
	obj.parentNode.getElementsByTagName("ul")[0].style.display="block";
	}
}
function fncOff(obj, temp) {
	//obj.style.backgroundImage='url(../files/images/korean/common/tm_00' + temp + '.gif)';
	//obj.className = "topmenu topmenu"+temp+"";	
//	document.getElementById("anc"+temp).src = "../files/images/korean/common/tm_00"+temp+".gif";
	if ( document.getElementById("and"+temp) )
	{	
	document.getElementById("anc"+temp+"_on").style.display="none";
	document.getElementById("anc"+temp+"").style.display="inline";
	obj.parentNode.getElementsByTagName("ul")[0].style.display="none";
	}
}
function windowopen1(ur, wi, pr){
  if(pr) {
    ViewWin=window.open(ur,"", pr);
  } else {

    var SP2 = false;
    var sHeight = 0;
    SP2 = (window.navigator.userAgent.indexOf("SV1") != -1);
    if (SP2)     {   // XP SP2 ë¸Œë¼ìš°ì €ìž"..
      sHeight = 610;
    }else{  //ê·¸ì™¸ ë¸Œë¼ìš°ì €
      sHeight = 600;
    }

    ViewWin=window.open(ur,"", "WIDTH=800,height="+sHeight+",left=50,top=50, toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbar=yes,resizable=yes");
  }
}
function openSub(c_no) {
	var checkId = this.id;
	
	if ( this.id ) {
	} else {
		checkId = c_no;
	}	
	var sub = document.getElementById("sub_"+checkId);		
	if ( sub ) {
		if ( sub.style.display == "block" ) {
			sub.style.display = "none";	
		} else {
			sub.style.display = "block";
		}
	}
}
function subFocus(c_no){
//  alert(parseInt(c_no.substring(9,12),10)-1);
  document.getElementById("sub_"+c_no.substring(0,9)).getElementsByTagName("a")[parseInt(c_no.substring(9,12),10)-1].className = 'menuSelected';
}
function attatchMenu() {
	var leftDiv = document.getElementById("left");
	if ( leftDiv ) {
		var liDiv = leftDiv.getElementsByTagName("ul")[0].getElementsByTagName("li");
		
		if (window.addEventListener) {
			for ( var i = 0; i < liDiv.length; i++ ) {
				liDiv[i].addEventListener("click", openSub, false);
			}
		}
		else if (liDiv[0].attachEvent) {
			for ( var i = 0; i < liDiv.length; i++ ) {		
				if ( liDiv[i].attachEvent ) {
					//liDiv[i].attachEvent("onclick", openSub);
					liDiv[i].onclick = openSub;
				}
			}
		}
	}
}

if (window.addEventListener) {
	window.addEventListener("load", buildsubmenus_horizontal, false);
	window.addEventListener("load", attatchMenu, false);
}
else if (window.attachEvent) {
	window.attachEvent("onload", buildsubmenus_horizontal);
	window.attachEvent("onload", attatchMenu);	
}


