/*****************************************
// ¿À´Ã ÇÏ·ç Ã¢ ¿­Áö ¾Ê±â
*****************************************/

function setCookie (name, value, expires) {
	document.cookie=name + "=" + escape(value) + "; path=/; expires=" + expires.toGMTString();		
}
	
function Seeting(form) {
	var expdate = new Date();
	expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 1);
	if(form.noticeOpen.checked) {
		setCookie('notice', "done", expdate);
	}
	window.close();
}

// ÄíÅ°¼³Á¤(¿À´Ã ÇÏ·ç Ã¢ ¾Èº¸±â)
function getCookie(Name) { 
	var search = Name + "=";
	if(document.cookie.length > 0) {
		offset=document.cookie.indexOf(search)
		if(offset != -1) {
			offset += search.length
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset)
			
			if(end == -1)
				end = document.cookie.length
			return unescape(document.cookie.substring(offset, end))
		}
	}
}
			
// °øÁöÆË¾÷Ã¢ ¶ç¿ì±â
function openNotice() {
	if(getCookie("notice") != "done") {
		window.open("/0612/popup/popNotice.jsp", "notice", "width=605,height=650,toolbar=no,scrollbars=no,resizable=no");
	}
}

	
/*****************************************
// ¸ÞÀÎ ÆäÀÌÁö Ä«·»´õ
*****************************************/

function send(theURL)
{ 
	window.open(theURL,'send','scrollbars=yes,width=620,height=510');
}

var url;
function openwin(url) {
	var cal = window.open(url,"cal","width=400,height=300,scrollbars=yes,resizable=no");
 	if ( cal.focus )
    	cal.focus();
}

function winopen(a,b) {
	popfileurl=b+a;
	window.open(popfileurl,'remote','scrollbars=yes,resizable=yes,width=750,height=700,left=200,top=100');      	
}



function roundTable(objID) {
	var obj = document.getElementById(objID);
	var Parent, objTmp, Table, TBody, TR, TD;
	var bdcolor, bgcolor, Space;
	var trIDX, tdIDX, MAX;
	var styleWidth, styleHeight;

	// get parent node
	Parent = obj.parentNode;
	objTmp = document.createElement('SPAN');
	Parent.insertBefore(objTmp, obj);
	Parent.removeChild(obj);

	// get attribute
	bdcolor = obj.getAttribute('rborder');
	bgcolor = obj.getAttribute('rbgcolor');
	radius = parseInt(obj.getAttribute('radius'));
	if (radius == null || radius < 1) radius = 1;
	else if (radius > 6) radius = 6;

	MAX = radius * 2 + 1;

	/*
		create table {{
	*/
	Table = document.createElement('TABLE');
	TBody = document.createElement('TBODY');

	Table.cellSpacing = 0;
	Table.cellPadding = 0;

	for (trIDX=0; trIDX < MAX; trIDX++) {
		TR = document.createElement('TR');
		Space = Math.abs(trIDX - parseInt(radius));
		for (tdIDX=0; tdIDX < MAX; tdIDX++) {
			TD = document.createElement('TD');

			styleWidth = '1px'; styleHeight = '1px';
			if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
			else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
			else if (radius > 2) {
				if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
				if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
			}

			if (styleWidth != null) TD.style.width = styleWidth;
			if (styleHeight != null) TD.style.height = styleHeight;

			if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
			else if (tdIDX > Space && Space < MAX - tdIDX - 1) TD.style.backgroundColor = bgcolor;

			if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
			TR.appendChild(TD);
		}
		TBody.appendChild(TR);
	}

	/*
	}}
	*/

	Table.appendChild(TBody);

	// insert table and remove original table
	Parent.insertBefore(Table, objTmp);
}

