document.write('<script language="javascript" type="text/javascript" src="/website/js/Ajax.js"></script>');


var popup_dw = 374;
var popup_dh = 484;

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];}
}



var count=0;
	function addfile() {
		var now = new Date();
		var s = now.getFullYear().toString()+(now.getMonth()+1).toString()+now.getDate().toString()+now.getHours().toString()+now.getMinutes().toString()+now.getSeconds().toString()+now.getMilliseconds().toString();

		count++;
		var newItem = document.createElement("div");
		newItem.setAttribute("id", "item_" + count);
		var html = "&nbsp;<input type='file' name='"+s+"' id='"+count+"'>"+" <a href='#'  onclick='removeItem(" + count + ")'>»èÁ¦</a>";
		newItem.innerHTML = html;
		document.getElementById("fcount").value=count;
	
		var itemListNode = document.getElementById('filefield');
		itemListNode.appendChild(newItem);
	}

	function removeItem(idCount) {
		var item = document.getElementById("item_"+idCount);
		if (item != null) {
			item.parentNode.removeChild(item);
		}
	}
	
function conTree(vs1){
	var s1 = document.getElementById(vs1).style.display;
	if(s1=='none'){
		document.getElementById(vs1).style.display="";
	}else{
		document.getElementById(vs1).style.display="none";
	}
}

function goBack(){
	history.go(-1);
}

function getCurTime(){
		var now = new Date();
		var s = now.getFullYear().toString()+(now.getMonth()+1).toString()+now.getDate().toString()+now.getHours().toString()+now.getMinutes().toString()+now.getSeconds().toString();
}

function gosubmit(){
	var vs1= document.goform.sname.value;
	var s1= "sname="+vs1;
	new Ajax.xhr.Request("../su/SearchTree.jsp",s1,loadResult,"POST", "sresult", null);
}

function goProcess(vs1, vs2,vs3, vs4, vs5){
	//vs3 º¸³»°íÀÚ ÇÏ´Â URL
	//vs4 º¸³»°íÀÚ ÇÏ´Â div ¾ÆÀÌµð
	var s1= "orno="+vs1+"&seqno="+vs2+"&fileroot="+vs5;
	new Ajax.xhr.Request(vs3,s1,loadResult,"POST", vs4, null);
}



function delFile(vs1, vs2,vs3, vs4, vs5, vs6, vs7){
	//vs1 °Ô½ÃÆÇ ¹øÈ£
	//vs2 °Ô½ÃÆÇ±Û¹øÈ£
	//vs3 ÆÄÀÏ ¹øÈ£
	//vs4 ¾÷·ÎµåµÈ ÆÄÀÏ ÀÌ¸§
	//vs5 ÀÌµ¿ÇÒ URL
	//vs6 µð½ºÇÃ·¹ÀÌ div ¾ÆÀÌµð
	//vs7 Ã·ºÎÆÄÀÏ ·çÆ®
	var s1= "orno="+vs1+"&seqno="+vs2+"&fseqno="+vs3+"&filenm="+vs4+"&fileroot="+vs7;
	new Ajax.xhr.Request(vs5,s1,loadResult,"POST", vs6, null);
}

