/* ���� �޴� ���� */
function displaySub(id) {
	for(i=1 ; i<=5 ; i++) {
		document.getElementById("subnavlist"+i).style.display="none";
	}
	document.getElementById(id).style.display="block";
}

/* �޴� ���÷��� */
function displaySubMenu(id_name,targer_menu_seq,total) {
    var target_menu = id_name+targer_menu_seq;
    for(i=1 ; i<=total ; i++) {
        document.getElementById(id_name+i).style.display="none";
    }
    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.");
}

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.");
	}
}

function chImgById(imgId) {
	imgName = document.getElementById(imgId).src;
	if( imgName.indexOf("on.") > -1 ) {
		var re = /on\./g;
		document.getElementById(imgId).src = imgName.replace(re,"off.");
	} else {
		var re = /off\./g;
		document.getElementById(imgId).src = imgName.replace(re,"on.");
	}
}

/* ���� �޴� �� */


// div popup
function prdLyrView(lid,n,total) {
    var ht = document.body.clientHeight; // if DTD is xhtml, document.documentElement.clientHeight;
    var target = document.getElementById(lid+n);

    if (total != 0)    {
        for (var i=1; i<=total; i++) {
            document.getElementById(lid+i).style.display = (i==n ? 'block':'none');
        }
    } else {
        target.style.display = 'none';
    }
}
function preViewS(lid,n,total) {
	var wt = document.body.clientWidth; // if DTD is xhtml, document.documentElement.clientWidth; 
	var ht = document.body.clientHeight; // if DTD is xhtml, document.documentElement.clientHeight;
	var target = document.getElementById(lid+n);

	for (var i=1; i<=total; i++) {
		document.getElementById(lid+i).style.display = (i==n ? 'block':'none');
	}
	target.style.left = wt/2 - target.offsetWidth/2 + "px";
	target.style.top = ht/2 - target.offsetHeight/2 + "px";
}




/********* ����Ʈ�� *********/

<!--
function fdiv(f_no) {
    var fdiv_no = "d" + f_no;

    //if (f_no.length != 1) {
    //  window.document.all[f_no].style.visibility = "visible";
    //}
    //else
    //  window.document.all[fdiv_no].style.visibility = "visible";

    for(i=1;i<28;i++)
    {
    var fdiv_no = "d" + i;
        if(i==f_no)
        {
        window.document.all[fdiv_no].style.visibility = "visible";
        }
        else
        {
        window.document.all[fdiv_no].style.visibility = "hidden";
        }
    }
}

function hdiv(h_no) {
    var hdiv_no = "d0" + h_no;
    
    if (h_no.length != 1) {
        window.document.all[h_no].style.visibility = "hidden";
    }
    else
        window.document.all[hdiv_no].style.visibility = "hidden";
}
//-->



/********* �÷��� *********/
function showFlash(flaFile, widths, heights, btrans) { 

  var strings = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="' + widths + '"  height="' + heights + '"><param name="movie" value="' + flaFile + '"> <param name="quality" value="high"> '; 

  if (btrans == 'y') { 
    strings += '<param name="wmode" value="transparent">'; 
  } 

  strings += '<embed src="' + flaFile + '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + widths + '" height="' + heights + '"> </embed> </object>'; 

  document.write(strings); 

  return; 
} 
/********* �÷��� *********/


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function view_hide_menu(div_name) {
	if(document.getElementById(div_name) != null) {
		var status = document.getElementById(div_name).style.display;
		if(status=="none") {
			document.getElementById(div_name).style.display="block";
		} else {
			document.getElementById(div_name).style.display="none";
		}
	}
}


//------- �˾� ���� �Լ� (pos=="random" - ��ġ�� ���Ƿ�, pos=="center" - ��� ��ġ, pos=="" - �Ϲ�) -------------------//
var win=null;
function open_win_center(url,name,w,h,scroll,pos) { // (���,�̸�,����,����,��ũ������,��ġ)
	if (pos=='random') {
		LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100;
		TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100;
	}
	if (pos=='center') {
		LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100;
		TopPosition = (screen.height) ? (screen.height - h - 100) / 2 : 100;
	} else if ( (pos != 'center' && pos != 'random') || pos == null) {
		LeftPosition=0; TopPosition=0;
	}
	var settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll +
						',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win = window.open(url,name,settings);
	if (win.focus) win.focus();
}
//----------------------- ��â ����(��ũ�ѹ� ��) ----------------------------
function Win_scroll(theURL,wide,high) {
	var window_left = (screen.width-640)/2;
	var window_top = (screen.height-480)/2;
	window.open(theURL,"Newwin",'width='+wide+',height='+high+',scrollbars=yes,resizable=no,top=' + window_top + ',left=' + window_left + '');
}