var IE = false ;
if (window.navigator.appName.indexOf("Explorer") !=-1)
{
	IE = true;
}
function roundTableNew(targetObjID, roundType)
{
	var attrsRound1 = getSytleAttributes("round1");
	var attrsRound2 = getSytleAttributes("round2");
	//var attrsRound3 = getSytleAttributes("round3");
	//var attrsRound4 = getSytleAttributes("round4");
	var attrsRound5 = getSytleAttributes("round5");

	var rborder1 = '';	// round1ÀÇ rborder»ö.
	var rbgcolor1 = '';	// round1ÀÇ rbgcolor»ö.
	var rborder2 = '';	// round2ÀÇ rborder»ö.
	var rbgcolor2 = '';	// round2ÀÇ rbgcolor»ö.
	var rborder5 = '';	// round5ÀÇ rborder»ö.
	var rbgcolor5 = '';	// round5ÀÇ rbgcolor»ö.

	if(attrsRound1!=null && attrsRound2)
	{
		rborder1 = attrsRound1[1];	// round1ÀÇ rborder»ö.
		rbgcolor1 = attrsRound1[2];	// round1ÀÇ rbgcolor»ö.
		rborder2 = attrsRound2[1];	// round2ÀÇ rborder»ö.
		rbgcolor2 = attrsRound2[2];	// round2ÀÇ rbgcolor»ö.
		rborder5 = attrsRound5[1];	// round5ÀÇ rborder»ö.
		rbgcolor5 = attrsRound5[2];	// round5ÀÇ rbgcolor»ö.
	}else{
		rborder1 = "#FFFFFF";	// round1ÀÇ rborder»ö.
		rbgcolor1 = "#FFFFFF";	// round1ÀÇ rbgcolor»ö.
		rborder2 = "#FFFFFF";	// round2ÀÇ rborder»ö.
		rbgcolor2 = "#FFFFFF";	// round2ÀÇ rbgcolor»ö.
		rborder5 = "#FFFFFF";	// round5ÀÇ rborder»ö.
		rbgcolor5 = "#FFFFFF";	// round5ÀÇ rbgcolor»ö.
	}

	var obj = null;

	if(roundType!=null && 
		(roundType=='round1'||roundType=='round2'||roundType=='round3'||roundType=='round4'))
	{
		obj = document.getElementById(targetObjID);
		roundTableNewSub(obj, rborder1, rborder2, rbgcolor2);
	}else{
		obj = document.getElementById(targetObjID);
		roundTableNewSub(obj, rborder5, rbgcolor5, rbgcolor5);
	}
}

function roundTableNewSub(objDiv, rgb1, rgb2, rgb3)
{
	//alert("objDiv.style.width="+objDiv.style.width+", rbg1="+rbg1+", rbg2="+rbg2+", rbg3="+rbg3);
	var objDivWidth = parseInt(objDiv.style.width);
	var objDivHTML = objDiv.innerHTML;

	var roundBox = "";
	roundBox += "<table width="+objDivWidth+"border=0 cellpadding=0 cellspacing=0><tr><td valign=top align=center>";
	roundBox += "";
	roundBox += "	<table border=0 cellpadding=0 cellspacing=0 height=1>";
	roundBox += "	<tr><td width=2></td><td width="+(objDivWidth-4)+" bgcolor="+rgb1+"></td><td width=2></td></tr></table>";
	roundBox += "";
	roundBox += "	<table border=0 cellpadding=0 cellspacing=0 height=1>";
	roundBox += "	<tr><td width=1></td><td width="+(objDivWidth-2)+" bgcolor="+rgb1+"></td><td width=1></td></tr></table>";
	roundBox += "";
	roundBox += "	<table border=0 cellpadding=0 cellspacing=0 height=1>";
	roundBox += "	<tr><td width="+(objDivWidth-0)+" bgcolor="+rgb1+"></td></tr></table>";
	roundBox += "";
	roundBox += "	<table border=0 cellpadding=0 cellspacing=0>";
	roundBox += "	<tr><td width=3 bgcolor="+rgb1+"></td>";
	roundBox += "		<td width="+(objDivWidth-6)+" bgcolor="+rgb1+">";
	roundBox += "";
	roundBox += "			<table border=0 cellpadding=0 cellspacing=0 height=1>";
	roundBox += "			<tr><td width=2 bgcolor="+rgb1+"></td><td width="+(objDivWidth-10)+" bgcolor="+rgb2+"></td>";
	roundBox += "				<td width=2 bgcolor="+rgb1+"></td></tr></table>";
	roundBox += "";
	roundBox += "			<table border=0 cellpadding=0 cellspacing=0 height=1>";
	roundBox += "			<tr><td width=1 bgcolor="+rgb1+"></td>";
	roundBox += "				<td width=1 bgcolor="+rgb2+"></td>";
	roundBox += "				<td width="+(objDivWidth-10)+" bgcolor="+rgb3+"></td>";
	roundBox += "				<td width=1 bgcolor="+rgb2+"></td>";
	roundBox += "				<td width=1 bgcolor="+rgb1+"></td></tr></table>";
	roundBox += "";
	roundBox += "			<table border=0 cellpadding=0 cellspacing=0 height=1>";
	roundBox += "			<tr><td width=1 bgcolor="+rgb2+"></td><td width="+(objDivWidth-8)+" bgcolor="+rgb3+">";
	roundBox += "";
	roundBox += objDivHTML;
	roundBox += "";
	roundBox += "			</td><td width=1 bgcolor="+rgb2+"></td></tr></table>";
	roundBox += "";
	roundBox += "			<table border=0 cellpadding=0 cellspacing=0 height=1>";
	roundBox += "			<tr><td width=1 bgcolor="+rgb1+"></td>";
	roundBox += "				<td width=1 bgcolor="+rgb2+"></td>";
	roundBox += "				<td width="+(objDivWidth-10)+" bgcolor="+rgb3+"></td>";
	roundBox += "				<td width=1 bgcolor="+rgb2+"></td>";
	roundBox += "				<td width=1 bgcolor="+rgb1+"></td></tr></table>";
	roundBox += "";
	roundBox += "			<table border=0 cellpadding=0 cellspacing=0 height=1>";
	roundBox += "			<tr><td width=2 bgcolor="+rgb1+"></td><td width="+(objDivWidth-10)+" bgcolor="+rgb2+"></td>";
	roundBox += "				<td width=2 bgcolor="+rgb1+"></td></tr></table>";
	roundBox += "";
	roundBox += "		</td>";
	roundBox += "		<td width=3 bgcolor="+rgb1+"></td>";
	roundBox += "	</tr></table>";
	roundBox += "";
	roundBox += "	<table border=0 cellpadding=0 cellspacing=0 height=1>";
	roundBox += "	<tr><td width="+(objDivWidth-0)+" bgcolor="+rgb1+"></td></tr></table>";
	roundBox += "";
	roundBox += "	<table border=0 cellpadding=0 cellspacing=0 height=1>";
	roundBox += "	<tr><td width=1></td><td width="+(objDivWidth-2)+" bgcolor="+rgb1+"></td><td width=1></td></tr></table>";
	roundBox += "";
	roundBox += "	<table border=0 cellpadding=0 cellspacing=0 height=1>";
	roundBox += "	<tr><td width=2></td><td width="+(objDivWidth-4)+" bgcolor="+rgb1+"></td><td width=2></td></tr></table>";
	roundBox += "";
	roundBox += "</td></tr></table>";
	
	objDiv.innerHTML = roundBox;
}

