// JavaScript Document
		function open_addr(){
			var win = window.open("/Mypage/Address/Main.asp?Mode=Ecard", "addrwin", "width=700,height=500,scrollbars=no,resizable=no");
		}

		function addAddr() {
			var theForm = document.CardForm;
			if (theForm.rcvr_list.options[9] != null) {
				alert('µ¿º¸¸ÞÀÏ ¹ß¼ÛÀº ÃÖ´ë 10°³ÀÔ´Ï´Ù.');
				theForm.subject.focus();
				badCheck = true;
				return;
			}
			if (theForm.rcvr_name.value.length == 0) {
				alert('¹Þ´ÂÀÌ ÀÌ¸§ÀÌ ´©¶ôµÇ¾ú½À´Ï´Ù.');
				theForm.rcvr_name.focus();
				badCheck = true;
				return;
			}
			if (theForm.rcvr_email.value.length == 0) {
				alert('¹Þ´ÂÀÌ ÀÌ¸ÞÀÏÀÌ ´©¶ôµÇ¾ú½À´Ï´Ù.');
				theForm.rcvr_email.focus();
				badCheck = true;
				return;
			}
			if (!isCorrectEmail(theForm.rcvr_email.value)){
				alert('¹Þ´ÂÀÌÀÇ ÀÌ¸ÞÀÏ ÁÖ¼Ò¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
				theForm.rcvr_email.focus();
				badCheck = true;
				return;
			}
			if (theForm.rcvr_list.options[2] != null) theForm.rcvr_list.size = theForm.rcvr_list.size + 1;
			var e1 = document.createElement("OPTION");
			e1.text = theForm.rcvr_name.value + '<' + theForm.rcvr_email.value + '>';
			e1.value = theForm.rcvr_name.value + '<' + theForm.rcvr_email.value + '>';
			theForm.rcvr_list.options.add(e1);
			if (theForm.rcvr_group.value == "") {
				theForm.rcvr_group.value = theForm.rcvr_name.value + '<' + theForm.rcvr_email.value + '>'; 
			} else {
				theForm.rcvr_group.value = theForm.rcvr_group.value +"|"+ theForm.rcvr_name.value + '<' + theForm.rcvr_email.value + '>'; 
			}
			theForm.rcvr_name.value = '';
			theForm.rcvr_email.value = '';
			if (theForm.rcvr_list.options[9] != null) {
				theForm.rcvr_name.disabled = true;
				theForm.rcvr_email.disabled = true;
				theForm.subject.focus();;
			} else {
				theForm.rcvr_name.focus();
			}
			return;
		}
		function addAddr_Popup(Val) {
			var theForm = document.CardForm;
			if (theForm.rcvr_list.options[9] != null) {
				alert('µ¿º¸¸ÞÀÏ ¹ß¼ÛÀº ÃÖ´ë 10°³ÀÔ´Ï´Ù.');
				theForm.subject.focus();
				badCheck = true;
				return;
			}
			
			if (theForm.rcvr_list.options[2] != null) theForm.rcvr_list.size = theForm.rcvr_list.size + 1;
			var e1 = document.createElement("OPTION");
			e1.text = Val;
			e1.value = Val;
			theForm.rcvr_list.options.add(e1);

			if (theForm.rcvr_group.value == "") {
				theForm.rcvr_group.value = Val; 
			} else {
				theForm.rcvr_group.value = theForm.rcvr_group.value +"|"+ Val; 
			}
			return;
		}
		function delAddr() {
			var theForm = document.CardForm;
			theForm.rcvr_group.value = "";

			for (var i=0 ; i < 10;i++) {
				if (theForm.rcvr_list.options[i] == null) {
					alert("\n»èÁ¦ÇÏ·Á´Â ÁÖ¼Ò¸¦ ¼±ÅÃÇÏ°í »èÁ¦ ¹öÆ°À» ´©¸£¼¼¿ä.\n");
					return;
				}
				if (theForm.rcvr_list.options[i].selected) {
					if (theForm.rcvr_list.options[3] != null) theForm.rcvr_list.size = theForm.rcvr_list.size - 1;
					theForm.rcvr_list.options[i]=null;
					if (theForm.rcvr_list.options[9] == null) {
						theForm.rcvr_name.disabled = false;
						theForm.rcvr_email.disabled = false;
					}
					return;
				} else {
					if (theForm.rcvr_group.value == "") {
						theForm.rcvr_group.value = theForm.rcvr_list.options[i].value; 
					} else {
						theForm.rcvr_group.value = theForm.rcvr_group.value + theForm.rcvr_list.options[i].value; 
					}
					return;
					
				}
			}
		}

		function isCorrectEmail(email) {
			if(email.indexOf("@") <= 0) {
				return false;
			} else if(email.indexOf("/") > -1) {
				return false;
			} else if(email.indexOf(">") > -1) {
				return false;
			} else if(email.indexOf("<") > -1) {
				return false;
			} else if(email.indexOf(":") > -1) {
				return false;
			} else if(email.indexOf("\"\"") > -1) {
				return false;
			} else if(email.indexOf("..") > -1) {
				return false;
			}
			return true;
		}

		function openWinBGImage(){
			var win = window.open("/Popup/CardBackgroundImage.asp", "open", "width=420,height=420,scrollbars=yes,resizable=no");
		}

		function setBImage(imagecode) {
			document.BgForm.preBgImg.style.backgroundImage='url(http://image.send2u.net/background/' + imagecode + ')';
			opener.document.CardForm.bgimg.value = imagecode;
			opener.document.CardForm.content.style.backgroundImage = 'url(http://image.send2u.net/background/' + imagecode + ')';
			return;
		}

		function setBImageNo(imageno) {
			opener.document.CardForm.bgimgno.value = imageno;
			return;
		}

		function fontsize(fontsize) {
			document.CardForm.content.style.fontSize = fontsize + 'pt';
			document.CardForm.fsize.value = fontsize;
		}

		function fontname(fontname) {
			document.CardForm.content.style.fontFamily = fontname;
			document.CardForm.fname.value = fontname;
		}

		function DispColor(strColor) {
			document.CardForm.fcolor.value=strColor;
			document.CardForm.content.style.color=strColor;
			//document.CardForm.selected_color.style.background=strColor;
		}

		function dispColorDir() {
			var strColor
			strColor=document.CardForm.dfcolor.value;
			document.CardForm.fcolor.value=strColor;
			document.CardForm.content.style.color=strColor;
			//document.CardForm.selected_color.style.background=strColor;
		}

		function checkForm(theForm){
			if(theForm.CardName.value.length == 0){
				alert('Ä«µå¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.');
				return false;
			}
			if(theForm.subject.value.length == 0){
				alert('Á¦¸ñÀ» ½á ÁÖ¼¼¿ä..');
				theForm.subject.focus();
				return false;
			}
			if(theForm.content.value.length == 0){
				alert('ÆíÁö ³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
				theForm.content.focus();
				return false;
			}
			if(theForm.content.value.length > 4000){
				alert('ÆíÁö ³»¿ëÀÌ 4000ÀÚ¸¦ ÃÊ°úÇÏ¿´½À´Ï´Ù (ÇöÀç : ' + theForm.content.value.length + 'ÀÚ)');
				theForm.content.focus();
				return false;
			}

			if(theForm.rcvr_name.value.length > 0 || theForm.rcvr_email.value.length > 0) {
				badCheck = false;
				addAddr();
				if (badCheck) return false;
			}
			if(theForm.rcvr_list.options[0] == null && theForm.rcvr_name.value.length == 0){
				alert('¹Þ´ÂÀÌ ÀÌ¸§ÀÌ ´©¶ôµÇ¾ú½À´Ï´Ù.');
				theForm.rcvr_name.focus();
				return false;
			}
			if(theForm.rcvr_list.options[0] == null && theForm.rcvr_email.value.length == 0){
				alert('¹Þ´ÂÀÌ ÀÌ¸ÞÀÏÀÌ ´©¶ôµÇ¾ú½À´Ï´Ù.');
				theForm.rcvr_email.focus();
				return false;
			}

			/*if (theForm.rcvr_list.options[0] != null) theForm.receiver1.value = theForm.rcvr_list.options[0].value;
			if (theForm.rcvr_list.options[1] != null) theForm.receiver2.value = theForm.rcvr_list.options[1].value;
			if (theForm.rcvr_list.options[2] != null) theForm.receiver3.value = theForm.rcvr_list.options[2].value;
			if (theForm.rcvr_list.options[3] != null) theForm.receiver4.value = theForm.rcvr_list.options[3].value;
			if (theForm.rcvr_list.options[4] != null) theForm.receiver5.value = theForm.rcvr_list.options[4].value;
			if (theForm.rcvr_list.options[5] != null) theForm.receiver6.value = theForm.rcvr_list.options[5].value;
			if (theForm.rcvr_list.options[6] != null) theForm.receiver7.value = theForm.rcvr_list.options[6].value;
			if (theForm.rcvr_list.options[7] != null) theForm.receiver8.value = theForm.rcvr_list.options[7].value;
			if (theForm.rcvr_list.options[8] != null) theForm.receiver9.value = theForm.rcvr_list.options[8].value;
			if (theForm.rcvr_list.options[9] != null) theForm.receiver10.value = theForm.rcvr_list.options[9].value;
		*/
			return true;
		}
	
		function fnEcardRun(type) {
			if (type == 1) {
				if(checkForm(document.CardForm)) {
					document.CardForm.CardMode.value = "Send";
					document.CardForm.target = "_self";
					document.CardForm.action='Ecard.asp';
					document.CardForm.submit();
				}
			}
			else if (type == 3) {
				window.open("http://home.ahnlab.com/community/popup_myv3.html","v","scrollbars=0,status=no,historycopy=no,resizable=no,width=436,height=459");
			}
		}	
		
		function fnPreviewRun()
		{
			opener.document.CardForm.CardMode.value = "Send";
			opener.document.CardForm.target = "_self";
			opener.document.CardForm.action='Ecard.asp';
			opener.document.CardForm.submit();
			window.self.close();
		}

		function fnPreview() {
			if(!checkForm(document.CardForm)) {
				return;
			}
			document.CardForm.CardMode.value = "Preview";
			window.open('', 'SendPreview','width=620,height=600,scrollbars=yes,resizable=no');
			document.CardForm.target = "SendPreview";
			document.CardForm.action = 'Preview.asp';
			document.CardForm.submit();
		}
		
		function autoAddAddr(rName, rEmail){
			var theForm = document.CardForm;

			if (theForm.rcvr_list.options[2] != null) theForm.rcvr_list.size = theForm.rcvr_list.size + 1;
			var e1 = document.createElement("OPTION");
			e1.text = rName + '<' + rEmail + '>';
			e1.value = rName + '<' + rEmail + '>';
			theForm.rcvr_list.options.add(e1);
			return;
		}

		function setAutoBImage(strUrl) {
			document.CardForm.content.style.backgroundImage = 'url('+strUrl+')';
		}

		function fnOpenFavorite(CardNo){
			window.open("/Popup/Favorite.asp?CardNo="+CardNo, "addrwin", "width=300,height=325,scrollbars=no,resizable=no");
		}

		function fnBoardClip(CardNo,CardNm) {
			window.open("/Popup/BoardClip.asp?CardNo="+CardNo+"&CardNm="+CardNm, "copy_win", "frame=no width=300 height=280");
		}
		function fnBoardBlog(CardNo,CardNm) {
			window.open("/Popup/BoardBlog.asp?CardNo="+CardNo+"&CardNm="+CardNm, "copy_win", "frame=no width=300 height=440");
		}
		
		function fnMessengerClip(CardNo,CardNm) {
			window.open("/Popup/MessengerClip.asp?CardNo="+CardNo+"&CardNm="+CardNm, "copy_win", "frame=no width=300 height=280");
		}
		function fnBoardCyworld(CardNo,CardNm) {
			window.open("/Popup/BoardCyworld.asp?CardNo="+CardNo+"&CardNm="+CardNm, "copy_win", "frame=no width=300 height=280");
		}

		
		function addAddr2(data) {
			theForm = document.CardForm;
			if (theForm.rcvr_list.options[9] != null) {
				alert('µ¿º¸¸ÞÀÏ ¹ß¼ÛÀº ÃÖ´ë 10°³ÀÔ´Ï´Ù.');
				return;
			}
			if (theForm.rcvr_list.options[2] != null) theForm.rcvr_list.size = theForm.rcvr_list.size + 1;
			var e1 = document.createElement("OPTION");
			e1.text = data;
			e1.value = data;
			theForm.rcvr_list.options.add(e1);
			if (theForm.rcvr_list.options[9] != null) {
				theForm.rcvr_name.disabled = true;
				theForm.rcvr_email.disabled = true;
			}
			return;
		}

		function addAddr3(data) {
			theForm = document.CardForm;
			if (theForm.rcvr_list.options[9] != null) {
				alert('µ¿º¸¸ÞÀÏ ¹ß¼ÛÀº ÃÖ´ë 10°³ÀÔ´Ï´Ù.');
				return;
			}
			if (theForm.rcvr_list.options[2] != null) theForm.rcvr_list.size = theForm.rcvr_list.size + 1;
			var e1 = document.createElement("OPTION");
			e1.text = data;
			e1.value = data;
			theForm.rcvr_list.options.add(e1);
			if (theForm.rcvr_list.options[9] != null) {
				theForm.rcvr_name.disabled = true;
				theForm.rcvr_email.disabled = true;
			}
			if (theForm.rcvr_group.value == "") {
				theForm.rcvr_group.value = data; 
			} else {
				theForm.rcvr_group.value = theForm.rcvr_group.value +"|"+ data; 
			}
			return;
		}
		
				
		function fnCreateControl(DIVID, CLSID, OBJID, OBJNM, SWFNM, WIDTH ,HEIGHT ){

			var d = document.getElementById(DIVID);
			var strHtml 
			strHtml		= '<OBJECT CLASSID='+ CLSID  +' CODEBASE=HTTP://DOWNLOAD.MACROMEDIA.COM/PUB/SHOCKWAVE/CABS/FLASH/SWFLASH.CAB#VERSION=4,0,2,0 ID='+ OBJID  +' NAME='+ OBJNM  +' WIDTH='+ WIDTH  +' HEIGHT='+ HEIGHT +'>';
			strHtml		= strHtml + '<PARAM		NAME=MOVIE		VALUE='+ SWFNM +'>';
			strHtml		= strHtml + '<PARAM		NAME=LOOP		VALUE=FALSE>';
			strHtml		= strHtml + '<PARAM		NAME=MENU		VALUE=FALSE>';
			strHtml		= strHtml + '<PARAM		NAME=QUALITY	VALUE=HIGH>';	 
			strHtml		= strHtml + '<EMBED  ';
			strHtml		= strHtml + '					SRC		='+ SWFNM  +' ';
			strHtml		= strHtml + '		WIDTH		='+ WIDTH  +' ';
			strHtml		= strHtml + '		HEIGHT		='+ HEIGHT +' ';
			strHtml		= strHtml + '		LOOP		=FALSE ';
			strHtml		= strHtml + '		MENU		=FALSE ';
			strHtml		= strHtml + '		QUALITY		=HIGH ';
			strHtml		= strHtml + '		TYPE		=APPLICATION/X-SHOCKWAVE-FLASH ';
			strHtml		= strHtml + '		NAME		='+ OBJNM  +' ';
			strHtml		= strHtml + '		SWLIVECONNECT	=TRUE';
			strHtml		= strHtml + '		PLUGINSPAGE	=HTTP://WWW.MACROMEDIA.COM/SHOCKWAVE/DOWNLOAD/INDEX.CGI?P1_PROD_VERSION=SHOCKWAVEFLASH';
			strHtml		= strHtml + '>';
			strHtml		= strHtml + '</EMBED>';
			strHtml		= strHtml + '</OBJECT>';

			d.innerHTML = strHtml

		}

		function fnCardReviewSubmit() {
			if( fnNullChk('text','CardReviewForm','CardReviewForm.CardAbout','½Ç½Ã°£¸®ÇÃÀ» ')==false ){return false;}
		}


		function fnReserve() {
			if (document.CardForm.Reserve.checked == true)
			{
				document.CardForm.send_yy.disabled = false;
				document.CardForm.send_mm.disabled = false;
				document.CardForm.send_dd.disabled = false;
			} else {
				document.CardForm.send_yy.disabled = true;
				document.CardForm.send_mm.disabled = true;
				document.CardForm.send_dd.disabled = true;
			}
		}