
// ÃÖ»óÀ§ Ã¼Å© ·ÎÁ÷(chars·Î ³Ñ±ä °ªÀÌ ÀÖ´Ù¸é true)

    function containsCharsOnly(input,chars) {
        for (var inx = 0; inx < input.length; inx++) {

            if (chars.indexOf(input.charAt(inx)) == -1)

                return false;

        }

        return true;

    }

//// ±Û¾²±â Ã¼Å© 


function chk(){

	if (document.form.title.value==false){
		alert('Á¦¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä.');
		document.form.title.focus();
		return false;
	}

	if(document.form.use_vchr.value=="1"){//Ä«Å×°í¸®
		if (document.form.cate.value==false){
			alert('Ä«Å×°í¸®¸¦ ¼±ÅÃÇÏ¼¼¿ä.');
			document.form.cate.focus();
			return false;
		}
	}

	if (document.form.name.value==false){
		alert('ÀÛ¼ºÀÚ¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		document.form.name.focus();
		return false;
	}

	if (document.form.name.value.indexOf('<',0) != -1){
	alert('ÀÛ¼ºÀÚ¸¦ ÀÔ·Â ¸øÇÏ´Â ±ÛÀÚ¸¦ ÀÔ·Â ÇÏ¼Ì±º¿ä.')
	document.form.name.focus()
	return false;
	}

	if (document.form.pwd.value==false){
		alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		document.form.pwd.focus();
		return false;
	}
  

	if (document.form.email.value!=false){
	 var objEmail = document.form.email; //eval(FromAddr) ;
	 var szEmail = objEmail.value ;
	 var regDoNot = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
	 var regMust = /^[a-zA-Z0-9\-\.\_]+@[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3})$/;

		 if ( !regDoNot.test(szEmail) && regMust.test(szEmail) ){
		}else{
		alert('ÀÌ¸ÞÀÏÁÖ¼Ò°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù!');
		objEmail.focus() ;
		return false;
		}
	}

if (document.form.maintext.value==false){
		alert('³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.');
		document.form.maintext.focus();
		return false;
	}

	document.all.submit_btn.style.display = "none";
	document.all.wait_btn.style.display = "";

}