function getSytleAttributes(objID){
	
	var rets = new Array("","","")
	
		
	if(!IE)	{
    	rets[0]=2;
    	rets[1]='FFFFFF';
    	rets[2]='FFFFFF';   

		/*
	    for(var i=0;i<document.styleSheets.length;i++ ){
	    
	   		var styleRules = document.styleSheets[i].cssRules;
	
		    for(var j=0;j<styleRules.length;j++)
		    {
				var styleId = styleRules[j].selectorText;
		    	if(styleId != null && styleId != "undefined" && styleId == objID)
		    	{
		    		var radius = 2;
		    		var rbgcolor =styleRules[j].style.getPropertyValue('background-color');
		    		var rborder = styleRules[j].style.getPropertyValue('color');
			    	//alert(radius+","+rborder+","+rbgcolor);	 
			    	rets[0]=radius;
			    	rets[1]=rborder;
			    	rets[2]=rbgcolor;   
	
		    		break;
		    	}
		    }
	    }
	    */
    }
    else
    {
	    for(var i=0;i<document.styleSheets.length;i++ ){
		    var styleRules = document.styleSheets(i).rules;
		    //alert(styleRules.length);
		    for(var j=0;j<styleRules.length;j++){
		    	var styleId = styleRules.item(j).selectorText;
		    	if(styleId != null && styleId != "undefined" && styleId == objID){
		    		var radius = 2;
		    		var rborder = styleRules.item(j).style.rborder;
		    		var rbgcolor = styleRules.item(j).style.rbgcolor;
//			    	alert(radius+","+rborder+","+rbgcolor);	
			    	rets[0]=radius;
			    	rets[1]=rborder;
			    	rets[2]=rbgcolor;
	
		    		break;
		    	}
		    }
	    }
    }

    return rets;
}

