function confirmRedirect(msg, goURL) { 
  if(confirm(msg) == true) location.href = goURL;
}

function windowOpen(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function openWindow(strURL,strName,intWidth,intHeight) {
	intX = (screen.width-intWidth)/2;
  intY = (screen.height-intHeight)/2;
	var strOption = "width="+intWidth+",height="+intHeight+",left="+intX+",top="+intY;
	var win = window.open(strURL,strName,strOption);
	win.focus();
}

function openWindow1(strURL,strName,intWidth,intHeight) {
	intX = (screen.width-intWidth)/2;
  intY = (screen.height-intHeight)/2;
	var strOption = "scrollbars=yes,resizable=yes,width="+intWidth+",height="+intHeight+",left="+intX+",top="+intY;
	var win = window.open(strURL,strName,strOption);
	win.focus();
}

function Svalue(obj,msg) {
	if ( obj.selectedIndex != 0 )	return false;
	alert (msg);
	obj.focus();
	return true;
}

function Tvalue(obj,len,msg) {
	if ( obj.value.length >= len )	return false;
	alert (msg + len + '±ÛÀÚ ÀÌ»ó ±âÀÔÇØ ÁÖ¼¼¿ä.' );
	obj.focus();
	return true;
}

function Ivalue(obj,len,msg) {
	if ( obj.value.length >= len )	return false;
	alert (msg);
	obj.focus();
	return true;
}

function Ivalue1(obj,len,msg) {
  var astr;
  astr = deleteSpace(obj.value);
	if ( astr.length >= len ) return false;
	alert (msg);
	obj.focus();
	return true;
}

function Ivalue2(obj,len,msg) {
  var str_value;
  str_value = deleteSpace(obj.value);
	if ( str_value.length >= len ) return false;
	alert (msg);
	return true;
}

function Lvalue(obj,minlen,maxlen,msg) {
	if ( obj.value.length <= maxlen && obj.value.length >= minlen )	return false;
	alert (msg);
	obj.focus();
	return true;
}

function Fvalue(obj,msg) {
	if ( obj.value.length > 0 )	return false;
	alert (msg);
	obj.focus();
	return true;
}

function NumCheck(obj,len,msg) {
	if ( obj.value.length <  len) {
		alert (msg + len + '±ÛÀÚ ÀÌ»ó ±âÀÔÇØ ÁÖ¼¼¿ä.' );
		obj.focus();
		return true;
	}
	if ( isNaN ( obj.value) ) {
		alert (msg + ' ¼ýÀÚ·Î ±âÀÔÇØ ÁÖ¼¼¿ä.' );
		obj.focus();
		return true;
	}
	return false;
}

function FloatCheck(obj,len,cmt) {
	var i;
	var t = obj.value;
	astr = "1234567890."
	if (t.length < len) {
		alert(cmt + '¸¦(À») ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä.');
		obj.focus();
		return true;
	}
	if (t.length > 1) {
		for (i=0; i<t.length; i++)
			if(astr.indexOf(t.substring(i,i+1))<0) {
			alert(cmt + '¿¡ Çã¿ëÇÒ ¼ö ¾ø´Â ¹®ÀÚ°¡ ÀÔ·ÂµÇ¾ú½À´Ï´Ù.\n\''+astr+'\'¿¡ ÇØ´çÇÏ´Â ¹®ÀÚ·Î¸¸ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä.');
			obj.focus();
			return true;
			}
	}
	return false;
}                      

function ValidDigit(obj,min,max,cmt) {
	if (obj.value < min || obj.value > max) {
		alert(cmt+' '+max+'¿¡¼­ '+min+'±îÁöÀÇ ¼ýÀÚ ÀÌ¾î¾ß ÇÕ´Ï´Ù'+obj.value);
		obj.focus();
		return true;
	}
	return false;
}                       

function Tcheck(obj, oname, astr, lmin, lmax) {
	var i;
	if (obj.value.length < lmin || obj.value.length > lmax) {
		if (lmin == lmax) alert(oname + '(Àº)´Â ' + lmin + ' Byte ÀÌ¾î¾ß ÇÕ´Ï´Ù');
		else alert(oname + '´Â ' + lmin + ' ~ ' + lmax + ' ÀÚ ÀÌ³»·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù');
		obj.focus();
		return true;
	}
	if (astr.length > 1) {
		for (i=0; i<obj.value.length; i++)
			if(astr.indexOf(obj.value.substring(i,i+1))<0) {
			alert(oname + '¿¡ Çã¿ëÇÒ ¼ö ¾ø´Â ¹®ÀÚ°¡ ÀÔ·ÂµÇ¾ú½À´Ï´Ù.\n\''+astr+'\'¿¡ ÇØ´çÇÏ´Â ¹®ÀÚ·Î¸¸ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä.');
			obj.focus();
			return true;
			}
	}
	return false;
}                      

function Tcheck1(obj,oname,astr,lmin) {
	var i;
	if (obj.value.length < lmin ) {
		alert(oname + '´Â ' + lmin +' ÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù');
		obj.focus();
		return true;
	}
	if (astr.length > 1) {
		for (i=0; i<obj.value.length; i++)
			if(astr.indexOf(obj.value.substring(i,i+1))<0) {
			alert(oname + '¿¡ Çã¿ëÇÒ ¼ö ¾ø´Â ¹®ÀÚ°¡ ÀÔ·ÂµÇ¾ú½À´Ï´Ù.\n\''+astr+'\'¿¡ ÇØ´çÇÏ´Â ¹®ÀÚ·Î¸¸ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä.');
			obj.focus();
			return true;
			}
	}
	return false;
}                      

function isImage(url) {
	var ix = url.toLowerCase();
	if ((ix.indexOf('.jpg') != -1) || (ix.indexOf('.jpe') != -1) || (ix.indexOf('.jpeg') != -1) || (ix.indexOf('.gif') != -1)) return true;
	else return false; // can't determine further from filename!
}

function isEmail(str) {
  // regular expression Áö¿ø ¿©ºÎ Á¡°Ë
  var supported = 0;
  if (window.RegExp) {
    var tempStr = 'a';
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf('.') > 2) && (str.indexOf('@') > 0);
  var r1 = new RegExp('(@.*@)|(\\.\\.)|(@\\.)|(^\\.)');
  var r2 = new RegExp('^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$');
  return (!r1.test(str) && r2.test(str));
}

function resizeImage(objImage,maxValue) {
  if (objImage != null && maxValue != null) {
    var imageWidth , imageHeight, tempHeight, tempWidth; 
    imageWidth = objImage.width;
    imageHeight = objImage.height;
    
    if (imageWidth < maxValue && imageHeight < maxValue){
      tempWidth = imageWidth;
      tempHeight = imageHeight;
    }else{
      if (imageWidth > imageHeight){
        tempWidth = maxValue ;
        tempHeight = (imageHeight * tempWidth)/imageWidth;
      }else if(imageWidth < imageHeight){
        tempHeight = maxValue;
        tempWidth = (imageWidth * tempHeight)/imageHeight;
      }else{
        tempWidth = maxValue;
        tempHeight = maxValue;
      }
    }
    objImage.width = tempWidth;
    objImage.height = tempHeight;
  } else {
    return;
  }
}
// ¿¹Á¦ <img name=imgContent2 src="images/ajak_event_13.gif" onload="javascript:resizeImage(document.imgContent2, 100);">

function resizeImageWidth(objImage,maxValue) {
  if (objImage != null && maxValue != null) {
    var imageWidth , imageHeight, tempHeight, tempWidth; 
    imageWidth = objImage.width;
    imageHeight = objImage.height;
    
    if (imageWidth > maxValue){
      tempWidth = maxValue ;
      tempHeight = (imageHeight * tempWidth)/imageWidth;
      objImage.width = tempWidth;
      objImage.height = tempHeight;
    }
  } else {
    return;
  }
}
// ¿¹Á¦ <img name=imgContent2 src="images/ajak_event_13.gif" onload="javascript:resizeImage(document.imgContent2, 100);">

function deleteSpace(str)
{
  var idx, len;
  while(true)
  {
    idx = str.indexOf(" ")
    if (idx == -1) break
    len = str.length
    str = str.substring(0, idx) + str.substring((idx+1),len)
  }

  return str;
}

function checkPrivateRegnum(strValue1, strValue2) {
  if(checkLength(strValue1) != 6) return false;
  if(checkLength(strValue2) != 7) return false;
  strValue = strValue1 + strValue2;
  for(i = 0; i < strValue.length; i++) {
    astr = strValue.substring(i, i + 1);
    if(!((astr >= "0") && (astr <= "9"))) {
      return false; 
      break;
    }
  }
  val = 0;
  for(i = 0; i <= 11; i++)
    val = val + ((i % 8 + 2) * parseInt(strValue.substring(i, i + 1)));
  val = 11 - (val % 11)
  val = val % 10
  if(val != strValue2.substring(6, 7)) {
    return false;
  }
  return true; 
}

function checkLength(c) {
  rtn = 0;
  for(i = 0; i < c.length; i++) {
    t = escape(c.charAt(i)) ;
    if(t.length == 1) {
      rtn ++;    
    } else if(t.indexOf("%u") != -1) {
      rtn += 2;
    } else if(t.indexOf("%") != -1) {
      rtn += t.length / 3;
    }
  }
  return rtn;
}

function getByte(strValue)
{               
	var ilen=0, j;
	for (i=0,j=strValue.length; i<j; i++,ilen++) { 
		if ((strValue.charCodeAt(i)<0)||(strValue.charCodeAt(i)>127) ) {
			ilen = ilen+1;
		}
	}
	return ilen;
}

function cutByte(aquery, max)
{             
	var tmpStr;
	var temp=0;
	var onechar;
	var tcount; 
	tcount = 0;
	tmpStr = new String(aquery);
	temp = tmpStr.length;

	//alert("80byte¸¦ ³ÑÀ» ¼ö ¾ø½À´Ï´Ù.(ÇÑ±Û40ÀÚ ¿µ¹®80ÀÚ).");

	for(k=0;k<temp;k++)
	{
		onechar = tmpStr.charAt(k);       

		if(escape(onechar).length > 4) {
			tcount += 2;        
		} else if(onechar!='\r') {
			tcount++;           
		}
		if(tcount>max) {
			tmpStr = tmpStr.substring(0, k);     
			break;
		}
	}
	return tmpStr;
}

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 "";
}

// Flash Activating Script
// 2005-12-05
// inome _at_ nhncorp.com
// Don't Edit Below! Never!

// s: source url
// d: flash id
// w: source width
// h: source height
// t: wmode ("" for none, transparent, opaque ...)
function mf(s,d,w,h,t){
        return "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width="+w+" height="+h+" id="+d+"><param name=wmode value="+t+" /><param name=movie value="+s+" /><param name=quality value=high /><embed src="+s+" quality=high wmode="+t+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width="+w+" height="+h+"></embed></object>";
}

// write document contents
function dc_write(src){
        document.write(src);
}

// assign code innerHTML
function tg_setcode(target, code){
        target.innerHTML = code;
}
// Flash Activating Script





