function check_form() {
	if(document.write_form.title.value == "") {
		alert("Á¦¸ñÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä");
		document.write_form.title.focus();
		return;
	}
	if(document.write_form.name.value == "") {
		alert("ÀÌ¸§À» ÀÔ·ÂÇØÁÖ¼¼¿ä");
		document.write_form.name.focus();
		return;
	}
	var pmail = document.write_form.mail.value + "@" + document.write_form.mail_account.value;
	if(_check_email(pmail)) {
		alert(_check_email(pmail));
		document.write_form.mail.focus();
		return;
	}
	if(document.write_form.content.value == "") {
		alert("³»¿ëÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä");
		document.write_form.content.focus();
		return;
	}
	document.write_form.submit();
}

function check_form2() {
	if(document.write_form.title.value == "") {
		alert("Á¦¸ñÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä");
		document.write_form.title.focus();
		return;
	}
	if(document.write_form.name.value == "") {
		alert("ÀÌ¸§À» ÀÔ·ÂÇØÁÖ¼¼¿ä");
		document.write_form.name.focus();
		return;
	}
	if(document.write_form.pass.value == "") {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
		document.write_form.pass.focus();
		return;
	}
	var email = document.write_form.email.value;
	if(_check_email(email)) {
		alert(_check_email(email));
		document.write_form.email.focus();
		return;
	}
	if(document.write_form.content.value == "") {
		alert("³»¿ëÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä");
		document.write_form.content.focus();
		return;
	}
	document.write_form.submit();
}


function _check_email(email) {
       var pattern = /^(.+)@(.+)$/;
       var atom = "\[^\\s\\(\\)<>#@!$%^&*(),;:\\\\\\\"\\.\\[\\]\]+";
       var word="(" + atom + "|(\"[^\"]*\"))";
       var user_pattern = new RegExp("^" + word + "(\\." + word + ")*$");
       var ip_pattern = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
       var domain_pattern = new RegExp("^" + atom + "(\\." + atom +")*$");

       var arr = email.match(pattern);
       if (!arr) return "ÀÌ¸ÞÀÏ ÁÖ¼Ò°¡ ºÎÁ¤È®ÇÕ´Ï´Ù.. (check @ and .'s)";
       if (!arr[1].match(user_pattern)) return "¸ÞÀÏ°èÁ¤¸íÀÌ ºÎÁ¤È®ÇÕ´Ï´Ù..";

       var ip = arr[2].match(ip_pattern);
       if (ip) {
              for (var i=1; i<5; i++) if (ip[i] > 255) return "¸ÞÀÏÁÖ¼Ò°¡ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù.";
       }
       else {
              if (!arr[2].match(domain_pattern)) return "¸ÞÀÏÁÖ¼Ò°¡ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù..";
              var domain = arr[2].match(new RegExp(atom,"g"));
              if (domain.length<2) return "¸ÞÀÏÁÖ¼Ò°¡ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù..";
              if (domain[domain.length-1].length<2 || domain[domain.length-1].length>3)
                     return "¸ÞÀÏÁÖ¼Ò°¡ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù..";
       }
       return false; 
} // ÀÌ¸ÞÀÏ Ã¼Å© ÇÔ¼ö