/*
// ±×¸²¿¡¼­´Â ¿À¸¥ÂÊ ¹öÆ° »ç¿ë ±ÝÁö
*/
/*
var clickmessage="±×¸²¿¡´Â ¸¶¿ì½º ¿À¸¥ÂÊ ´ÜÃß¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù." 

function disableclick(e) { 
	if (document.all) { 
		if (event.button==2||event.button==3) { 
			if (event.srcElement.tagName=="IMG" || event.srcElement.tagName=="class"){ 
				alert(clickmessage); 
				return false; 
			} 
		} 
	} else if (document.layers) { 
		if (e.which == 3) { 
			alert(clickmessage); 
			return false; 
		} 
	} else if (document.getElementById){ 
		if (e.which==3&&e.target.tagName=="IMG" || event.srcElement.tagName=="class"){ 
			alert(clickmessage) 
			return false 
		} 
	} 
} 

function associateimages(){ 
	for(i=0;i<document.images.length;i++) 
		document.images[i].onmousedown=disableclick; 
} 

if (document.all) {
	document.onmousedown=disableclick;
} else if (document.getElementById) {
	document.onmouseup=disableclick;
} else if (document.layers) {
	associateimages();
}

*/

/*
// ÄÁÅÙÃ÷ ³»¿ëÁß¿¡ ÀÖ´Â ÀÌ¹ÌÁö È®´ëÇÏ±â
*/

function img_display(imgName, winName){
	newWidth = screen.width / 2 + 100;
	newHeight = screen.height / 2 + 100;
	
	h_size = newHeight * 1 - 55;
	w_size = newWidth * 1 - 10;
	var winHandle = window.open("" ,winName,"width="+newWidth+",height="+newHeight+"toolbar=no,scrollbars=no,resizable=yes");
	if(winHandle != null) {
		winHandle.document.write("<html><head><title>ÀÌ¹ÌÁö¸¦ Å¬¸¯ÇÏ¸é Ã¢ÀÌ ´ÝÈü´Ï´Ù.</title></head>");
		winHandle.document.write("<LINK rel='stylesheet' href='/0612/css/style.css' type='text/css'>");
		winHandle.document.write("<script>function MaxScreen(){self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);image.style.width=screen.availWidth-30;image.style.height=screen.availHeight*0.9-20;}</script>");
		//winHandle.document.write("<script>function No_right(){if(event.button == 2) {alert('¿À¸¥ÂÊ ¸¶¿ì½º¹öÆ°Àº »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.');self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);image.style.width=screen.availWidth-30;image.style.height=screen.availHeight*0.9-20;}</script>");
		winHandle.document.write("<body oncontextmenu='return false'>");
		winHandle.document.write("<div id='msg_image' style='POSITION:absolute; top:25px; left: 10px;'>");
		winHandle.document.write("<table><tr><td><img src='/contentImages/btn_close.gif' onclick='self.close()' style='cursor:hand'></td>");
		winHandle.document.write("<td><img src='/contentImages/btn_all.gif' onclick='MaxScreen();' style='cursor:hand'></td>");
		winHandle.document.write("</tr></table>");		
		winHandle.document.write("</div>");
		winHandle.document.write("<div id='image' style='OVERFLOW: auto; WIDTH: "+w_size+"px; HEIGHT: "+h_size+"px; POSITION:absolute; top:55px; left:10px;'>");
		winHandle.document.write("<table width="+newWidth+" height="+newHeight+" style='BORDER:1px solid #66CCCC;'>");
		winHandle.document.write("<tr><td><img src='" + imgName + "' onclick='self.close()' style='cursor:hand' alt='ÀÌ¹ÌÁö¸¦ Å¬¸¯ÇÏ¸é Ã¢ÀÌ ´ÝÈü´Ï´Ù.'></td></tr>");
		winHandle.document.write("</table>");
		winHandle.document.write("</div>");
		winHandle.document.write("</body></html>")
		winHandle.focus()
	}



	//var winHandle = window.open("" ,winName,"toolbar=no,scrollbars=yes,resizable=yes")
	//if(winHandle != null) {
		//winHandle.document.write("<html><head><title>IMAGE</title></head>")
		//winHandle.document.write("<body>")
		//winHandle.document.write("<a href=javascript:window.close()><img src='" + imgName + "' align='absmiddle' alt='ÀÌ¹ÌÁö¸¦ Å¬¸¯ÇÏ¸é Ã¢ÀÌ ´ÝÈü´Ï´Ù.' border=0></a>")
		//winHandle.document.write("</body></html>")
		//winHandle.focus()
	//}
}

/*
// ÄÁÅÙÃ÷ ³»¿ë ÀÎ¼â
*/

