/* 이미지 확대 */
function chImg(img) {
	imgName = img.src;
	if( imgName.indexOf("on.") > -1 ) {
		var re = /on\./g;
		img.src = imgName.replace(re,"off.");
	} else {
		var re = /off\./g;
		img.src = imgName.replace(re,"on.");
	}
}


/* image enlarge */
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

/* popup open */
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/*floating layer*/
/* 퀵 메뉴 */
	// 메뉴가 증가할 높이 
    var menu_height = 0;
    // 메뉴 높이
	var top_height=185;	
	// 예전 높이;
	var old_height = 185;
	// 새높이;
	var new_height = 195;
	// 딜레이 
	var scroll_delay = 20;
    // 스타트 체크 
    var scroll_start = 0;
	function sub_scroll_menu(){	
		
        if( scroll_start == 0 ) {
            scroll_start = 1
            document.getElementById('leftmenu_scroll').style.top = '110px';
        }
        if(document.documentElement.scrollTop < top_height){
			new_height = top_height;
		}else{
			new_height = document.documentElement.scrollTop + 10;		
		}
		var height_increment = (new_height - old_height)/10;		
		
		if( parseInt(new_height/10) != old_height/10){			
			if(new_height > old_height){	
				if(height_increment < 1){
					height_increment = 1;
				}
				var re = /px/g;
				old_height = (document.getElementById('leftmenu_scroll').style.top).replace(re,"");
				old_height = parseInt(old_height) + height_increment;
				if(new_height < old_height){
					old_height = new_height;
				}
				document.getElementById('leftmenu_scroll').style.top = old_height + 'px';
						
			}else{
				if(height_increment > -1){
					height_increment = -1;
				}
				var re = /px/g;
				old_height = (document.getElementById('leftmenu_scroll').style.top).replace(re,"");				
				old_height = parseInt(old_height) + height_increment;
				if(new_height > old_height){
					old_height = new_height;
				}
				document.getElementById('leftmenu_scroll').style.top = old_height + 'px';
			}			
		}	
		setTimeout ("sub_scroll_menu()", scroll_delay);

		//document.getElementById('quick_menu').style.top = document.documentElement.scrollTop + top_height + 'px';
	} 	
	
/**
 * top display
 */

function displaySubMenu(id_name,targer_menu_seq,total) {
    var target_menu = id_name+targer_menu_seq;
    for(i=1 ; i<=total ; i++) {
		if (document.getElementById(id_name + i)) {
			document.getElementById(id_name + i).style.display = "none";
		}
    }
	if (document.getElementById(target_menu)) {
		document.getElementById(target_menu).style.display = "block";
	}
}

function change_subMenuImage(id_name,targer_menu_seq,total) {
    var target_menu = id_name+targer_menu_seq;
    for(i=1 ; i<=total ; i++) {
        var re = /on\./g;
        imgName = document.getElementById(id_name+i).src;
        document.getElementById(id_name+i).src = imgName.replace(re,"off.");
    }
    imgName = document.getElementById(target_menu).src;
    var re = /off\./g;
	document.getElementById(target_menu).src = imgName.replace(re,"on.");
}
