function setCookie( name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function getCookie( name ){
    var nameOfCookie = name + "=";
    var x = 0;
    while ( x <= document.cookie.length )
    {
        var y = (x+nameOfCookie.length);
        if ( document.cookie.substring( x, y ) == nameOfCookie ) {
        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
        endOfCookie = document.cookie.length;
        return unescape( document.cookie.substring( y, endOfCookie ) );
    }
    x = document.cookie.indexOf( " ", x ) + 1;
    if ( x == 0 )
        break;
    }
    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.0
  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 && document.getElementById) x=document.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_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(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 open_window(url,name,width,height,scroll)
{

	width	= eval(width) + 58
	height	= eval(height) + 88



	var nW = screen.width-width;
	var nH = screen.height-height;
	var x = nW / 2;
	var y = nH / 2;
	var sURL = url;
	var features = "width=" + width + ",height=" + height + ",left=" + x + ",top=" + y + ",scrollbars=" + scroll + ",resizable=no,toolbar=no,menubar=no";
	window.open(sURL, name, features);
}

function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function checking(){
	if(LOGINFORM.input_id.value.length < 2){return false;}
	if(LOGINFORM.password.value.length < 2){return false;}
}

var Bleft;
//È¨ÆäÀÌÁö°¡ Áß¾ÓÁ¤·ÄÀÎ °æ¿ì:¹è³ÊÁÂÃøÁÂÇ¥=È¨ÆäÀÌÁö ÀüÃ¼³ÐÀÌ + (ºê¶ó¿ìÀúÀüÃ¼³ÐÀÌ - È¨ÆäÀÌÁö ÀüÃ¼³ÐÀÌ)/2
//È¨ÆäÀÌÁö°¡ ÁÂÃøÁ¤·ÄÀÎ °æ¿ì:¹è³ÊÁÂÃøÁÂÇ¥=È¨ÆäÀÌÁö ÀüÃ¼³ÐÀÌ (¾Æ´Ï¸é ·¹ÀÌ¾îÀÇ ÁÂÃøÁÂ·á¸¦ È¨ÆëÁö ÀüÃ¼³ÐÀÌ°ªÀ¸·ÎÁÖ°í º¯È­ÁÖ¸¦ ÁÖÁö ¾Ê´Â´Ù.)
function scroll(){//µû¶ó´Ù´Ï´Â º£³Ê À§¿¡¼­ºÎÅÍ °£°Ý

	try
	{
		Bleft=768 + (document.body.clientWidth-760)/2
		var a=document.body.scrollTop+190//»óÇÏ·Î ¿òÁ÷ÀÌ¹Ç·Î ½ºÅ¬·ÎµÇ´Â °Å¸®¿¡ Ã³À½ ³ôÀÌ¸¦ ´õÇÑ´Ù  Benner.style.left=Bleft;
		Banner.style.top=a
	} catch(ex) { }
}
window.onresize=scroll;


function popupImg(imgObj) {
 var img = new Image(); //img¶ó´Â ÀÌ¹ÌÁö °´Ã¼ »ý¼º
 img.src = imgObj.src; //img.±×¸²ÆÄÀÏÁÖ¼Ò¿¡ ÆË¾÷¿¡ ¶ç¿ï·Á´Â ±×¸²ÆÄÀÏ ÁÖ¼Ò ÀúÀå

 var openWindow = window.open("about:blank", "popupImg", "width="+img.width+", height="+img.height); //±×³É ¾Æ¹«°Íµµ ¾ø´Â ÆË¾÷À» ¶ç¿îÈÄ
 //ÇØ´ç ÆË¾÷Ã¢¿¡ ÀÌ¹ÌÁö¸¦ Ãâ·ÂÇÑ´Ù.
 openWindow.document.write("<body leftmargin=0 topmargin=0>");
 openWindow.document.write("<img src='"+img.src+"' onclick=self.close(); style=cursor:hand; alt='ÀÌ¹ÌÁö¸¦ Å¬¸¯ÇÏ¸é Ã¢ÀÌ ´ÝÄ¨´Ï´Ù.' galleryImg='false'>");
}


function logincheck()
{
	var Regform = document.LOGINFORM;

	if(Regform.input_id.value == ""){
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ½Ê½Ã¿À.");
		Regform.input_id.focus();
		return;
	}

	if(Regform.password.value == ""){
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ½Ê½Ã¿À.");
		Regform.password.focus();
		return;
	}

	document.LOGINFORM.submit();
}




function AutoResizeFrame(iFrameObj)
{
	try
	{
		// IFRAME °³Ã¼
		if (!iFrameObj)
			return;

		var nHeightAppend = (iFrameObj.contentDocument) ? 18 : 0;
		var frameDoc = (iFrameObj.contentDocument) ? iFrameObj.contentDocument : document.frames(iFrameObj.name).document;

		iFrameObj.style.width	= frameDoc.body.scrollWidth + (frameDoc.body.offsetWidth - frameDoc.body.clientWidth) + nHeightAppend;
		iFrameObj.style.height	= frameDoc.body.scrollHeight + (frameDoc.body.offsetHeight - frameDoc.body.clientHeight) + nHeightAppend;
	} catch(ex) { }
}

//·Î±×ÀÎÃ¢
function winLogin()
{
	var wLogin = window.open('/iTClock/login.form.asp', 'wLogin', 'width=320,height=120,scrollbars=0,toolbars=0');
	wLogin.focus();
}


function setBoardSubLinkHighlight(sROOT)
{
	try
	{
		if (sROOT == '')
		{
			return false;
		}
		var targetEl = document.getElementById(sROOT);
		targetEl.className = 'alt';
	} catch(ex) { }
}



function scrollToTop()
{
	try
	{
		window.scrollTo(0,0);
	} catch(ex)
	{
		alert(ex.message);
	}
}
