document.write('<script type="text/javascript" src="/javascript/mm_aspect.js" language="javascript"><\/script>');

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; }
}

function MM_showHideLayersEx() {
	var i,p,v,obj,args=MM_showHideLayersEx.arguments;
	for (i=0; i<(args.length-4); i+=5) 
	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;
		obj.left=args[i+3];
		obj.top=args[i+4];
	}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
	//	일본법령번역서비스 실행
	if( selObj.selectedIndex == 2 )
	{
		showPop('/jsp/popup/janlaw.jsp', '500', '280');
	}
	else
	{
		eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");	 
	}
	if (restore) selObj.selectedIndex=0;
}
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_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_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 MM_callJS(jsStr) { //v2.0
	  return eval(jsStr);
}
function showPop(url, width, height)
{
	//var property = 'width=' + width + ', height=' + height + ',status=no,menubar=no,scrollbars=no';
	//window.open(url,'popup',property);
	var property = 'width=' + width + ', height=' + height + ',status=no,menubar=no,scrollbars=no';
	var sprtc = window.location['protocol'];
	var sslUrl = '';
	if( sprtc == 'http:'){
		window.open(url,'popup',property);
	}else {
		sslUrl = "https://www.klri.re.kr"+url;
		window.open(sslUrl,'popup',property);
	}
}
function addActiveX() {
	var objCode1 = new String;
	var objCode2 = new String;
	var appParam = new String;
	var showObjCode = new String;
	this.init = function(objName, clsid, s, w, h) {
		if(objName == '') {
			objCode1 = "<OBJECT CLASSID='CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000' CODEBASE='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" + w + "' height='"+ h +"'>";
			objCode2 = "<EMBED src='"+s+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' menu='false' wmode='transparent' allowScriptAccess='always' type='application/x-shockwave-flash' width='"+w+"' height='"+h+"'></EMBED></OBJECT>";
			this.parameter('movie',s);
            this.parameter('quality','high');
            this.parameter('allowScriptAccess','always');
		} else {
			objCode1 = "<OBJECT ID='"+objName+"' CLASSID='CLSID:"+clsid+"' ";
			if (s != '') {
				objCode1 += "CODEBASE='"+s+"' ";
			}
			objCode1 += "width='"+w+"' height='"+h+"'>\n";
			objCode2 = "</OBJECT>";
		}
	};
	this.parameter = function(p, v) {
		appParam += "<PARAM NAME='"+ p +"' VALUE='"+ v +"'>\n";
	};
	this.show = function() {
		showObjCode = objCode1 + appParam + objCode2;
		document.write (showObjCode);
	};
}

function doComLogin()
{
	document.location.href="/kor/member/korLogin.do";
}

function doComMap()
{
	document.location.href="/kor/introduction/klriMap.do";
}

function doComLogout()
{
	if(confirm("로그아웃 하시겟습니까?")){
		document.location.href="/kor/member/korLogout.do";        
    }   	
}

function doComMemJoin()
{
	document.location.href="/kor/member/korMemberJoin.do";
}

function doComSiteMap()
{
	document.location.href="/kor/member/korMemberSiteMap.do";
}

function doComEnglishSite()
{
	document.location.href="/eng/category/greetings.do";
}

function doComKidSite()
{
	document.location.href="/jsp/kids/intro.jsp";
}

function file_add(add_size)                                                 //##$$##
{
    var temp ='';
    for(i=2;i<=add_size;i++){
        temp = temp + '#' + i + ' : ' + '<input type="file" name=file'+i+' size="60" class="input_01" style="margin-top: 3px; margin-bottom: 5px;"><br>';
    }
    document.getElementById("file_add_form").innerHTML = temp;
}

function goMemberQnaList(id)
{
	if(id == '' || id == null)
	{
		alert("마이페이지의 묻고답하기는  로그인 후에 사용가능합니다.");
	}
	else
	{		
		document.location.href = "/kor/member/korMemberQna.do?id=" + id;
	}
}

function goMemberFitPrpList(id)
{
	if(id == '' || id == null)
	{
		alert("마이페이지의 맞춤형 외국법제는  로그인 후에 사용가능합니다.");
	}
	else
	{		
		document.location.href = "/kor/member/korMemberFitPrpList.do?member_id=" + id;
	}
}

function goClean()
{
	document.location.href = "/kor/communication/comClean.do";
}

function goMemberMile(id)
{
	if(id == '' || id == null)
	{
		alert("마이페이지의 마일리지는 로그인 후에 사용가능합니다.");
	}
	else
	{		
		document.location.href = "/kor/member/korMemberMileList.do?member_id=" + id;
	}
}

function goEbook(id, filename, gubun)
{	
	if(id == '' || id == null)
	{
		alert("e-Book 보기는  로그인 후에 사용가능합니다.");
	}
	else
	{	
		
		var ext = filename.substring(filename.length - 3);
		if(ext != 'pdf') {
			alert("PDF 파일이 아닌 문서는 e-Book 보기를 하실수 없습니다.");
			return;
		}
		
		var path = "/uploadfile/" + gubun + "/" + filename;
		url = "/jsp/popup/ebookview.jsp?filepath=" + encodeURI(path);
		showPop(url, '1012', '730');		
	}
}

function downloadMng(gubun, filename, id) {
	var path = "/uploadfile/" + gubun + "/" + filename;
	document.location.href="/download/uploadfile_download.do?path=" + encodeURIComponent(path);
}

function download(gubun, filename, id) 
{
	//if (gubun == 'AK02' || gubun == 'AK03' || gubun == 'AK04' || gubun == 'AK17')
	//{
	//	var path = "/uploadfile/" + gubun + "/" + filename;
	//	document.location.href="/download/uploadfile_download.do?path=" + encodeURIComponent(path);
	//}
	//else 
	//{
	//	if(id == '' || id == null)
	//	{
	//		alert("파일 다운로드는 로그인 후 이용가능합니다.");
	//	}
	//	else
	//	{			
	//		var path = "/uploadfile/" + gubun + "/" + filename;
	//		document.location.href="/download/uploadfile_download.do?path=" + encodeURIComponent(path);
	//	}
	//}
	if (gubun == 'FP01' || gubun == 'FP02')
	{
		if(id == '' || id == null)
		{
			alert("파일 다운로드는 로그인 후 이용가능합니다.");
		}
		else
		{			
			var path = "/uploadfile/" + gubun + "/" + filename;
			document.location.href="/download/uploadfile_download.do?path=" + encodeURIComponent(path);
		}
	}
	else
	{
		var path = "/uploadfile/" + gubun + "/" + filename;
		document.location.href="/download/uploadfile_download.do?path=" + encodeURIComponent(path);
	}
}

/*
* 	ReplaceAll strString의 strChar값을 제거한값을 리턴한다.
*/
function replaceAll(strString, strChar){ 
	var strTmp = ""; 
	for(var i = 0; i < strString.length; i++){ 
		if(strString.charAt(i)!= strChar){
			strTmp = strTmp + strString.charAt(i); 
		}
	} 
	return strTmp; 
} 