function loadResult(reResult){
	var resultList = document.getElementById(this.vs6);
	if(reResult.readyState==0){
		resultList.innerHTML ="<div id='resultdiv' ><table width=300 height=100 cellpadding=0 cellspacing=0 border=0 bgcolor=#FFFFFF><tr><td align=center><img src=/img/aload/ajax-loader1.gif></td></tr><tr><td align=center>¿äÃ»¿¡ ´ëÇÑ ÀÀ´äÀ» ±â´Ù¸®°í ÀÖ½À´Ï´Ù.</td></tr></table></div>";
	}else if(reResult.readyState==1){
		resultList.innerHTML ="<div id='resultdiv' ><table width=300 height=100 cellpadding=0 cellspacing=0 border=0 bgcolor=#FFFFFF><tr><td align=center><img src=/img/aload/ajax-loader2.gif></td></tr><tr><td align=center>¿¬»êÀ» ¼öÇàÁßÀÔ´Ï´Ù. Àá½Ã¸¸ ±â´Ù·ÁÁÖ½Ê½Ã¿À<br>ÀÌ ÀÛ¾÷Àº ¼öÃÊ³»Áö ¼ö½ÊÃÊ °É¸± ¼ö ÀÖ½À´Ï´Ù</td></tr></table></div>";
	}else if(reResult.readyState==2){
		resultList.innerHTML ="<div id='resultdiv' ><table width=300 height=100 cellpadding=0 cellspacing=0 border=0 bgcolor=#FFFFFF><tr><td align=center><img src=/img/aload/ajax-loader3.gif></td></tr><tr><td align=center>¿äÃ»¿¡ ´ëÇÑ ÀÀ´äÀ» ¹Þ¾Ò½À´Ï´Ù. ¿¬»êÀ» ¼öÇàÇÕ´Ï´Ù.</td></tr></table></div>";
	}else if(reResult.readyState==3){
		resultList.innerHTML ="<div id='resultdiv' ><table width=300 height=100 cellpadding=0 cellspacing=0 border=0 bgcolor=#FFFFFF><tr><td align=center><img src=/img/aload/ajax-loader3.gif></td></tr><tr><td align=center>¿¬»êÀ» Á¾·áÇÑ ÆäÀÌÁö·Î ºÎÅÍ Á¤º¸¸¦ ¹Þ°í ÀÖ½À´Ï´Ù.<br> Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿À.</td></tr></table></div>";
	}else if(reResult.readyState==4){
		if(reResult.status==200){
			resultList.innerHTML =reResult.responseText;
		}else if(reResult.status==403){
			resultList.innerHTML = "¼­¹ö·Î ºÎÅÍ Á¢±ÙÀ» °ÅºÎ ´çÇÏ¿´½À´Ï´Ù.";
		}else if(reResult.status==404){
			resultList.innerHTML = "¿äÃ»ÇÑ ÆäÀÌÁö°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.";
		}else if(reResult.status==500){
			resultList.innerHTML = "¼­¹ö¿¡ ¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù.";
		}else{
			resultList.innerHTML = "¾Ë ¼ö ¾ø´Â ¿À·ù·Î ÀÛ¾÷À» ÁøÇàÇÒ ¼ö ¾ø½À´Ï´Ù.";
		}
	}else{
		
		
		
		
		
		resultList.innerHTML = "Àá½Ã¸¸ ±â´Ù·Á ÁÖ½Ê½Ã¿À.";
	}
/*	
	var resultdiv = document.getElementById("resultdiv");
	var x = 0 ;
	var y = 0;
	var div_width = 300;	// ·¹ÀÌ¾î °¡·ÎÅ©±â
	var div_height = 100;	// ·¹ÀÌ¾î ¼¼·ÎÅ©±â
	x = (document.body.clientWidth - div_width) / 2;
	y = (document.body.clientHeight - div_height) / 2 ;
	resultdiv.style.top=y+"px";
	resultdiv.style.left=x+"px";	
*/
}


function HTMLDecode(str){
	str = str.replace(/&lt;/gi,"<");
	str = str.replace(/&amp;/gi,"&");
	return str;
}

function fnLoadContents(){
	
	var strContent = HTMLDecode(document.goright["txtaContent"].value);
	var objView = document.getElementById("divView");
	objView.innerHTML = strContent;
	var strBackgroundColor = document.goright["hdnBackgroundColor"].value;
	if("" != strBackgroundColor)
	{
		objView.style.backgroundColor = strBackgroundColor;
	}
	var strBackgroundImage = document.goright["hdnBackgroundImage"].value;
	if("" != strBackgroundImage)
	{
		var strCopyBackgroundImage = strBackgroundImage.toUpperCase();

		if("none" == strCopyBackgroundImage)
		{
			objView.style.backgroundImage = strBackgroundImage;
		}
		else
		{
			objView.style.backgroundImage = "url(" + strBackgroundImage + ")";
		}
	}
	var strBackgroundRepeat = document.goright["hdnBackgroundRepeat"].value;
	if("" != strBackgroundRepeat)
	{
		objView.style.backgroundRepeat = strBackgroundRepeat;
	}
}

function fnLoadContent3(){
	var strContent = HTMLDecode(document.seeform["txtaContent"].value);
	var objView = document.getElementById("divView");
	objView.innerHTML = strContent;
	var strBackgroundColor = document.seeform["hdnBackgroundColor"].value;
	if("" != strBackgroundColor)
	{
		objView.style.backgroundColor = strBackgroundColor;
	}
	var strBackgroundImage = document.seeform["hdnBackgroundImage"].value;
	if("" != strBackgroundImage)
	{
		var strCopyBackgroundImage = strBackgroundImage.toUpperCase();

		if("none" == strCopyBackgroundImage)
		{
			objView.style.backgroundImage = strBackgroundImage;
		}
		else
		{
			objView.style.backgroundImage = "url(" + strBackgroundImage + ")";
		}
	}
	var strBackgroundRepeat = document.seeform["hdnBackgroundRepeat"].value;
	if("" != strBackgroundRepeat)
	{
		objView.style.backgroundRepeat = strBackgroundRepeat;
	}
}