//----------------------- (��ũ�ѹ� ��) ----------------------------
function Win_scroll2(theURL) {
	location.href=theURL;
}

//----------------------- ��â ����(��ũ�ѹ� ��) ----------------------------
function Win_mu(theURL,wide,high) {
	var window_left = (screen.width-640)/2;
	var window_top = (screen.height-480)/2;
	window.open(theURL,"Newwin",'width='+wide+',height='+high+',scrollbars=no,resizable=no,top=' + window_top + ',left=' + window_left + '');
}

//----------------------- ��â ����(��ũ�ѹ� ��) ----------------------------
function Win_Date(theURL,wide,high) {
	var window_left = (screen.width-740)/2;
	var window_top = (screen.height-580)/2;
	window.open(theURL,"DateT",'width='+wide+',height='+high+',scrollbars=no,resizable=no,top=' + window_top + ',left=' + window_left + '');
}

//----------------------- ȭ��Ȯ����� ----------------------------
	var nowZoom = 100; // �������
	var maxZoom = 200; // �ִ����
	var minZoom = 80; // �ּҺ���(����� ���ƾ� ��)

	// +, - Ű�� �Է��ϸ� ȭ�� Ȯ��, ��Ҹ� �Ѵ�.
	document.onkeypress = getKey;

	function getKey(keyStroke) {
		isNetscape = (document.layers);
		eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
		which = String.fromCharCode(eventChooser).toLowerCase();
		which2 = eventChooser;

		var el = event.srcElement;

		if ((el.tagName != "INPUT") && (el.tagName != "TEXTAREA")) {
			if (which == "+") {
				zoomIn();
			} else if (which == "-") {
				zoomOut();
			}
		}
	}

        //ȭ�� Ű���.
	function zoomIn() {
		if (nowZoom < maxZoom) {
			nowZoom += 15; // 25%�� Ŀ���.
		} else {
			return;
		}

		document.body.style.zoom = nowZoom + "%";
	}
	
	//ȭ�� ���δ�.
	function zoomOut() {
		if (nowZoom > minZoom) {
			nowZoom -= 15; // 25%�� �۾����.
		} else {
			return;
		}

		document.body.style.zoom = nowZoom + "%";
	}





function menu_init() {
	var div = document.getElementById("curr_menu").innerHTML;
	var arrDiv = div.split("|");
	if(arrDiv.length > 1 && arrDiv[1] != "") {
		view_hide_menu("sub_"+arrDiv[0]);
        view_hide_menu("sub1_"+arrDiv[0]);
		document.getElementById("image"+arrDiv[0]).src=arrDiv[1];
	} else {
		view_hide_menu("sub_"+arrDiv[0]);
        view_hide_menu("sub1_"+arrDiv[0]);
	}
}




//----------------------- ��޴� ----------------------------

	// �޴��� ������ ���� 
    var menu_height = 0;
    // �޴� ����
	var top_height=98;	
	// ���� ����;
	var old_height = 98;
	// ������;
	var new_height = 98;
	// ������ 
	var scroll_delay = 20;
    // ��ŸƮ üũ 
    var scroll_start = 0;
	function scroll_menu(){	
		
        if( scroll_start == 0 ) {
            scroll_start = 1
            document.getElementById('quick_menu').style.top = '98px';
        }
        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('quick_menu').style.top).replace(re,"");
				old_height = parseInt(old_height) + height_increment;
				if(new_height < old_height){
					old_height = new_height;
				}
				document.getElementById('quick_menu').style.top = old_height + 'px';
						
			}else{
				if(height_increment > -1){
					height_increment = -1;
				}
				var re = /px/g;
				old_height = (document.getElementById('quick_menu').style.top).replace(re,"");				
				old_height = parseInt(old_height) + height_increment;
				if(new_height > old_height){
					old_height = new_height;
				}
				document.getElementById('quick_menu').style.top = old_height + 'px';
			}			
		}	
		setTimeout ("scroll_menu()", scroll_delay);

		//document.getElementById('quick_menu').style.top = document.documentElement.scrollTop + top_height + 'px';
	} 	

	var clear="/en/resource/images/common/clear.gif" //path to clear.gif

		pngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}}
		window.attachEvent('onload',pngfix);