//¿¡µðÅÍ¿ë Ã¼Å©(À½¾Ç°Ô½ÃÆÇ)
function chk_fck(){

	if (document.form.title.value==false){
		alert('Á¦¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä.');
		document.form.title.focus();
		return false;
	}

	if(document.form.use_vchr.value=="1"){//Ä«Å×°í¸®
		if (document.form.wcate.value==false){
			alert('Ä«Å×°í¸®¸¦ ¼±ÅÃÇÏ¼¼¿ä.');
			document.form.wcate.focus();
			return false;
		}
	}

	if (document.form.name.value==false){
		alert('ÀÛ¼ºÀÚ¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		document.form.name.focus();
		return false;
	}

	if (document.form.name.value.indexOf('<',0) != -1){
	alert('ÀÛ¼ºÀÚ¸¦ ÀÔ·Â ¸øÇÏ´Â ±ÛÀÚ¸¦ ÀÔ·Â ÇÏ¼Ì±º¿ä.')
	document.form.name.focus()
	return false;
	}

	if (document.form.pwd.value==false){
		alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		document.form.pwd.focus();
		return false;
	}
  


	document.all.submit_btn.style.display = "none";
	document.all.wait_btn.style.display = "";

}

function chg_cate(cval,url){//Ä«Å×°í¸® Ã¼ÀÎÁö½Ã º¯°æ
location.href=url+"?cate="+cval;
}




///////////////////
///  ¿¡·¯ Ã¼Å©
/////////////////


function err_chk(){
alert("±ÇÇÑÀÌ ¾ø½À´Ï´Ù.\n°ü¸®ÀÚ¿¡°Ô ¹®ÀÇÇÏ¼¼¿ä.");
}


//////////////////////////////
// ÆÐ½º¿öµå ÀÔ·ÂÃ¼Å©

//////////////////////////

function pwd_chk(){

	if(document.form.pwd.value==false){
	alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
	document.form.pwd.focus();
	return false;
	}
	document.form.submit();
}

//////////////////////////
		//°Ë»ö Æû Ã¼Å©ÇÏ±â
//////////////////////////
function search_chk(){
if (document.search_form.searchstring.value==false){
		alert('°Ë»ö³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.');
		document.search_form.searchstring.focus();
		return false;
	}
	document.search_form.submit();
}

///////////////////////¿øº» ÀÌ¹ÌÁöÅ©±â·Î »õÃ¢¶ì¿ì±â

function gogo(){
setTimeout("gogo()",100);
window.resizeTo(img1.width+10,img1.height+29);
//window.moveTo((screen.width-img1.width)/2,(screen.height-img1.height)/2);

}


//ÀÌ¹ÌÁö Å©±â¿¡ ¸Â°Ô ¶ç¿ì±â #2
function ZoomWin(imgPath)
{
	//alert(imgPath);
	newWin=window.open("./zoomwin.php?img="+imgPath,"Detail_view","width=20,height=10,scrollbars=0,resizable=0,left=50,top=50");
	if (newWin !=null)
	{
		newWin.opener=self;
	}
	newWin.focus();
}

///////////////////////////////////


//ÀÌ¹ÌÁöÆÄÀÏ ´Ù¿î¹Þ±â


/////////////////////////////////////
function FileDown(bbs_name,dwname,dwdir)
{
	
	location.href="../download.php?bbs_name="+bbs_name+"&filename="+dwname+"&filedir="+dwdir+"";
	return;
}

function FileDown_user(bbs_name,dwname,dwdir)
{
	
	location.href="../board/download.php?bbs_name="+bbs_name+"&filename="+dwname+"&filedir="+dwdir+"";
	return;
}

function FileDown1(board,filename,filedir)
	{
		location.href="../download1.php?bbs_name="+board+"&filedir="+filedir+"&filename="+filename;
		return;
	}


////////////////////////////////////

///ÀÌ¹ÌÁöÆÄÀÏ¿Ã¸®±â Ã¼Å©

///////////////////////////
function CkImageVal() {
	var oInput = event.srcElement;
	var fname = oInput.value;
	//alert(fname);
	if((/(.jpg|.jpeg|.gif|.png)$/i).test(fname)){
		oInput.parentElement.children[0].src = fname;
	}else{
		alert('ÀÌ¹ÌÁöÆÄÀÏÀ» ¾÷·Îµå½Ã gif, jpg, png ÆÄÀÏ¸¸ °¡´ÉÇÕ´Ï´Ù.');
	return false;
	}
	}

function PreviewImage() 
{
	var oInput = event.srcElement;
	var fname = oInput.value;

	if(!(/(.jpg|.jpeg)$/i).test(fname))
	{
	  alert('ÀÌ¹ÌÁö´Â jpg ÆÄÀÏ¸¸ °¡´ÉÇÕ´Ï´Ù.');
	  return false;
	}
	
	return true;
}

///////////////////////////
	//Ã¼Å©¹Ú½º ¼±ÅÃ ÇÏ±â
//////////////////////////
function allcheck(theform)
{
	var check_box=theform["check[]"]; 
	if(!check_box)
	{
	alert('°ªÀÌ ¾ø½À´Ï´Ù.');
	    return false;
	}
	for(var i=0; i<check_box.length;i++)
	{
		var ele = check_box[i];
		if(ele.checked == false)
		{
			ele.checked = true;
		}	
	}
	return;
}


//¼±ÅÃÃë¼Ò
function discheck(theform)
{
	for( var i=0; i<theform.elements.length; i++) 
	{
		var ele = theform.elements[i];
		if(ele.name == 'check[]')
			ele.checked = false;
	}
	return;
}


//¼±ÅÃºÎºÐ ¹ÝÀü
function invert_check(theform)
{
	for( var i=0; i<theform.elements.length; i++) 
	{
		var ele1 = theform.elements[i];
		if(ele1.name == 'check[]')
		{
			if(ele1.checked == true)
			{
				ele1.checked = false;
			} 
			else 
			{
				ele1.checked = true;
			}
		}
		
	}
	return;
}

/////////////¼±ÅÃ±Û »èÁ¦

function delall(theform)
 { 
var check_box=theform["check[]"]; 
	
		for(var i=0; i<check_box.length;i++)
		{
			var ele = check_box[i];
			if(ele.checked == true)	break;		
		}
	if(i==check_box.length)
		{
			alert('¼±ÅÃÀ» ÇÏÁö ¾ÊÀ¸¼Ì½À´Ï´Ù.');
			return;
		}
 else 
   {
     if(confirm("¼±ÅÃµÈ ¸ðµç ±ÛÀÌ Áö¿öÁý´Ï´Ù."))
	  {
		theform.method="post";
	  theform.action="select_all_del_ok.php";
      theform.submit();
	  }
	 else
	  {
		
     return false;
	  }
   }
 } 




//°Ô½ÃÆÇÀÌµ¿ ½ºÅ©¸³Æ®
function write_go(url){
theform=document.form;
theform.action=url+"?mode=write#ltop";
theform.submit();
}

function list_go(url){
theform=document.form;
theform.action=url+"?mode=list#ltop";
theform.submit();
}

function edit_go(url){
theform=document.form;
theform.action=url+"?mode=edit#ltop";
theform.submit();
}

//°Ô½Ã±Û»èÁ¦
function del_go(idx,page,search,searchstring,bbs_name){
win=window.open('../board/'+bbs_name+'/board_del.php?idx='+idx+'&bbs_name='+bbs_name+'&search='+search+'&page='+page+'&searchstring='+searchstring+'','pwdchk','width=300,height=180');
}

//°Ô½Ã±Û»èÁ¦(À¯Àú¸ðµå°ü¸®ÀÚ¿ë)
function del_go_a(bbs_name){

vn_con = confirm('»èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?');
 if ( vn_con == true  )
 {
document.form.action="../board/"+bbs_name+"/board_del_ok.php";
document.form.submit();
 }

}

function del_con(){//°ü¸®ÀÚÆäÀÌÁö ±Û»èÁ¦

vn_con = confirm('»èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?');
 if ( vn_con == true  )
 {
document.form.action="board_del_ok.php";
document.form.submit();
 }

}

function del_con_c(idx,page,search,searchstring,cate){//°ü¸®ÀÚÆäÀÌÁö ±Û»èÁ¦(½ÅÃ»°î¼øÀ§)

vn_con = confirm('»èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?');
 if ( vn_con == true  )
 {
location.href="board_del_ok.php?idx="+idx+"&page="+page+"&search="+search+"&searchstring="+searchstring+"&cate1="+cate;
 }

}



//input¹Ú½º type=image ÀÏ°æ¿ì ÀÌ¹ÌÁö OnmouseOver È¿°ú ³»±â
//bt_name:input¹Ú½º name
//bt_url:¸¶¿ì½ºÀÌº¥Æ® ¹ß»ý½Ã ¹Ù²ð ÀÌ¹ÌÁö °æ·Î
function Bt_Input_Over(bt_name,bt_url){
var input_bt = document.getElementById(bt_name);
input_bt.src=bt_url;
}

//input¹Ú½º type=image ÀÏ°æ¿ì ÀÌ¹ÌÁö OnmouseOut È¿°ú ³»±â
function Bt_Input_Out(bt_name,bt_url){
var input_bt = document.getElementById(bt_name);
input_bt.src=bt_url;
}


function PageGo(page){
theform=document.form;
theform.page.value=page;
theform.action="./board_list.php?focus_move=m";
theform.submit();
}



/*********************** ÄÚ¸àÆ® °ü·Ã ½ºÅ©¸³Æ® ½ÃÀÛ******************/
function CoModi(name,comment_id){
theform=document.form;
theform.co_name.value=name;
theform.co_mode.value="edit";
theform.co_modeidx.value=comment_id;
document.getElementById('comment').value = document.getElementById('save_comment_' + comment_id).value;
}

function CoModi_ad(name,comment_id,pwd){
theform=document.form;
theform.co_name.value=name;
theform.co_pwd.value=pwd;
theform.co_mode.value="edit";
theform.co_modeidx.value=comment_id;
document.getElementById('comment').value = document.getElementById('save_comment_' + comment_id).value;
}

//°ü¸®ÀÚÆäÀÌÁö ÄÚ¸àÆ® ¼öÁ¤
function CoModi_a(name,comment_id){
theform=document.form;
theform.co_name.value=name;
theform.co_mode.value="edit";
theform.co_modeidx.value=comment_id;
document.getElementById('comment').value = document.getElementById('save_comment_' + comment_id).value;
document.getElementById("comm_save").src="./img/memo_modify2.gif";
document.getElementById("ncomment").style.display="block";
}


//ÄÚ¸àÆ® »èÁ¦
function CoDel(co_idx,idx,page,search,searchstring,bbs_name){
win=window.open('../board/'+bbs_name+'/comment_del.php?co_idx='+co_idx+'&idx='+idx+'&bbs_name='+bbs_name+'&search='+search+'&page='+page+'&searchstring='+searchstring+'','cpwdchk','width=300,height=180');
}

function CoDel_con(idx,bbs_name){//À¯Àú¸ðµå °ü¸®ÀÚ¿ë ÄÚ¸àÆ®»èÁ¦
	vn_con = confirm('»èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?');
 if ( vn_con == true  )
 {
document.form.action="../board/"+bbs_name+"/comment_del_ok.php?co_idx="+idx;
document.form.submit();
 }
}


function CoDel_a(idx,bbs_name){//°ü¸®ÀÚ¿ë
	vn_con = confirm('»èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?');
 if ( vn_con == true  )
 {
document.form.action="./comment_del_ok.php?co_idx="+idx;
document.form.submit();
 }
}

//ÄÚ¸àÆ® ¾²±â¿¡ °üÇÑ ½ºÅ©¸³Æ®
function comment_chk(bbs_name){
if (document.form.co_name.value==false){
alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä.");
document.form.co_name.focus();
return false;
}
if (document.form.co_pwd.value==false){
alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
document.form.co_pwd.focus();
return false;
}
if (document.form.comment.value==false){
alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
document.form.comment.focus();
return false;
}

document.form.action="../board/"+bbs_name+"/comment_write_ok.php"
document.form.submit();
}

//ÄÚ¸àÆ®¿¡ °üÇÑ ½ºÅ©¸³Æ® °ü¸®ÀÚ¿ë
function comment_chk_a(bbs_name){
if (document.form.co_name.value==false){
alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä.");
document.form.co_name.focus();
return false;
}
if (document.form.co_pwd.value==false){
alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
document.form.co_pwd.focus();
return false;
}
if (document.form.comment.value==false){
alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
document.form.comment.focus();
return false;
}
document.form.action="./comment_write_ok.php"
document.form.submit();
}

//°ü¸®ÀÚ¿¡¼­ ¼öÁ¤¸ðµå Çß´Ù°¡ ´Ù½Ã ¾²·ÁÇÒ¶§..
function New_comment_a(){
theform=document.form;
theform.co_name.value="";
theform.co_mode.value="write";
theform.co_modeidx.value="";
document.getElementById('comment').value = "";
document.getElementById("comm_save").src="./img/memo_ok.gif";
document.getElementById("ncomment").style.display="none";
}

/****************ÄÚ¸àÆ® °ü·Ã ½ºÅ©¸³Æ® ³¡*************************/




//fck¿¡µðÅÍ¿ë
function isNull( s ) { 
  if( s == null ) return true; 

  var result = s.replace(/(^\s*)|(\s*$)/g, ""); 

  if( result ) 
    return false; 
  else 
    return true; 
}