function print_view(subject, contents){
	var winHandle = window.open("" ,"print","toolbar=no,scrollbars=yes,resizable=yes,width=640,height=500")
	if(winHandle != null) {
		winHandle.document.write("<html><head><title>IMAGE</title></head>")
		winHandle.document.write("<body>")
		winHandle.document.write("<span class=stress>" + subject + "</span>")
		winHandle.document.write("</body></html>")
		winHandle.focus()
		print_page()
	}
}

/*
// ¿ìÃøº£³Ê ½ºÅ©·Ñ
*/
function right_banner_scroll()
{
    var a=document.body.scrollTop+105   // ¹è³ÊÀÇ ÃÖ»óÀ§ À§Ä¡´Â 105px ±âÁØ
    right_banner.style.top=a
}


function print_page() 
{ 
	if (window.print) 
	{ 
		agree = confirm('ÇÁ¸°Æ®¸¦ ÇÏ½Ã°Ú½À´Ï±î?'); 
		if (agree) 
			window.print(); 
   	} 
} 


/*
// °Ô½ÃÆÇ ÇÏÀ§ ¸Þ´º º¸ÀÌ±â, °¨Ãß±â
*/

function view_submenu(name)
{
var lastLayer = "";
	if(document.all[name].style.display != "none") {
		document.all[name].style.display = "none";
	} else {
		document.all[name].style.display = ""
		
		if(lastLayer != "" && name != lastLayer) {
			document.all[lastLayer].stle.display = "none";
		}
		
		lastLayer = name;
	}
}

function hidden_submenu(submenu)
{
	submenu.style.display = 'none';
}


/*
// ¸ÞÀÎ ¹è³Ê ´ÙÀ½ º¸ÀÌ±â
*/

function banner_next(flg)
{
	if(flg == '1')  {
		if(document.all['banner1'].style.display == "block") {
			document.all['banner1'].style.display = "none";
			document.all['banner2'].style.display = "block";
		} else if(document.all['banner2'].style.display == "block") {
			document.all['banner2'].style.display = "none";
			document.all['banner1'].style.display = "block";			
		}
	} else if(flg == '2')  {
		if(document.all['banner3'].style.display == "block") {
			document.all['banner3'].style.display = "none";
			document.all['banner4'].style.display = "block";
		} else if(document.all['banner4'].style.display == "block") {
			document.all['banner4'].style.display = "none";
			document.all['banner3'].style.display = "block";			
		}
	}
}

/*
// ¸ÞÀÎ ¹è³Ê ¹öÆ°
*/

function next1(flg, icon1, icon2)
{
	if(flg == '1') {
		document.all['button1'].src = icon1;
		document.all['button2'].src = icon2;
		document.all['banner1'].style.display = "block";
		document.all['banner2'].style.display = "none";
		document.all['banner3'].style.display = "block";
		document.all['banner4'].style.display = "none";
	} else if(flg == '2') {
		document.all['button1'].src = icon1;
		document.all['button2'].src = icon2;
		document.all['banner1'].style.display = "none";
		document.all['banner2'].style.display = "block";
		document.all['banner3'].style.display = "none";
		document.all['banner4'].style.display = "block";
	}
}

/*
// ¼­ºê ¸Þ´º º¸ÀÌ±â
*/

function show_submenu()
{
	document.all['submenu'].style.display = "block";
}


/*
// ³¯Â¥°è»ê
*/
function DateCheck(today, iday){
  var arySrtDt = today.value.split("."); // ex) ½ÃÀÛÀÏÀÚ(2000.10.9)
  var aryEndDt = iday.value.split("."); // ex) Á¾·áÀÏÀÚ(2000.12.5)
  
  if( arySrtDt.length != 3 || aryEndDt.length != 3){
   alert("³¯Â¥ Çü½ÄÀÌ Àß¸øµÇ¾ú½À´Ï´Ù.");
   return false;
  } 
  var startDt = new Date(Number(arySrtDt[0]),Number(arySrtDt[1])-1,Number(arySrtDt[2]));
  var endDt = new Date(Number(aryEndDt[0]),Number(aryEndDt[1])-1,Number(aryEndDt[2]));
  
  resultDt = Math.floor(endDt.valueOf()/(24*60*60*1000)- startDt.valueOf()/(24*60*60*1000));
  
  if(resultDt < 0 ){
   alert("½ÃÀÛ³¯Â¥°¡ ´õ Å®´Ï´Ù.");
   return false;
  }
  
  if(resultDt > 90){
   alert("¸®Æ÷Æ® Á¶È¸±â°£Àº 90ÀÏ Á¦ÇÑÀÔ´Ï´Ù.");
   return false;
  }
  
  return true;
 }