function fnLoadContent4(vs1){
	var fname = eval("document.seeform"+vs1);
	var txtcon ="txtaContent"+vs1;
	var divcon = "divView"+vs1;
	var strContent = HTMLDecode(fname[txtcon].value);
	var objView = document.getElementById(divcon);
	objView.innerHTML = strContent;
	var strBackgroundColor = fname["hdnBackgroundColor"].value;
	if("" != strBackgroundColor)
	{
		objView.style.backgroundColor = strBackgroundColor;
	}
	var strBackgroundImage = fname["hdnBackgroundImage"].value;
	if("" != strBackgroundImage)
	{
		var strCopyBackgroundImage = strBackgroundImage.toUpperCase();

		if("none" == strCopyBackgroundImage)
		{
			objView.style.backgroundImage = strBackgroundImage;
		}
		else
		{
			objView.style.backgroundImage = "url(" + strBackgroundImage + ")";
		}
	}
	var strBackgroundRepeat = fname["hdnBackgroundRepeat"].value;
	if("" != strBackgroundRepeat)
	{
		objView.style.backgroundRepeat = strBackgroundRepeat;
	}
}

function fnLoadContent(){
	var strContent = HTMLDecode(document.goform["txtaContent"].value);
	var objView = document.getElementById("divView");
	objView.innerHTML = strContent;
	var strBackgroundColor = document.goform["hdnBackgroundColor"].value;
	if("" != strBackgroundColor)
	{
		objView.style.backgroundColor = strBackgroundColor;
	}
	var strBackgroundImage = document.goform["hdnBackgroundImage"].value;
	if("" != strBackgroundImage)
	{
		var strCopyBackgroundImage = strBackgroundImage.toUpperCase();

		if("none" == strCopyBackgroundImage)
		{
			objView.style.backgroundImage = strBackgroundImage;
		}
		else
		{
			objView.style.backgroundImage = "url(" + strBackgroundImage + ")";
		}
	}
	var strBackgroundRepeat = document.goform["hdnBackgroundRepeat"].value;
	if("" != strBackgroundRepeat)
	{
		objView.style.backgroundRepeat = strBackgroundRepeat;
	}
}

function fnLoadContent2(){
	var strContent = HTMLDecode(document.frmView["txtaContent"].value);
	var objView = document.getElementById("divView");
	objView.innerHTML = strContent;
	var strBackgroundColor = document.frmView["hdnBackgroundColor"].value;
	if("" != strBackgroundColor)
	{
		objView.style.backgroundColor = strBackgroundColor;
	}
	var strBackgroundImage = document.frmView["hdnBackgroundImage"].value;
	if("" != strBackgroundImage)
	{
		var strCopyBackgroundImage = strBackgroundImage.toUpperCase();

		if("none" == strCopyBackgroundImage)
		{
			objView.style.backgroundImage = strBackgroundImage;
		}
		else
		{
			objView.style.backgroundImage = "url(" + strBackgroundImage + ")";
		}
	}
	var strBackgroundRepeat = document.frmView["hdnBackgroundRepeat"].value;
	if("" != strBackgroundRepeat)
	{
		objView.style.backgroundRepeat = strBackgroundRepeat;
	}
}



function tryBodyCon(){
	var usid =document.lgform.usid.value;
	var passwd = document.lgform.passwd.value;
	if(usid==null||usid.length<1){
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À");
		document.lgform.id.focus();
	}else if(passwd==null||passwd.length<1){
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿À");
		document.lgform.passwd.focus();
	}else{
		var s1= "usid="+usid+"&passwd="+passwd;
		new Ajax.xhr.Request("../include/BodyLogIn.jsp",s1,loadResult,"POST", "PopupLayerSet", null);
	}
}

function goMain(){
//	document.location.reload();
	document.location.href="../index.jsp";
}

function goIndex(){
	document.location.href="../index.jsp";
}

function goRefresh(){
	document.location.reload();
}

