/*** String Prototype add-ons ***/
String.prototype.trim = function() {
	return this.replace(/^\s+/g, "").replace(/\s+$/g, "");
}

String.prototype.mblength = function() {
	var result = 0;
	for(i=0; i<this.length; ++i) {
		var c = this.charAt(i);
		var enc = encodeURIComponent(c);
		result++;
		if(enc.length > 3) result++;
	}
	return result;
}

	function openCalendar( name) {
    	window.open( "/include/calendar/oneCalendar.jsp?type=normal&name=" + name, "", "width=210, height=200");
	}
	
    function chkFormRadio( formname, name) {
        var theRadio = eval( "document." + formname + "." + name);
        var length   = theRadio.length;
        for ( var i=0; i<length; i++)
            if ( theRadio[ i].checked)
                return true;
        return false;
    }
    

    function chkRadio( name) {
        var theRadio = eval( "document.Form." + name);
        var length   = theRadio.length;
        for ( var i=0; i<length; i++)
            if ( theRadio[ i].checked)
                return true;
        return false;
    }
    

    function chkFormChkBox( formname, name)	{
        var theChkbox = eval( "document." + formname + "." + name);
        if ( theChkbox.checked)
                return true;
        return false;
    }
   
   	function chkChkBox( name) {
        var theChkbox = eval( "document.Form." + name);
       
        if ( theChkbox.checked)
                return true;
        return false;
    }

    
	function trimString( str) {
		return str.replace(/^(\s+)|(\s+)$/g,""); 
		/*
		sInString = sInString.replace( /^\s+/g, "" );		// strip leading
		return sInString.replace( /\s+$/g, "" );			// strip trailing
		*/
	}	
	
	
	function set( check_id, etc_id)	{
		var theForm  = eval( "document.Form." + check_id);
		var theValue = eval( "document.Form." + etc_id);
		theValue.value = "";
		if ( theForm.checked)	
			theValue.disabled = false;
		else 
			theValue.disabled = true;	
	}

	function enable( id)	{
		var theForm = eval( "document.Form." + id);
		theForm.value = "";
		theForm.disabled = false;
	}
			
	function disable( id)	{
		var theForm = eval( "document.Form." + id);
		theForm.value = "";
		theForm.disabled = true;
	}

	function chk12345( id)	{
		var theForm = eval( "document.Form." + id);
		var num = theForm.value;
		if ( ( num != '1') && ( num != '2')	&& ( num != '3') && ( num != '4') && ( num != '5'))	{
			theForm.value = "";
			theForm.focus();
			return false;
		}
		return true;
	}
	
	
	function show( id)	{
		document.getElementById( id).style.display = "block";	
	}	
	
	function hide( id)	{
		document.getElementById( id).style.display = "none";	
	}	
	
	
	/* --------------------------------------------------
	   ½ºÆ®¸µ¿¡¼­ ¿ÞÂÊ°ø¹éÁ¦°Å (Left Trim)
	-------------------------------------------------- */
	function LTrim( SrcString)	{
	   len = SrcString.length;
	   for( i=0; i<len; i++)	{
	      if( SrcString.substring( 0,1) == " ")	
	         SrcString = SrcString.substring(1);
	      else
	         break;
	   }
	   return SrcString;
	}
	
	/* --------------------------------------------------
	   ½ºÆ®¸µ¿¡¼­ ¿À¸¥ÂÊ°ø¹éÁ¦°Å (Right Trim)
	-------------------------------------------------- */
	function RTrim( SrcString)	{
	   len = SrcString.length;
	   for( i=len; i>0; i--)	{
	      if( SrcString.substring( i-1) == " ")
	         SrcString = SrcString.substring(0,i-1);
	      else
	         break;
	   }
	   return SrcString;        
	}
	
	/* --------------------------------------------------
	   ½ºÆ®¸µ¿¡¼­ ¾çÂÊ°ø¹éÁ¦°Å (Left Right Trim)
	-------------------------------------------------- */
	function trim( SrcString)	{
	   rtnStr = RTrim( LTrim( SrcString))
	   return rtnStr;
	}
	
	function trimString2( SrcString)		{
	   return RTrim( LTrim( SrcString));
	}


	function daumActiveX(obj,div){
		// generate html code
		// for ie obejct
		var html = '<object ';
		if (!obj.id && !obj.name){
			var r = Math.round(Math.random()*100);
			html += 'id="daumActiveXObject'+r+'" name="daumActiveXObject'+r+'" ';
		} else {
			if (obj.id) html += 'id="'+obj.id+'" ';
			else html += 'id="'+obj.name+'" ';
			if (obj.name) html += 'name="'+obj.name+'" ';
			else html += 'name="'+obj.id+'" ';
		}
		if (obj.type) html += 'type="'+obj.type+'" ';
		if (obj.classid) html += 'classid="'+obj.classid+'" ';
		if (obj.width) html += 'width="'+obj.width+'" ';
		if (obj.height) html += 'height="'+obj.height+'" ';
		if (obj.codebase) html += 'codebase="'+obj.codebase+'" ';
		// append events
		for (var i in obj.events){
			if (obj.events[i]){
				html += obj.events[i][0]+'="'+obj.events[i][1]+'" ';
			}
		}
		// end of object tag
		html += '>\n';
		// append params
		for (var i in obj.param){
			html += '<param name="'+obj.param[i][0]+'" value="'+obj.param[i][1]+'"/>\n';
		}
	
		// for ns embed
		html += '<embed ';
		if (!obj.id && !obj.name){
			var r = Math.round(Math.random()*100);
			html += 'id="daumActiveXObject'+r+'" name="daumActiveXObject'+r+'" ';
		} else {
			if (obj.id) html += 'id="'+obj.id+'" ';
			if (obj.name) html += 'name="'+obj.name+'" ';
		}
		if (obj.type) html += 'type="'+obj.type+'" ';
		if (obj.width) html += 'width="'+obj.width+'" ';
		if (obj.height) html += 'height="'+obj.height+'" ';
		// append params
		for (var i in obj.param){
			if (obj.param[i]){
				if (obj.param[i][0]=='movie' || obj.param[i][0]=='src'){
					var _src = obj.param[i][1];
				}
				html += obj.param[i][0]+'="'+obj.param[i][1]+'" ';
			}
		}
		html += '/>\n';
		html += '</object>';
	
		var isIE = (document.all)?true:false;
		if (isIE){
			document.getElementById(div).innerHTML = html;
		} else if (obj.type=='application/x-shockwave-flash' || obj.classid=='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'){
			// ie¿ÜÀÇ ºê¶ó¿ìÀú¿¡¼­ activex°¡ flashÀÎ °æ¿ì¸¸ ³ëÃâ
			document.getElementById(div).innerHTML = html;
		}
	}


	
	function DaumFlash(src,param,width,height,id){
		var obj = new Object();
		obj.type = 'application/x-shockwave-flash';
		obj.classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
		obj.codebase = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0';
		obj.width = width;
		obj.height = height;
	
		var param = [		
			['movie',src],
			['src',src],
			['quality','high'],
			['wmode','transparent'],
			['allowScriptAccess','sameDomain'],
			['bgcolor','#FFFFFF'],
			['FlashVars',param]
		];
		obj.param = param;
		daumActiveX(obj,id);
	}
	
	//---------------------------------------------------------------------------------------------------------
	//  ÇÃ·¡½¬(swf) ÆÄÀÏ ¸µÅ© 
	//  ÆÄ¶ó¹ÌÅÍ : ID, width, height, swfÆÄÀÏ¸í, wmode(none, transparent, opaque, FlashVars(ÇÃ·¡½Ã·Î ³Ñ±æ ÆÄ¶ó¹ÌÅÍ)...)
	//---------------------------------------------------------------------------------------------------------
	function daumFlash2(id,w,h,s,wmode,vars) 
	{
	    var str="", sID="";
	 
	    if (id.length > 0) { sID = " id='"+id+"' name='"+id+"'"; }
	
	    str += "<object "+sID+" classid='clsid:D27CDB6E-AE6D-11cf-96B8";
	    str += "-444553540000'";
	    str += " codebase='http://download.macromedia.com/pub/shockwave/cabs";
	    str += "/flash/swflash.cab#version=6,0,29,0'";
		if(w != "")
	    	str += " width='"+w+"'";
		if(h != "")
			str += " height='"+h+"'";
		str += ">";
	    str += "<param name='movie' value='"+s+"'>";
	    str += "<param name='quality' value='high'>";
	    str += "<param name='wmode' value='"+wmode+"'>";
	    str += "<param name='FlashVars' value='"+vars+"'>";
	    str += "<embed "+sID+" src='"+s+"' quality='high' wmode='"+wmode+"'";
	    str += " pluginspage='http://www.macromedia.com/go/getflashplayer'";
	    str += " type='application/x-shockwave-flash'";
	    str += " width='"+w+"' height='"+h+"'></embed>";
	    str += "</object>";
	
		document.write(str);
	}

	function DaumMovie( src, fv, width, height, div)	{
		var obj = new Object();
		obj.classid = 'CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95';
		obj.name = div;
		obj.id = 'filmwmp';
		obj.width = width;
		obj.height = height;
		obj.codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902';

		var param = [
			['src',src],
			['wmode','transparent'],
			['bgcolor','#000000'],
			['pluginspage','http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/'],
			['Autostart','1'],
			['Showcontrols','1'],
			['Volume','1'],
			['Showstatusbar','0'],

			['AllowScan','-1'],
			['AllowChangeDisplaySize','1'],
			['AnimationAtStart','1'],
			['AudioStream','-1'],
			['AutoSize','0'],
			['AutoResize','0'],
			['AutoRewind','1'],
			['Balance','0'],
			['BufferingTime','5'],
			['CaptioningID'],
			['ClickToPlay','-1'],
			['CursorType','0'],
			['CurrentPosition','0'],
			['CurrentMarker','0'],
			['DefaultFrame','0'],
			['DisplayBackColor','0'],
			['DisplayForeColor','16777215'],
			['DisplayMode','0'],
			['DisplaySize','4'],
			['Enabled','-1'],
			['EnableContextMenu','0'],
			['EnablePositionControls','-1'],
			['EnableFullScreenControls','0'],
			['EnableTracker','-1'],
			['InvokeURLs','-1'],
			['Language','-1'],
			['PlayCount','1'],
			['PreviewMode','0'],
			['Rate','1'],
			['SAMILang'],
			['SAMIStyle'],
			['SAMIFileName'],
			['SelectionStart','-1'],
			['SelectionEnd','-1'],
			['SendOpenStateChangeEvents','-1'],
			['SendWarningEvents','-1'],
			['SendErrorEvents','-1'],
			['SendKeyboardEvents','0'],
			['SendMouseClickEvents','0'],
			['SendMouseMoveEvents','0'],
			['SendPlayStateChangeEvents','1'],
			['ShowCaptioning','0'],
			['ShowAudioControls','1'],
			['ShowDisplay','0'],
			['ShowGotoBar','0'],
			['ShowPositionControls','1'],
			['ShowTracker','1'],
			['TransparentAtStart','1'],
			['VideoBorderWidth','0'],
			['VideoBorderColor','0'],
			['VideoBorder3D','0'],
			['WindowlessVideo','0'],
		];

		obj.param = param;
		daumActiveX(obj, div);
	}
				
	//---------------------------------------------------------------------------------------------------------
	//  ¹Ìµð¾îÇÃ·¹ÀÌ¾î(mp3, wma, wmv µî) ÆÄÀÏ ¸µÅ©
	//  ÆÄ¶ó¹ÌÅÍ  : ID, width, height, ¹Ìµð¾î ÆÄÀÏ¸í, Ãß°¡ÇÒ ÆÄ¶ó¹ÌÅÍ[name1, value1, ...]
	//---------------------------------------------------------------------------------------------------------
	function DaumMovie2(id,w,h,url) {
	
	    var pList = wmp.arguments;
	    var str="", sID="";
	
	    if (id.length > 0) { sID = " id='"+id+"' name='"+id+"'"; }
	
	    str += "<object "+sID+" width='"+w+"' height='"+h+"'";
	    str += " classid='CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6'";
	    str += " type='application/x-oleobject' VIEWASTEXT>";
	    str += "<param name='URL' value='"+url+"'>";
	    str += "<param name='autoStart' value='-1'>";
	    str += "<param name='volume' value='100'>";
	    str += "<param name='enableContextMenu' value='-1'>";
	
	    if (pList.length > 4) {
	        for (var i=4; i < pList.length; i+=2)
	        str += "<param name='"+pList[i]+"' value='"+pList[i+1]+"'>";
	    }
	    str += "<embed "+sID+" width='"+w+"' height='"+h+"' src='"+url+"'";
	    //str += " type='application/x-mplayer2'";
		str += " type='=video/x-ms-wmv'";
		str += " transparentatstart='1'";
	    if (pList.length > 4) {
	        for (var i=4; i < pList.length; i+=2)
	        str += " "+pList[i]+"='"+pList[i+1]+"'";
	    }
	    str += " pluginspage='http://www.microsoft.com/Windows/Downloads";
	    str += "/Contents/Products/MediaPlayer/'>";
	    str += "</embed>";
	    str += "</object>";
	    document.write(str);
	}
			
	function outerActiveX( str)	{
		document.write( str);	
	}
	
	function openPopup( url, name, feature)	{
		var theWin = window.open( url, name, feature);
		theWin.focus();
	}
	
	
	function getCookie( name) { 
		var Found = false;
		var start, end;
		var i = 0;
		
		while ( i <= document.cookie.length) 	{ 
			start = i;
			end = start + name.length;
			
			if ( document.cookie.substring( start, end) == name) { 
				Found = true;
				break;
			} 
			i++;
		} 
			
		if ( Found == true) { 
			start = end + 1;
			end = document.cookie.indexOf( ";", start);
			if ( end < start)
				end = document.cookie.length;
			return document.cookie.substring( start, end);
		} 
		return "";
	} 
	
	
    function chkFormRadio( formname, name)	{
        var theRadio = eval( "document." + formname + "." + name);
        var length   = theRadio.length;
        for ( var i=0; i<length; i++)
            if ( theRadio[ i].checked)
                return true;
        return false;
    }

    
	/*	IEÀÎÁö ¿©ºÎ ¸®ÅÏ */
	function isIE()	{
		return ( document.all) ? true : false;	
	}
	
	
    /**
     *	·ÎÄÃ ÆÄÀÏ »çÀÌÁî ¸®ÅÏ (IE)
     */
	function getFileSize( url)  { 

	    if(navigator.userAgent.indexOf('MSIE') > 0 && navigator.appVersion.indexOf('MSIE 7.') < 0)
	    {
		    var img = new Image();
		    img.dynsrc = url;
		    return img.fileSize;
	    }
	    return true;
	}

	
	/**
	 *	ÆÄÀÏ¸í °ËÅä :  ÀÌ¹ÌÁö ÆÄÀÏ ¿©ºÎ ¸®ÅÏ
	 */
	function validImgfile( file)	{
		var ext = file.substring( file.lastIndexOf( ".") + 1);
		ext = ext.toUpperCase();
		if ( ext == "JPG" || ext == "JPEG" || ext == "GIF")
			return true;
		return false;
	}
	
    /**
     *  ÆÄÀÏ¸í °ËÅä :  ¹®¼­ ÆÄÀÏ ¿©ºÎ ¸®ÅÏ
     */
    function validDocfile( file)    {
        var ext = file.substring( file.lastIndexOf( ".") + 1);
        ext = ext.toUpperCase();
        if ( ext == "DOC" || ext == "XLS" || ext == "PPT" || ext == "HWP" || ext == "HUL" || ext == "TXT")
            return true;
        return false;
    }

	/**
	 *	ÀÌ¹ÌÁö °¡·Î »çÀÌÁî Á¶Àý 
	 *	@param	imgId	image id
	 *	@param	toWidth	°¡·Î Æø
	 */
	function autoFixImage( imgID, toWidth){
		var width = document.getElementById( imgID).width;
		if( width > toWidth ) {
			document.getElementById( imgID).width = toWidth;
		}	
	}
	
	
	/**
	 *	ÀÌ¹ÌÁö °¡·Î, ¼¼·Î »çÀÌÁî Á¶Àý 
	 *	@param	imgId	image id
	 *	@param	toWidth	°¡·Î Æø
	 */
	function autoFixImage3( imgID, toWidth, toHeight){
		var width  = document.getElementById( imgID).width;
		var height = document.getElementById( imgID).height;
		if( width > toWidth) 
			document.getElementById( imgID).width = toWidth;
		if( height > toHeight) 
			document.getElementById( imgID).height = toHeight;
	}
	
	
	/**
	 *	ÀÌ¹ÌÁö ÆË¾÷Ã¢ ¶ç¿ì±â
	 */	
	function imagePopup( src) {
		var imgObj = new Image();
		imgObj.src = src;
		var wopt = "scrollbars=yes,status=no,resizable=yes,top=200,left=300";
		wopt += ",width=" + imgObj.width;
		wopt += ",height=" + imgObj.height;
		var wbody = "<head><title>»çÁø º¸±â</title>";
		wbody += "<script language='javascript'>";
		wbody += "function finalResize(){";
		wbody += "  var oBody=document.body;";
		wbody += "  var oImg=document.images[0];";
		wbody += "  var xdiff=oImg.width-oBody.clientWidth;";
		wbody += "  var ydiff=oImg.height-oBody.clientHeight;";
		wbody += "  window.resizeBy(xdiff,ydiff);";
		wbody += "}";
		wbody += "</"+"script>";
		wbody += "</head>";
		wbody += "<body onLoad='finalResize()' style='margin:0'>";
		wbody += "<a title='»çÁøÀ» Å¬¸¯ÇÏ½Ã¸é Ã¢ÀÌ ´ÝÈü´Ï´Ù.' href='javascript:window.close()'><img src='" + src + "' border=0></a>";
		wbody += "</body>";
		winResult = window.open("about:blank","",wopt);
		winResult.document.open("text/html", "replace");
		winResult.document.write(wbody);
		winResult.document.close();
		return;
	}

	
	/*	ÀÌ¸ÞÀÏ À¯È¿¼º Ã¼Å© */	
	function chkEmail( str){
		var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
		if ( filter.test( str))	
			return true;
		return false;
	}
	
	
	/*	·Î±×ÀÎ Ã¼Å© */
	function login( rurl)	{
		if (confirm( "ÀÀ¸ðÇÏ±â À§ÇØ¼­ ·Î±×ÀÎÇÏ¼Å¾ß ÇÕ´Ï´Ù.  ·Î±×ÀÎÇÏ½Ã°Ú½À´Ï±î?")){
			if ( parent != null)
				parent.location.href = "http://daumevent.daum.net/SimpleLogin?rurl=" + rurl;
			else
				location.href = "http://daumevent.daum.net/SimpleLogin?rurl=" + rurl;
			return true;
		}else{
			return false;
		}
	}
	/*	·Î±×ÀÎ Ã¼Å©2*/
	function login_back( rurl,burl)	{
		if (confirm( "ÀÀ¸ðÇÏ±â À§ÇØ¼­ ·Î±×ÀÎÇÏ¼Å¾ß ÇÕ´Ï´Ù.  ·Î±×ÀÎÇÏ½Ã°Ú½À´Ï±î?")){
			if ( parent != null)
				parent.location.href = "http://daumevent.daum.net/SimpleLogin?rurl=" + rurl;
			else
				location.href = "http://daumevent.daum.net/SimpleLogin?rurl=" + rurl;
			return true;
		}else{
			if ( parent != null)
				parent.location.href = burl;
			else
				location.href = burl;
			return true;
		}
	}
	/*	·Î±×ÀÎ Ã¼Å© */
	function login_popup()	{
		if (confirm( "ÀÀ¸ðÇÏ±â À§ÇØ¼­ ·Î±×ÀÎÇÏ¼Å¾ß ÇÕ´Ï´Ù.  ·Î±×ÀÎÇÏ½Ã°Ú½À´Ï±î?")){
			window.open("http://daumevent.daum.net/include/login_popup.jsp","·Î±×ÀÎ","width=750,height=500,toolbar=0,menubar=0,status=1");
		}
	}
	 /**
     *  ¹®¼­ ÆÄÀÏ Ã·ºÎ Ã¼Å©
     */
    function addDocFile( formname, id, sizeLimit)   {
        // ÆÄÀÏ ·Îµå
        var file = eval( "document." + formname + "." + id + ".value");

        if ( file == "")    {
            alert("ÆÄÀÏÀ» Ã·ºÎÇØÁÖ¼¼¿ä!");
            return false;
        } else if ( file.indexOf( "%") >=0) {
            alert( "ÆÄÀÏ¸í¿¡ '%'¹®ÀÚ¸¦ Æ÷ÇÔÇÒ ¼ö ¾ø½À´Ï´Ù. ÆÄÀÏ¸íÀ» º¯°æÇÏ½ÅÈÄ  ´Ù½Ã ¿Ã·ÁÁÖ¼¼¿ä.");
            return false;
        }

        if ( !validDocfile( file))  {
            alert("doc, hwp, hul, ppt, xls, txt ÆÄÀÏ¸¸ ¾÷·ÎµåÇÒ ¼ö ÀÖ½À´Ï´Ù");
            return false;
        }

        if ( getFileSize( file) > sizeLimit * 1024) {
            alert( sizeLimit + "KB¸¦ ÃÊ°úÇÏ´Â ÆÄÀÏÀº ¾÷·ÎµåÇÒ ¼ö ¾ø½À´Ï´Ù.");
            return false;
        }

        file = file.replace( /\\/g, "\\\\");
        return true;
    }

    /**
     *  ¹®¼­ ÆÄÀÏ Ã·ºÎ Ã¼Å©
     */
    function addDocFileMB( formname, id, sizeLimit) {
        // ÆÄÀÏ ·Îµå
        var file = eval( "document." + formname + "." + id + ".value");

        if ( file == "")    {
            alert("ÆÄÀÏÀ» Ã·ºÎÇØÁÖ¼¼¿ä!");
            return false;
        } else if ( file.indexOf( "%") >=0) {
            alert( "ÆÄÀÏ¸í¿¡ '%'¹®ÀÚ¸¦ Æ÷ÇÔÇÒ ¼ö ¾ø½À´Ï´Ù. ÆÄÀÏ¸íÀ» º¯°æÇÏ½ÅÈÄ  ´Ù½Ã ¿Ã·ÁÁÖ¼¼¿ä.");
            return false;
        }

        if ( !validDocfile( file))  {
            alert("doc, hwp, hul, ppt, xls, txt ÆÄÀÏ¸¸ ¾÷·ÎµåÇÒ ¼ö ÀÖ½À´Ï´Ù");
            return false;
        }

        if ( getFileSize( file) > sizeLimit * 1024 * 1024)  {
            alert( sizeLimit + "MB¸¦ ÃÊ°úÇÏ´Â ÆÄÀÏÀº ¾÷·ÎµåÇÒ ¼ö ¾ø½À´Ï´Ù.");
            return false;
        }

        file = file.replace( /\\/g, "\\\\");
        return true;
    }
	
	/** 
	 *	ÀÌ¹ÌÁö ÆÄÀÏ Ã·ºÎ Ã¼Å© 
	 */
	function addImageFile( formname, id, sizeLimit)	{
		// ÆÄÀÏ ·Îµå
		var file = eval( "document." + formname + "." + id + ".value");
		
		if ( file == "")	{
		    alert("ÆÄÀÏÀ» Ã·ºÎÇØÁÖ¼¼¿ä!");
			return false;
		} else if ( file.indexOf( "%") >=0)	{
			alert( "ÆÄÀÏ¸í¿¡ '%'¹®ÀÚ¸¦ Æ÷ÇÔÇÒ ¼ö ¾ø½À´Ï´Ù. ÆÄÀÏ¸íÀ» º¯°æÇÏ½ÅÈÄ  ´Ù½Ã ¿Ã·ÁÁÖ¼¼¿ä.");
			return false;
		}
	
		if ( !validImgfile( file))	{
			alert("jpg, gif ÆÄÀÏ¸¸ ¾÷·ÎµåÇÒ ¼ö ÀÖ½À´Ï´Ù");
			return false;
		}
		
		if ( getFileSize( file) > sizeLimit * 1024)	{
			alert( sizeLimit + "KB¸¦ ÃÊ°úÇÏ´Â ÆÄÀÏÀº ¾÷·ÎµåÇÒ ¼ö ¾ø½À´Ï´Ù.");
			return false;
		}
	
		file = file.replace( /\\/g, "\\\\");
		return true;
	}
	
	
	/** 
	 *	ÀÌ¹ÌÁö ÆÄÀÏ Ã·ºÎ Ã¼Å© 
	 */
	function addImageFileMB( formname, id, sizeLimit)	{
		// ÆÄÀÏ ·Îµå
		var file = eval( "document." + formname + "." + id + ".value");
		
		if ( file == "")	{
		    alert("ÆÄÀÏÀ» Ã·ºÎÇØÁÖ¼¼¿ä!");
			return false;
		} else if ( file.indexOf( "%") >=0)	{
			alert( "ÆÄÀÏ¸í¿¡ '%'¹®ÀÚ¸¦ Æ÷ÇÔÇÒ ¼ö ¾ø½À´Ï´Ù. ÆÄÀÏ¸íÀ» º¯°æÇÏ½ÅÈÄ  ´Ù½Ã ¿Ã·ÁÁÖ¼¼¿ä.");
			return false;
		}
	
		if ( !validImgfile( file))	{
			alert("jpg, gif ÆÄÀÏ¸¸ ¾÷·ÎµåÇÒ ¼ö ÀÖ½À´Ï´Ù");
			return false;
		}
		
		if ( getFileSize( file) > sizeLimit * 1024 * 1024)	{
			alert( sizeLimit + "MB¸¦ ÃÊ°úÇÏ´Â ÆÄÀÏÀº ¾÷·ÎµåÇÒ ¼ö ¾ø½À´Ï´Ù.");
			return false;
		}
	
		file = file.replace( /\\/g, "\\\\");
		return true;
	}

	/** 
	 *	ÀÏ¹Ý ÆÄÀÏ Ã·ºÎ Ã¼Å© 
	 */
	function addFile( formname, id, sizeLimit)	{
		// ÆÄÀÏ ·Îµå
		var file = eval( "document." + formname + "." + id + ".value");
		
		if ( file == "")	{
		    alert("ÆÄÀÏÀ» Ã·ºÎÇØÁÖ¼¼¿ä!");
			return false;
		} else if ( file.indexOf( "%") >=0)	{
			alert( "ÆÄÀÏ¸í¿¡ '%'¹®ÀÚ¸¦ Æ÷ÇÔÇÒ ¼ö ¾ø½À´Ï´Ù. ÆÄÀÏ¸íÀ» º¯°æÇÏ½ÅÈÄ  ´Ù½Ã ¿Ã·ÁÁÖ¼¼¿ä.");
			return false;
		}		
		
		if ( getFileSize( file) > sizeLimit * 1024)	{
			alert( sizeLimit + "KB¸¦ ÃÊ°úÇÏ´Â ÆÄÀÏÀº ¾÷·ÎµåÇÒ ¼ö ¾ø½À´Ï´Ù.");
			return false;
		}
	
		file = file.replace( /\\/g, "\\\\");
		return true;
	}

	/** 
	 *	ÀÏ¹Ý ÆÄÀÏ Ã·ºÎ Ã¼Å© 
	 */
	function addFileMB( formname, id, sizeLimit)	{
		// ÆÄÀÏ ·Îµå
		var file = eval( "document." + formname + "." + id + ".value");
		
		if ( file == "")	{
		    alert("ÆÄÀÏÀ» Ã·ºÎÇØÁÖ¼¼¿ä!");
			return false;
		} else if ( file.indexOf( "%") >=0)	{
			alert( "ÆÄÀÏ¸í¿¡ '%'¹®ÀÚ¸¦ Æ÷ÇÔÇÒ ¼ö ¾ø½À´Ï´Ù. ÆÄÀÏ¸íÀ» º¯°æÇÏ½ÅÈÄ  ´Ù½Ã ¿Ã·ÁÁÖ¼¼¿ä.");
			return false;
		}		
		
		if ( getFileSize( file) > sizeLimit * 1024 * 1024)	{
			alert( sizeLimit + "MB¸¦ ÃÊ°úÇÏ´Â ÆÄÀÏÀº ¾÷·ÎµåÇÒ ¼ö ¾ø½À´Ï´Ù.");
			return false;
		}
	
		file = file.replace( /\\/g, "\\\\");
		return true;
	}


	/**
	 *	ÁÖ¼ÒÃ£±â ÆË¾÷Ã¢ ¿­±â
	 */
	function addrPopup()	{
		var theWin = window.open( "/Address", "pop_zipcode", "width=470,height=250,top=300,left=300,scrollbars=yes");	
		theWin.focus();
	}
	
	function addrPopup2(code)	{
		var theWin = window.open( "/Address?addrstr="+code, "pop_zipcode", "width=470,height=250,top=300,left=300,scrollbars=yes");	
		theWin.focus();
	}
	
	
	/**
	 *	¼ýÀÚÀÎÁö ¿©ºÎ¸¦ ¸®ÅÏ.
	 */
	function isNumber( arg) {
		for (i =0 ; i < arg.length; i++) {

			if (arg.charCodeAt(i) < 48 || arg.charCodeAt(i) > 57) {
				return false;
			}
		}
		return true;
	}
	
	
	/**
	 *	°³ÀÎÁ¤º¸ µ¿ÀÇ¼­ µ¿ÀÇ 
	 */
	function checkPrivate()	{
        if ( document.Form.if_agree.checked == false) {
            alert( "°³ÀÎÁ¤º¸ Á¦°ø¼­¿¡ µ¿ÀÇÇÏ¼Å¾ß ÀÀ¸ðÇÏ½Ç¼ö ÀÖ½À´Ï´Ù.");
            return;
        }
        
        opener.if_agree = true;
        self.close();
    }
    
    /**
     *	°³ÀÎÁ¤º¸ µ¿ÀÇ¼­ Ãë¼Ò
     */
    function cancelPrivate()	{
		if ( confirm( "Ãë¼ÒÇÏ½Ã¸é ÀÌº¥Æ® ÀÀ¸ð°¡ µÇÁö ¾Ê½À´Ï´Ù.  Ãë¼ÒÇÏ½Ã°Ú½À´Ï±î?"))
			self.close();
    }
    
    
    /**
     *	separator·Î ±¸ºÐµÈ ½ºÆ®¸µÀ» ÅëÇÕ
     */
	function splitString( stringToSplit, separator ) {
	    var arrayOfStrings = new Array();
	
	    if( stringToSplit != "" )
	        arrayOfStrings = stringToSplit.split(separator);
	
	    return arrayOfStrings.join("");
	}
	
    
	/*	ÁÖ¹Î¹øÈ£ À¯È¿¼º Ã¼Å© */
	function chkSSN( ssn) {
		var resno = splitString( ssn, "-");
		if ( resno.length != 13)
			return false;	
		
		// ÁÖ¹Î¹øÈ£ÀÇ ÇüÅÂ¿Í 7¹øÂ° ÀÚ¸®(¼ºº°) À¯È¿¼º °Ë»ç
		fmt = /^\d{6}[1234]\d{6}$/;
		if ( !fmt.test( resno)) 
			return false;
		
		// ³¯Â¥ À¯È¿¼º °Ë»ç
		birthYear = ( resno.charAt( 7) <= "2") ? "19" : "20";
		birthYear += resno.substr( 0, 2);
		birthMonth = resno.substr( 2, 2) - 1;
		birthDate = resno.substr( 4, 2);
		birth = new Date( birthYear, birthMonth, birthDate);
		
		if ( birth.getYear() % 100 != resno.substr( 0, 2) ||
		   birth.getMonth() != birthMonth ||
		   birth.getDate() != birthDate) 
			return false;
		
		// Check Sum ÄÚµåÀÇ À¯È¿¼º °Ë»ç
		buf = new Array(13);
		for ( i = 0; i < 6; i++) 
			buf[ i] = parseInt( resno.charAt( i));
		for ( i = 6; i < 13; i++) 
			buf[ i] = parseInt( resno.charAt( i));
		
		multipliers = [ 2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5];
		for ( i = 0, sum = 0; i < 12; i++) 
			sum += ( buf[i] *= multipliers[ i]);
		
		if ( ( 11 - ( sum % 11)) % 10 != buf[ 12]) 
			return false;
		
		return true;
	}

	/**
     *	°Ë»ö¿ë ·£´ýÇÔ¼ö
     */
	function randomForSearch(itemSize) {
	    var result = 0;
		result = Math.floor(Math.random() * itemSize)+1;
	    return result;
	}

	function getFileExt(fileName) {
		var fileNames = fileName.split(".");
		return fileNames && fileNames.length > 0 ? fileNames[fileNames.length - 1] : "";
	}
	/*
	 * input text Á¦ÇÑÇÏ´Â ÇÔ¼ö
	 * elem : Input Element
	 * counterElem : ÇöÁ¦ ±ÛÀÚ¼ö¸¦ ³ªÅ¸³»´Â element. ¾øÀ¸¸é null
	 * len : Á¦ÇÑÇÒ ±æÀÌ(byte)
	 */
