	/*--------------------------------------------------------------------------
	* PHP ³»ÀåÇÔ¼öÀÎ htmlspecialchars() ¸¦ ÀÚ¹Ù½ºÅ©¸³Æ®·Î º¯È¯ÇÑ°Í
	* '	(ÀÛÀºµû¿ÈÇ¥)	-> &#039;
	* " (Å«  µû¿ÈÇ¥)	-> &quot;
	* & ( ¾ÚÆÛ»÷µå )	-> &amp;
	* < ( º¸´ÙÀÛÀº )	-> &lt;
	* > ( º¸´Ù  Å« )	-> &gt;
	*-------------------------------------------------------------------------*/
	function HtmlSpecialChars (str)
	{
		ret_str = str;

		search = new Array (/'/g , /"/g , /&/g , /</g , />/g);

		replace = new Array ("&#039;" , "&quot;" , "&amp;" , "&lt;" , "&gt;");

		cnt = search.length;

		for(i=0; i<cnt; i++)
		{
			ret_str = ret_str.replace (search[i],replace[i]);
		}

		return ret_str;
	}

	function Nl2Br (str)
	{
		ret_str = str;

		search = /\r\n/g;

		replace = "<br>";

		ret_str = ret_str.replace(search,replace);

		return ret_str;
	}

	function Sp2Nbsp (str)
	{
		ret_str = str;

		search = / /g;

		replace = "&nbsp;";

		ret_str = ret_str.replace(search,replace);

		return ret_str;
	}

	function Tab2Nbsp16 (str)
	{
		ret_str = str;

		search = /\t/g;

		replace = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

		ret_str = ret_str.replace(search,replace);

		return ret_str;
	}

	/*--------------------------------------------------------------------------
	* <FORM name="form1" onSubmit="return chkForm(this)">
	* input tag¿¡ ´ëÇÑ ¼³¸í
	* <input
	*	type="text" 	//Çü½Ä
	*	name="id" 		//ÀÌ¸§
	*	hname="¾ÆÀÌµð" 	//ÇÑ±Û ÀÌ¸§
	*	pattern="regId" //¾î¶² Á¤±Ô½ÄÀ¸·Î Ã³¸®ÇÒÁö ¼±¾ð (pattern="/^[a-zA-Z]+$/")
	*	required 		//ÇÊ¼ö Ç×¸ñ¿¡ ¼³Á¤
	*   maxlength=10 	//±æÀÌ Á¦ÇÑ(byte)
	* >
	*-------------------------------------------------------------------------*/

	function FormGetElementName(obj)
	{
		if (obj.getAttribute("hname") != null) {
			return obj.hname;
		} else {
			return obj.name;
		}
	}

	function FormCheckPattern(obj,pattern,hname)
	{
		var regNum = /^[0-9]+$/;
		var regPhone =/^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/;
		var regMail =/^[_a-zA-Z0-9-]+@[._a-zA-Z0-9-]+\.[a-zA-Z]+$/;
		var regDomain =/^[.a-zA-Z0-9-]+.[a-zA-Z]+$/;
		var regAlpha =/^[a-zA-Z]+$/;
		var regHost =/^[a-zA-Z-]+$/;
		var regHangul =/[°¡-ÆR]/;
		var regHangulEng =/[°¡-ÆRa-zA-Z]/;
		var regHangulOnly =/^[°¡-ÆR]*$/;
		var regId = /^[a-zA-Z0-9_-]{4,10}$/;
		var regPasswd = /^[a-zA-Z0-9_-]{4,10}$/;
		var regDate =/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;



		pattern = eval(pattern);
		if(!pattern.test(obj.value)){
			alert("[" + hname + "] Ç×¸ñÀÇ Çü½ÄÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
			obj.focus();
			return false;
		}
		return true;
	}

	function StringLength(str)
	{
	//	return (str.length + (escape(str) + "/%u").match(/%u/g).length-1);
	    var l = 0;
	    for (var i=0; i<str.length; i++)
	    	l += (str.charCodeAt(i) > 128) ? 2 : 1;
	    return l;
	}

	function FormGetElementLength(obj,len,hname)
	{
		if(StringLength(obj.value) > len){
			alert("[" + hname + "] Ç×¸ñÀº " + "ÃÖ´ë " + len + "byte·Î ÀÔ·ÂÀÌ Á¦ÇÑµÇ¾î ÀÖ½À´Ï´Ù.\n\n(¿µ¹®¼ýÀÚ1byte,ÇÑ±Û2byte·Î °è»ê)");
			obj.focus();
			return false;
		}

		return true;
	}

	function FormCheckText(obj, hname)
	{
		if(obj.value.length < 1){
			if (obj.tagName.toUpperCase() == "SELECT")
				alert("[" + hname + "] Ç×¸ñÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä.");
			else
				alert("[" + hname + "] Ç×¸ñÀ» ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿ä.");

			obj.focus();
			return false;
		}
		return true;
	}

	function FormCheckSelect(obj, hname)
	{
		if(obj.value.length < 1){
			alert("[" + hname + "] Ç×¸ñÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä.");
			obj.focus();
			return false;
		}
		return true;
	}

	function FormCheckCheckbox(form, ele, hname)
	{
		obj = eval(form.name+'.'+ele.name);
		if (!obj.checked){
			alert("[" + hname + "] Ç×¸ñÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä.");
			obj.focus();
			return false;
		}
		return true;
	}

	function FormCheckRadio(form, ele, hname)
	{
		obj = eval(form.name+'.'+ele.name);
		for (i=0;i<obj.length;i++) {
			if (obj[i].checked)
				return true;
		}
		alert("[" + hname + "] Ç×¸ñÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä.");
		obj.focus();
		return false;
	}

	function FormValidate(f)
	{
		var i,currEl;

		for(i = 0; i < f.elements.length; i++){
			currEl = f.elements[i];

			//ÇÊ¼ö Ç×¸ñÀ» Ã¼Å©ÇÑ´Ù.
			if (currEl.getAttribute("required") != null){
				if(currEl.type.toUpperCase() == "TEXT" || currEl.tagName.toUpperCase() == "SELECT" || currEl.tagName.toUpperCase() == "TEXTAREA" ||currEl.type.toUpperCase() == "PASSWORD" || currEl.type.toUpperCase() == "FILE" || currEl.type.toUpperCase() == "HIDDEN"){
					if(!FormCheckText(currEl,FormGetElementName(currEl)))
						return false;
				}
				else if(currEl.type.toUpperCase() == "CHECKBOX"){
					if(!FormCheckCheckbox(f, currEl,FormGetElementName(currEl)))
						return false;
				}
				else if(currEl.type.toUpperCase() == "RADIO"){
					if(!FormCheckRadio(f, currEl,currEl.hname))
						return false;
				}
			}

			// ±æÀÌ Á¦ÇÑÀ» Ã¼Å©ÇÑ´Ù.
			if(currEl.type.toUpperCase() == "TEXT" || currEl.tagName.toUpperCase() == "TEXTAREA" ||currEl.type.toUpperCase() == "PASSWORD") {
				if(currEl.getAttribute("maxlength") != null && currEl.value.length > 0){
					if(!FormGetElementLength(currEl,currEl.getAttribute("maxlength"),FormGetElementName(currEl))) {
						return false;
					}
				}
			}

			// ÀÔ·Â ÆÐÅÏÀ» Ã¼Å©ÇÑ´Ù.
			if(currEl.getAttribute("pattern") != null && currEl.value.length > 0){
				if(!FormCheckPattern(currEl,currEl.pattern,FormGetElementName(currEl)))
					return false;
			}
		}

		return true;
	}


	function FormValidate_preview(f)
	{
		var i,currEl;

		for(i = 0; i < f.elements.length; i++){
			currEl = f.elements[i];

			//ÇÊ¼ö Ç×¸ñÀ» Ã¼Å©ÇÑ´Ù.
			if (currEl.getAttribute("required") != null){
				if(currEl.type.toUpperCase() == "TEXT" || currEl.tagName.toUpperCase() == "SELECT" || currEl.tagName.toUpperCase() == "TEXTAREA" ||currEl.type.toUpperCase() == "PASSWORD" || currEl.type.toUpperCase() == "FILE" || currEl.type.toUpperCase() == "HIDDEN"){
					if(!FormCheckText(currEl,FormGetElementName(currEl)))
						return false;
				}
				else if(currEl.type.toUpperCase() == "CHECKBOX"){
					if(!FormCheckCheckbox(f, currEl,FormGetElementName(currEl)))
						return false;
				}
				else if(currEl.type.toUpperCase() == "RADIO"){
					if(!FormCheckRadio(f, currEl,currEl.hname))
						return false;
				}
			}

			// ±æÀÌ Á¦ÇÑÀ» Ã¼Å©ÇÑ´Ù.
			if(currEl.type.toUpperCase() == "TEXT" || currEl.tagName.toUpperCase() == "TEXTAREA" ||currEl.type.toUpperCase() == "PASSWORD") {
				if(currEl.getAttribute("maxlength") != null && currEl.value.length > 0){
					if(!FormGetElementLength(currEl,currEl.getAttribute("maxlength"),FormGetElementName(currEl))) {
						return false;
					}
				}
			}

		}

		return true;
	}

	// ±â»ç ¸ÞÀÏ·Î º¸³»±â
	function mailto(id)
	{
		window.open('/exec/mailto.php?act=form&id='+id, 'mailto', 'width=490, height=370, scrollbars=no');
	}

	// ±â»ç ÇÁ¸°Æ®
	function print(id)
	{
		window.open('/exec/print.php?id='+id, 'print', 'width=520, height=600, scrollbars=yes');
	}

	// ¸¶ÀÌ ´º½º
	function mynews(id, cate_id, cate, kind, title, cate_url, prog_url, link2, link)
	{	
		window.open('/exec/mynews.php?mode=insert&id='+id+'&cate_id='+cate_id+'&cate='+cate+'&kind='+kind+'&title='+title+'&cate_url='+cate_url+'&prog_url='+prog_url+'&link2='+link2+'&link='+link, 'mynews', 'width=490, height=210, scrollbars=no');
	}

	/***************************************************************************
	* BBS ¿Í °ü·ÃµÈ µ¿¿µ»óÀ» ÇÃ·¹ÀÌ ÇÏ±â À§ÇÑ ÇÔ¼ö
	* bid	= °Ô½ÃÆÇ Å×ÀÌºí ÀÌ¸§
	* id	= °Ô½Ã¹°ÀÇ ¹øÈ£
	* url	= µ¿¿µ»óÀÇ URL
	* caption = ÀÌ µ¿¿µ»ó°ú °ü·ÃµÈ ´ëº»ÀÌ ÀÖÀ»°æ¿ì(1),¾øÀ»°æ¿ì(0)
	***************************************************************************/
	function bbs_play(bid,id,url,caption)
	{
		// ¿©±â¼­ µ¿¿µ»ó ÇÃ·¹ÀÌ¾î¸¦ »õÃ¢À¸·Î È£ÃâÇÑ´Ù.
		url = url.replace(/^\//,"");
		url = url.replace(/\.[a-z]{1,}$/,"");
		url = url.replace(/\//g,"$");
//		alert(url);return;
//		url = "http://newsdev.kbs.co.kr:8080/vod_view_bbs.php?bid="+bid+"&id="+id+"&url="+url+"&kind=bbs";
//		url = "http://news.kbs.co.kr/asx.php?bid="+bid+"&id="+id+"&url="+url+"&kind=bbs";

		var player_url = 'http://news.kbs.co.kr/asx/news_player2.htm';
		player_url += '?bid=' + bid;
		player_url += '&id=' + id;
		player_url += '&url=' + url;
		player_url += '&kind=bbs';

		var opt = 'width=673, height=516, resizable=yes, status=0, scrollbars=0, menubar=no, toolbar=no, fullscreen=no, channelmode=no,location=no,directories=no,alwaysRadised=0';
		var win = window.open(player_url, 'KBS_Player', opt);
		win.window.focus();

		/*
		opt_args = ",resizable=no,status=0,scrollbars=0,menubar=no,toolbar=no,fullscreen=no,channelmode=no,location=no,directories=no,alwaysRadised=0";
		if(caption == 1)
		{
			width = 670;
			height = 510;
			window.open(url,'new_player','width='+width+',height='+height+opt_args);
		}
		else
		{
			width = 348;
			height = 510;
			window.open(url,'new_player','width='+width+',height='+height+opt_args);
		}
		*/
	}
	
	function news_play(news_id, kind, video_link, title, mode)
	{
		var player_url = 'http://news.kbs.co.kr/asx/news_player2.htm';
		player_url += '?title=' + title;
		player_url += '&kind=' + kind;
		player_url += '&id=' + news_id;
		player_url += '&url=' + video_link;
		player_url += '&mode=' + mode;
	
		// Æ¯Áý¿ë ¼Óº¸µ¿¿µ»óÀº ´ëº»º¸±â&ÃÖ½Å¸ñ·Ï ³ëÃâÇÏÁö ¾ÊÀ¸¹Ç·Î Ã¢Å©±â¸¦ ºÐ±âÇÑ´Ù
		//modified by allou at 20050711
		//var opt = 'width=673, height=516, resizable=yes, status=0, scrollbars=0, menubar=no, toolbar=no, fullscreen=no, channelmode=no,location=no,directories=no,alwaysRadised=0';
		var opt = '';
		if(kind == 'quick') {
			opt = 'width=363, height=516, resizable=yes, status=0, scrollbars=0, menubar=no, toolbar=no, fullscreen=no, channelmode=no,location=no,directories=no,alwaysRadised=0';
		} else {
			opt = 'width=673, height=516, resizable=yes, status=0, scrollbars=0, menubar=no, toolbar=no, fullscreen=no, channelmode=no,location=no,directories=no,alwaysRadised=0';
		}

		var win = window.open(player_url, 'KBS_Player', opt);
		win.window.focus();
	}
	
/*
	function news_play(news_id, kind, video_link, title, mode)
	{
		var player_url = '/asx/news_player2_tmp.htm';
		player_url += '?title=' + title;
		player_url += '&kind=' + kind;
		player_url += '&id=' + news_id;
		player_url += '&url=' + video_link;
		player_url += '&mode=' + mode;
		
		var opt = 'width=697, height=515, resizable=no, status=0, scrollbars=0, menubar=no, toolbar=no, fullscreen=no, channelmode=no,location=no,directories=no,alwaysRadised=0';
		var win = window.open(player_url, 'KBS_Player', opt);
		win.window.focus();
	}
*/	

	/***************************************************************************
	* ÀÌ¹ÌÁö º¸±â ÇÁ·Î±×·¥À» ·ÐÄª
	* src		= ÀÌ¹ÌÁö °æ·Î + ÀÌ¸§
	* subject	= ÀÌ¹ÌÁö Ä¸¼Ç
	***************************************************************************/
	function image_view(src,sbj)
	{
		window.open("/bbs/exec/image_view.php?src="+src+"&subject="+sbj,'_blank','width=500,height=350,scrollbars=1,status=1,resizable');
	}

	/***************************************************************************
	* BBS ÀÌ¸ÞÀÏ·Î ¹Þ¾Æº¸±â
	* bid		= °Ô½ÃÆÇÀÇ Å×ÀÌºí ÀÌ¸§
	* id		= °Ô½Ã¹°ÀÇ ¹øÈ£ (bulletin_number)
	***************************************************************************/
	function bbs_email(bid,id)
	{
		bid = "tb_" + bid;
		window.open('/exec/mailto_bbs.php?act=form&bid='+bid+'&id='+id, 'print', 'width=490, height=370, scrollbars=no');
	}

	/***************************************************************************
	* BBS ÇÁ¸°Æ®ÇÏ±â
	* bid		= °Ô½ÃÆÇÀÇ Å×ÀÌºí ÀÌ¸§
	* id		= °Ô½Ã¹°ÀÇ ¹øÈ£ (bulletin_number)
	***************************************************************************/
	function bbs_print1(bid,id)
	{
		window.open('/exec/print_bbs.php?bid='+bid+'&id='+id, 'print', 'width=520, height=600, scrollbars=yes');
	}
	function bbs_print(bid,id)
	{
		bid = "tb_" + bid;
		window.open('/exec/print_bbs.php?bid='+bid+'&id='+id, 'print', 'width=520, height=600, scrollbars=yes');
	}

	/***************************************************************************
	* ¿Ü±¹¾î(´º½º) »çÀÌÆ®·Î ÀÌµ¿ÇÏ±â
	* idx		= ¿Ü±¹¾î »çÀÌÆ® Index
	***************************************************************************/
	function go_rki(idx)
	{
		var rki_url = document.rki.mode.options[idx].value;

		if(rki_url != "")
			document.location = rki_url;
	}


	/***************************************************************************
	* ÆË¾÷Ã¢ :: »èÁ¦Á¤Ã¥°íÁö
	***************************************************************************/
	function ShowDeletePolicy()
	{
		window.open('/borad_rule.html','_blank','width=517,height=600,scrollbars=1');
	}

	/***************************************************************************
	* ÆË¾÷Ã¢ :: ÀÌÀü °Ô½ÃÆÇ °¡±â
	***************************************************************************/
	function old_bbs(url)
	{
		window.open(url,'_blank','width=620,height=550,scrollbars=1,resizable,status=1');
	}

	/***************************************************************************
	* ÆË¾÷Ã¢ ¶ç¿ì±â
	***************************************************************************/
	function pop_win(pop_width, pop_height, pop_url)
	{
		var pop_opt = 'resizable=yes, status=0, scrollbars=0, menubar=no, toolbar=no, fullscreen=no, channelmode=no,location=no,directories=no,alwaysRadised=0';
		if(!isNaN(pop_width)) pop_opt += ', width='+pop_width;
		if(!isNaN(pop_height)) pop_opt += ', height='+pop_height;
		
		var win = window.open(pop_url, 'KBS_pop', pop_opt);
		win.window.focus();
	}

	/***************************************************************************
	* ·¹ÀÌ¾î(DIV) º¸ÀÌ±â/¼û±â±â 
	***************************************************************************/
	function MM_showHideLayers2() 
	{ //v6.0
		var i,p,v,obj,args=MM_showHideLayers2.arguments;
	
		for (i=0; i<(args.length-2); i+=3) {
			if ((obj=MM_findObj(args[i]))!=null) { 
				v=args[i+2];
				if (obj.style) { 
					v = (v == 'show') ? '' : 'none'; 
					obj.style.display = v;
				}
			}
		}
	}