function bodylogout(){
	PopupLayerSet2();
	tryBodyLogOut();
}

function tryBodyLogOut(){
		document.getElementById("PopupLayer").innerHTML="Ã³¸®ÁßÀÔ´Ï´Ù.";
		new Ajax.xhr.Request("../include/BodyLogOut.jsp",null,loadResult,"POST", "PopupLayer", null);
}

function flashload(flsName,flsWidth,flsHeigt){
	var wirtTxt = " <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="+flsWidth+" height="+flsHeigt+" id=\"sub_menu_2\" align=\"middle\">"
				+ " <param name=\"movie\" value="+flsName+" /> "
				+ " <param name=\"allowScriptAccess\" value=\"always\" /> "
				+ " <param name=\"quality\" value=\"high\" />"
				+ " <PARAM NAME=\"wmode\" VALUE=\"transparent\">"
				+ " <embed src="+flsName+" quality=\"high\" bgcolor=\"#ffffff\" width="+flsWidth+" height="+flsHeigt+" name=\"sub_menu_2\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" allowScriptAccess=\"always\"/>"
				+ " </object>"
	document.write(wirtTxt);
}

function loadResultStat(reResult){
	var resultList = document.getElementById(this.vs6);
	if(reResult.readyState==4){
		if(reResult.status==200){
			resultList.innerHTML =reResult.responseText;
		}else if(reResult.status==403){
			resultList.innerHTML = "¼­¹ö·Î ºÎÅÍ Á¢±ÙÀ» °ÅºÎ ´çÇÏ¿´½À´Ï´Ù.";
		}else if(reResult.status==404){
			resultList.innerHTML = "¿äÃ»ÇÑ ÆäÀÌÁö°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.";
		}else if(reResult.status==500){
			resultList.innerHTML = "¼­¹ö¿¡ ¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù.";
		}else{
			resultList.innerHTML = "¾Ë ¼ö ¾ø´Â ¿À·ù·Î ÀÛ¾÷À» ÁøÇàÇÒ ¼ö ¾ø½À´Ï´Ù.";
		}
	}
}

function goSubMain(vs1, vs2, vs3, vs4){
	document.goform.scode.value=vs1;
	document.goform.ucode.value=vs2;
	document.goform.dcode.value=vs3;
	document.goform.callsign.value=vs4;
	document.goform.submit();
}

function PopupLayerSet2(){ // ·¹ÀÌ¾î ÆË¾÷
	var DivPop = document.getElementById("PopupLayer")
	DivPop.style.display = "block" ;

//	sw=document.body.scrollWidth ;
//	sh=document.body.scrollHeight ;

	sw=document.body.clientWidth ;
	sh=document.body.clientHeight ;
	var div_left = (sw-popup_dw)/2 ;
	var div_top = (sh-popup_dh)/2 ;
	DivPop.style.left = div_left ;
	DivPop.style.top = div_top ;
}

function Content(){
	 var DivPop = document.getElementById("PopupLayer");
	 var DivPopSet = document.getElementById("PopupLayerSet");
		DivPop.style.display = "block" ;

	sw=document.body.clientWidth ;
	sh=document.body.clientHeight ;

	var div_left = (sw-popup_dw)/2 ;
	var div_top = (sh-popup_dh)/2 ;
	DivPopSet.style.left = div_left ;
	DivPopSet.style.top = div_top ;
}

function ContentClose(){
	 var a = eval("document.all.PopupLayer");
  a.style.display = "none";
  tg.innerHTML = "";
}

function goPrePage(vs1){
		document.location.href=vs1;
}

function getPop(vs1,vs2,vs3, vs4) {
	alert(vs1);
	//open(vs1,vs2,"toolbar=no,status=no,width="+vs3+",height="+vs4+",directories=no,scrollbars=no,location=no,resizable=no,menubar=no");
}

function openPop1(vs1,vs2,vs3, vs4) {
	open(vs1,vs2,"toolbar=no,status=no,width="+vs3+",height="+vs4+",directories=no,scrollbars=no,location=no,resizable=no,menubar=no");
}

//½ºÅ©·ÑÀÖ´Â°Í
function openPop2(vs1,vs2,vs3, vs4) {
	open(vs1,vs2,"toolbar=no,status=no,width="+vs3+",height="+vs4+",directories=no,scrollbars=1,location=no,resizable=yes,menubar=no");
}