function cal_pre(elem,counterElem,len) 
{ 
	var tmpStr; 
	var val = elem.value;
	tmpStr = new String(val); 
	cal_byte(val,elem,counterElem,len); 
} 
function cal_byte(aquery,elem,writeElem,len) { 
	var tmpStr; 
	var temp=0; 
	var onechar; 
	var tcount; 
	tcount = 0; 
	tmpStr = new String(aquery); 
	temp = tmpStr.length; 
	for (k=0;k<temp;k++) 
	{ 
		onechar = tmpStr.charAt(k); 
		if (escape(onechar).length > 4) { 
			tcount += 2; 
		} 
		else if (onechar!='\r') { 
			tcount++; 
		} 
	} 

	if(writeElem!=null)
		writeElem.innerHTML = tcount; 
	if(tcount>len) { 
		reserve = tcount-len; 
		alert("³»¿ëÀº "+len+"byte·Î Á¦ÇÑµË´Ï´Ù."); 
		cutText(tmpStr,elem,writeElem,len); 
		return; 
	} 
} 
function cutText(str,elem,writeElem,len) { 
	var tmpStr = str; 
	var szComplete = ""; 
	var tcount = 0; 
	var onechar; 
	
	for (k=0;k<tmpStr.length;k++) { 
		onechar = tmpStr.charAt(k); 
		if (escape(onechar).length > 4) { 
			tcount += 2; 
		} 
		else if (onechar!='\r') { 
			tcount++; 
		} 
		if (tcount > len) { 
			tmpStr = szComplete; 
			if(elem.value!=null)
				elem.value=tmpStr;
			else	
				elem.innerHTML=tmlStr;
			if(writeElem!=null)
				writeElem.innerHTML = len; 
			break; 
		} else { 
			szComplete = szComplete + onechar; 
		} 
	} 
} 

document.writeln("<script type=\"text/javascript\" src=\"http://daumevent.daum.net/include/prototype-1.6.0.2.js\"></script>");