function view(what) { 
	var imgwin = window.open("",'WIN','scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,width=10,height=10'); 
	imgwin.focus(); 
	imgwin.document.open(); 
	imgwin.document.write("<html>\n"); 
	imgwin.document.write("<head>\n"); 
	imgwin.document.write("<title>**</title>\n"); 

	imgwin.document.write("<sc"+"ript>\n"); 
	imgwin.document.write("function resize() {\n"); 
	imgwin.document.write("pic = document.il;\n"); 
	//imgwin.document.write("alert(eval(pic).height);\n"); 
	imgwin.document.write("if (eval(pic).height) { var name = navigator.appName\n"); 
	imgwin.document.write("  if (name == 'Microsoft Internet Explorer') { myHeight = eval(pic).height + 60; myWidth = eval(pic).width + 12;\n"); 
	imgwin.document.write("  } else { myHeight = eval(pic).height + 9; myWidth = eval(pic).width; }\n"); 
	imgwin.document.write("  clearTimeout();\n"); 
	imgwin.document.write("  var height = screen.height;\n"); 
	imgwin.document.write("  var width = screen.width;\n"); 
	imgwin.document.write("  var leftpos = width / 2 - myWidth / 2;\n"); 
	imgwin.document.write("  var toppos = height / 2 - myHeight / 2; \n"); 
	imgwin.document.write("  self.moveTo(leftpos, toppos);\n"); 
	imgwin.document.write("  self.resizeTo(myWidth, myHeight);\n"); 
	imgwin.document.write("}else setTimeOut(resize(), 100);}\n"); 
	imgwin.document.write("</sc"+"ript>\n"); 

	imgwin.document.write("</head>\n"); 
	imgwin.document.write('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF">\n'); 

	imgwin.document.write("<img border=0 src="+what+" xwidth=100 xheight=9 name=il onload='resize();' onClick='self.close();' style='cursor:hand;'>\n"); 
	imgwin.document.write("</body>\n"); 
	imgwin.document.close(); 
}  

function resizeImgWidth(imgObj, width) {
	var oldWidth = imgObj.width;
	var oldHeight = imgObj.height;
	if (oldWidth > width) {
		var newWidth = width;
		var newHeight = Math.round(oldHeight * newWidth / oldWidth);
		imgObj.wdith = newWidth;
		imgObj.height = newHeight;
	}
}

function check_search() {
	if(document.search_form.search.value == "") {
		alert("°Ë»öÁ¶°ÇÀ» ¼±ÅÃÇØÁÖ¼¼¿ä");
		return;
	}
	if(document.search_form.word.value == "") {
		alert("°Ë»öÇÒ ´Ü¾î¸¦ Àû¾îÁÖ¼¼¿ä");
		document.search_form.word.focus();
		return;
	}
	document.search_form.submit();
}

function del_qna(mode, num, page, search, word) {
	var conf;
	conf = confirm("Á¤¸» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?");

	if(conf) {
		self.location.href="pta_qna_process.php?mode="+mode+"&num="+num+"&page="+page+"&search="+search+"&word="+word;
	}
}
function Ndel() {
	alert("´ä±ÛÀÌ ÀÖ¾î »èÁ¦ÇÒ¼ö ¾ø½À´Ï´Ù.");
}

function preview(PreviewContent) {
	var obj = document.all["id_preview"];

	// check PreviewContent
	if(PreviewContent == "") {
		obj.innerHTML = "";
		return;
	}

	var text = "";
	text =  "<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
	text += "    <tr>";
	text += "        <td>";
	text += "            <td bgcolor='#FFFFFF' style='word-break:break-all; padding:5px;font-family: Arial; font-size: 9pt;'>" + PreviewContent + "</td>";
	text += "        </td>";
	text += "    </tr>";
	text += "</table>";

	obj.innerHTML = text;
	move_preview();
	obj.style.visibility = "visible";
}

function hide_preview() {
	document.all["id_preview"].style.visibility = "hidden";
}

function move_preview() {
	var obj = document.all["id_preview"];

	if(obj.innerHTML != "") {
		obj.style.posLeft = event.x - 40 + document.body.scrollLeft;
		obj.style.posTop = event.y + 20 + document.body.scrollTop;
	}
}

function BDDelete(no){
	if (document.read_form.pass.value==""){
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä")
		document.read_form.pass.focus();
		return;
	}
	document.read_form.num.value = no;
	document.read_form.submit();
}
		
function showTR(tv) {
	obj = document.all[tv];
	if (obj.style.display == "none") {
		obj.style.display = "block";
	}
	else {
		obj.style.display = "none";
	}
}

function go_read(no) {
	if(document.read_form.pass.value == "") {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
		document.read_form.pass.focus();
		return;
	}
	document.read_form.num.value = no;
	document.read_form.submit();
}

function playMovie(file) {
	document.write('<Embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/download/default.asp" src="'+file+'" width="400" height="295" id="MediaPlayer" Autostart="1" ShowControls="1" ShowDisplay="0" ShowStatusBar="1" DefaultFrame="Slide"></Embed>');
}