function openPop3(vs1,vs2,vs3, vs4) {
	open(vs1,vs2,"toolbar=no,status=no,width="+vs3+",height="+vs4+",directories=no,scrollbars=1,scrolls=auto,location=no,resizable=yes,menubar=no");
}

function openPop4(vs1,vs2,vs3, vs4) {
	open(vs1,vs2,"toolbar=no,status=no,width="+vs3+",height="+vs4+",directories=no,scrollbars=1,scrolls=auto,location=no,resizable=no,menubar=no");
}

function openPop5(vs1,vs2,vs3, vs4, vs5) {
	open(vs1+"?"+vs5,vs2,"toolbar=no,status=no,width="+vs3+",height="+vs4+",directories=no,scrollbars=no,location=no,resizable=no,menubar=no");
}

function openSub(vs1,vs2){
	var s1= "scode="+vs1+"&ucode="+vs2;
	new Ajax.xhr.Request("../in/SubMenu.jsp",s1,loadResult,"POST", "SubDiv", null);
	OpenSubPop(document.getElementById("SubDiv"),'submenu');
}

function closeSub(){
	document.getElementById("SubDiv").style.display="none"
}

function OpenSubPop(str,c_name){ // ·¹ÀÌ¾î ÆË¾÷
	var SubPop=document.getElementById("SubDiv");
		tempX = event.clientX + document.body.scrollLeft; //Ä¿¼­ x ÁÂÇ¥
		tempY = event.clientY + document.body.scrollTop; //Ä¿¼­ y ÁÂÇ¥
		SubPop.style.display = "block" ;
		SubPop.style.left = tempX+10 ;
		SubPop.style.top = tempY-15 ;
}

function viewebook(url){
	xlocation = (screen.width-1000)/2
	ylocation = ( screen.height-700)/2
	if( url != ""){
		W_EBOOK = window.open ( url , "ebook" ,   "width='1000' , height='700', left="+xlocation+",top="+ylocation+", resizable=1 , scrollbars=1");
		W_EBOOK.focus();
	}
	
}

function exceldown(vs1, vs2, vs3){
	var urlstring ="../include/ExcelDown.jsp?scode="+vs1+"&ucode="+vs2+"&callsign="+vs3;
	open(urlstring,"exceldown","toolbar=no,status=no,width=700,height=300,directories=no,scrollbars=no,location=no,resizable=yes,menubar=no");
}

function loadcomplete(){
}

function goScrap(vs1, vs2, vs3){
	//vs1 - maincode, vs2 - menucode , vs3-¸Å°³º¯¼ö
	if(vs1<4){
		furl = "scode="+vs3;
	}else if(vs1==7||vs1==8){ // ¿Ö ÀÌ·¸°Ô Â®³Ä°í µûÁöÁö ¸¶¶ó ÇÁ·ÎÁ§Æ® ¸»¹Ì¿¡ Ãß°¡µÈ ¸Þ´º´Ù.
		furl = "scode="+vs3;
	}else{
		furl = "seqno="+vs3;
	}
	openPop1('../include/myscrap.jsp?maincode='+vs1+'&menucode='+vs2+"&vstring="+furl,'smartrss','500','250');
}

function goPrint(vs1, vs2, vs3, vs4){
	//vs1 - maincode, vs2 - menucode , vs3-¸Å°³º¯¼ö
	if(vs1<4){
		furl = "scode="+vs3;
	}else{
		furl = "seqno="+vs3;
	}
	openPop2('../include/MPrint.jsp?maincode='+vs1+'&menucode='+vs2+"&vstring="+furl+"&prtoption="+vs4,'printpage','800','700');
}

function HTML_DOWN(){
	ob = document.getElementById("HTMLVIEW")
	obj = document.form_print;
	obj.htmldown.value =  ob.innerHTML;
	obj.action = "../include/htmldownload.jsp";
	obj.submit();
}

/** ÁÜÀÎ, ÁÜ¾Æ¿ô *************************************************************/
var nowZoom = 100;
var maxZoom = 200;
var minZoom = 80;
function zoomIn() {
	if (nowZoom < maxZoom) {
		nowZoom += 10;
	} else {
		return;
	}
	document.body.style.zoom = nowZoom + "%";
}
function zoomOut() {
	if (nowZoom > minZoom) {
		nowZoom -= 10;
	} else {
		return;
	}
	document.body.style.zoom = nowZoom + "%";
}

function zoomreset(){
	nowZoom = 100;
	document.body.style.zoom = nowZoom + "%";
}
