// ÄíÅ°µÇ´ÂÁö È®ÀÎ
if(!isEnCooked()){
	alert("ÇöÀç ÀÌ¿ëÀÚ´ÔÀÇ À¥ºê¶ó¿ìÀú°¡ ÄíÅ°¸¦ ÀÎ½Ä ¸øÇÏ°í ÀÖ½À´Ï´Ù, ÄíÅ°¸¦ À¥ºê¶ó¿ìÀú¿¡¼­ ÀÎ½ÄÇÏ°Ô ÇØÁÖ¼¼¿ä.");
}
function isEnCooked(){
	if(!navigator.cookieEnabled) return false;
	else return true;
}

// »õÃ¢¶ç¿ì±â
function win(path,name,width,height,scroll){
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	window.open(path,name,'width='+width+' height='+height+' scrollbars='+scroll+' left='+winl+' top='+wint);
}

// µ¡±Û»èÁ¦[°ü¸®ÀÚ]Ãâ·Â
function ad_win(path,name,width,height,scroll){
   var cfm = confirm('¼±ÅÃÇÏ½Å µ¡±ÛÀ» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?');
   if(cfm == false){
                    return;
   }     
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	window.open(path,name,'width='+width+' height='+height+' scrollbars='+scroll+' left='+winl+' top='+wint);
}

// µ¡±Û Ã¼Å©
function cmt_chk() {
	if(!document.cmts.content.value) {
		alert('µ¡±Û ³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		document.cmts.content.focus();
		return false;
	}
	document.cmts.submit.disabled=true
}

// Ä«Å×°í¸® ÀÌµ¿
function locat(id,ctgry) {
    location.replace('./board.php?id='+id+'&ctgry='+ctgry);
}

// ¸ÞÀÏº¸³»±â(¾Æ¿ô·è)
function outlook(nick,address) { 
	location.href='mailto:'+nick+'@'+address; 
} 

// ¿ì¶ìÄÜ
function viewWoti(){
	window.open('./chWoticon.php','new1file','width=418 height=440 scrollbars=yes');
}
/*
function viewImg(frm) {
     var cnt = frm.lastIndexOf(".");
	 var count = cnt + 1 ;
	 var ext = frm.substring(count);
     opener.Submit.wotiLink.value=frm;
	if(ext == 'gif' || ext == 'jpg' || ext == 'jpeg' || ext == 'png' || ext == 'bmp'){
	     opener.IMG_V.style.display = 'inline';
	     opener.MOV_V.style.display = 'none';
         opener.Submit.wotiImg.src=frm;
	}else if (ext == "wma" || ext == "wmv"  || ext == "wav" || ext == "mid" || ext == "asf" || ext == "asx" || ext == "swf" || ext == "mp3"){
	     opener.IMG_V.style.display = 'inline';
	     opener.MOV_V.style.display = 'none';
         opener.Submit.wotiImg.src="http:/¿ì¶ßº¸µå ÀÌ¹ÌÁö ¼­¹öÁÖ¼Ò/iconname/else/movie.gif";
	}else{
		alert("ÀÌ¹ÌÁö ¶Ç´Â µ¿¿µ»ó ÆÄÀÏÀÌ ¾Æ´Õ´Ï´Ù.");
	    document.submit.wotiLink.focus();
		return false;
	}
	 	 self.close();
}
function wotiConCh(img) {

    opener.Submit.wotiLink.value=img;
    opener.Submit.wotiImg.src=img;
	
	if(opener.Submit.woti_gu.value == "2"){
        opener.IMG_V.style.display = 'inline';
        opener.MOV_V.style.display = 'none';
    }
	self.close();
}
*/
function viewImg(frm,path) {
	if(path == ''){
		document.Submit.wotiLink.value='../emoticon/51.gif';
		frm.src = '../emoticon/51.gif';}
    else { frm.src=path;}
}


function wotiConCh(img) {
    opener.Submit.wotiLink.value=img;
    opener.Submit.wotiImg.src=img;
    self.close();
}

// MYINFO
function myinfo(ref){
	var winl = (screen.width - 710) / 2;
	var wint = (screen.height - 467) / 2;
   window.open('./login/board_myinfo.html?boardid='+ref,'myinfo', 'width=710 height=467 scrollbars=no left='+winl+' top='+wint);
}

// °Ô½ÃÆÇÈ¸¿ø°¡ÀÔ
function subjoin(uid){
	var winl = (screen.width - 320) / 2;
	var wint = (screen.height - 200) / 2;
    if(confirm(uid+' ´ÔÀÇ °Ô½ÃÆÇ¿¡ °¡ÀÔÇÏ½Ã°Ú½À´Ï±î?')) window.open('http://wo.to/member/jsub.html?upid='+uid,'subjoin', 'width=320 height=200 scrollbars=no left='+winl+' top='+wint);
	else alert('°Ô½ÃÆÇ È¸¿ø °¡ÀÔÀ» Ãë¼ÒÇÏ¼Ì½À´Ï´Ù.');
}

// ÆûÅ©±âÀÚµ¿Á¶Àý
function form_size(formc) {
	var s=formc.scrollHeight;
	if(s>=144) formc.style.pixelHeight=s+5;
    else formc.style.pixelHeight=144;
}

// ±Û¼Ó¼º Ã¼Å©
function html_mode(obj){
	if(!obj.checked) {
		obj.value = 'text';
	} else {
		var cfm = confirm("ÀÚµ¿ ÁÙ¹Ù²Þ(°³Çà)À» ÇÏ½Ã°Ú½À´Ï±î?");
	    if(cfm == true){
			obj.value = 'html';
        } else {
            obj.value = 'htmltext';
        }
	}
}

//±ÛÀÛ¼º Ã¼Å©
function frmChk(obj,obj2) {
    if(obj.html.checked == false){
		obj.html.value = 'text';
	}
	if(obj.uid.value == ''){
		alert('ÀÌ¸§(¾ÆÀÌµð)¸¦ ³Ö¾îÁÖ¼¼¿ä');		
		obj.uid.focus();  
		return false;
	}
	if(obj.uid.value.length > 15){
		alert('ÀÌ¸§(¾ÆÀÌµð)´Â 15ÀÚ ÀÌÇÏÀÌ¿©¾ß ÇÕ´Ï´Ù.(¿µ¹®ÀÚ ±âÁØ)');
		obj.uid.focus();  
		return false;
	}

	obj.pass.value = obj.pass.value.replace(/ /,'');
	if(obj.pass.value == ''){
		alert('ºñ¹Ð¹øÈ£¸¦ ³Ö¾îÁÖ¼¼¿ä!!');
		obj.pass.focus();  
		return false;
	}
	if(obj.pass.value.length > 15){
		alert('ºñ¹Ð¹øÈ£´Â 15ÀÚ ÀÌÇÏÀÌ¿©¾ß ÇÕ´Ï´Ù.(¿µ¹®ÀÚ ±âÁØ)');
		obj.pass.focus();  
		return false;
	}

	if(obj.title.value == ''){
		alert('Á¦¸ñÀ» ³Ö¾îÁÖ¼¼¿ä');
		obj.title.focus();  
		return false;
	}
	if(obj.title.value.length > 100){
		alert('Á¦¸ñÀº 100ÀÚ ÀÌÇÏÀÌ¿©¾ß ÇÕ´Ï´Ù.(¿µ¹®ÀÚ ±âÁØ)');
		obj.title.focus();  
		return false;
	}
	if(obj.ctgry_.value == 'ctgryNot'){
			alert('Ä«Å×°í¸®¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä'); 
			obj.ctgry_.focus(); 
			return false;
	}
	
	try {
		mode=1; 
		chk_mode();
	} catch(e) 	{
	}

	if(obj.body1.value == '' || obj.body1.value == '<P></P>'){
		alert('º»¹®¿¡ ³»¿ëÀÌ Á¸Àç ÇÏÁö ¾Ê½À´Ï´Ù.');
		obj.body1.focus();
		return false;
	}

	if(obj2) obj2.disabled = 'true';
	obj.submit();

}

// °Ô½Ã¹° µ¡±Û Ã¼Å©
function cmtChk(obj) {
	if(!obj.name.value) {
		alert('ÀÛ¼ºÀÚ¸íÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		obj.name.focus();
		return false;
	}
	if(!obj.pass.value) {
		alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		obj.pass.focus();
		return false;
	}
	if(!obj.content.value) {
		alert('³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		obj.content.focus();
		return false;
	}

	obj.submit();
}

// GET ÀÎÀÚ  ÃßÃâ
function getParameter(param) {
	var string = self.location.search;
	if (string.length == 0) {return '';}
	var sPos = string.indexOf(param + "=");
	if (sPos == -1) {return '';}
	sPos = sPos + param.length + 1;
	var ePos = string.indexOf('&', sPos);
	if (ePos == -1) {ePos = string.length;}
	return unescape(string.substring(sPos, ePos));
}

// ÀüÃ¼ ¼±ÅÃ
var allcheck = false;
function allchecked() {
    len = document.frm_l.elements.length;
    var i=0;
	if(allcheck == true) allcheck = false;
	else allcheck = true;
    for( i=0; i<len; i++) {
         document.frm_l.elements[i].checked=allcheck;
    }
}

// ¼±ÅÃ »èÁ¦
function delcheck(){
   var len = document.frm_l.elements.length;
   var chk;
   var id = getParameter('id');
   var ctgry = getParameter('ctgry');
   var pg = getParameter('pg');
   var search = getParameter('search');
   var select = getParameter('select');

   for(var i=0; i<len; i++) {
       if(document.frm_l.elements[i].checked) chk = 1;
   }

   if(!chk) { 
        alert('¼±ÅÃµÈ ±ÛÀÌ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.');
   } else {
   			document.frm_l.id.value = id;
			document.frm_l.pg.value = pg;
			document.frm_l.select.value = select;
			document.frm_l.search.value = search;
			document.frm_l.ctgry.value = ctgry;
 	       window.open("./action2.php?id="+ id + "&pg=" + pg + "&select=" + select + "&search=" + search + "&ctgry=" + ctgry ,'action2','width=300 height=168 scrollbars=yes');
   }

}

// ÆÄÀÏÃ³¸® ±³ÅëÁ¤¸®
// ¼­¹ö,½ÇÇàÇüÅÂ,key2,inum,ÀÌ¹ÌÁö°æ·Î[str5]
function attach_gubun(str,str2,str3,str4,str5){
	var srv = new Array('http://data.wo.to/pds/');
	if(str == "a"){
		str_tmp = srv[0]; //¼­¹öÀÇ À§Ä¡
    }
	if(str2 == "del"){
		attach_del(str_tmp,str3,str4,str5); // ÆÄÀÏ»èÁ¦
	}else if(str2 == "attach"){
    	attach(str_tmp,str3,str4,str5); // ÆÄÀÏÃ·ºÎ
	}
}

// ÆÄÀÏÃ·ºÎ
function attach(ref,str,str2,str5) {
     if (document.D_Submit.userfile.value == ""){ 
		   alert('Ã·ºÎ ÆÄÀÏÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.');
		   return;
	 } 

     if(document.D_Submit.file_list.length <=  document.D_Submit.default_file.value){ 
		   alert('°Ô½Ã¹°´ç ÃÖ´ë ÆÄÀÏ¼ö¸¦ ÃÊ°ú ÇÏ¿´½À´Ï´Ù.');
		   return;
	 } 

     for(var i=0;i<document.D_Submit.file_list.options.length;i++){
			 var file_tmp = document.D_Submit.userfile.value;
			 var file_pos = file_tmp.lastIndexOf("\\");
             var file = file_tmp.substring(file_pos+1);

			 // select¹Ú½º ÀÇ value °ª
             var sel_pos = document.D_Submit.file_list.options[i].text.indexOf("(");
             var sel = document.D_Submit.file_list.options[i].text.substring(0,sel_pos-1);

			 if(sel.replace(/ /g,'') == file.replace(/ /g,'')){
				 alert('Áßº¹µÈ ÆÄÀÏÀÌ Á¸ÀçÇÕ´Ï´Ù. È®ÀÎ ¹Ù¶ø´Ï´Ù.');
				 return;
             }
	 }

	if(str == "" && str2 != "") {
		alert("¼Õ´ÔÀÌ°Å³ª º»ÀÎÀÌ ¾Æ´Ò°æ¿ì ÆÄÀÏ Ã·ºÎ¸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù.");
		return;
	} else {
	    attach_init(str5);
  	    document.all.ATTMSG.style.visibility = "visible";
		document.D_Submit.target='ifr_P';
		document.D_Submit.action= ref + "file_up.html";
		document.D_Submit.submit();
		return;
	}
}

// ÆÄÀÏ»èÁ¦
function attach_del(ref,str,str2,str5) {
     if(document.D_Submit.file_list.value == "" || document.D_Submit.file_list.value == "-1"){ 
		alert('Ã·ºÎ ÆÄÀÏÀÌ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.');
		return;
	 } 

	if(str == "" && str2 != "") {
		win("./pass.html?id=" + document.D_Submit.id.value + "&inum=" + document.D_Submit.inum.value+ "&file_name=" + document.D_Submit.file_list.value,"actpass","305","154","no");
		return;
	} else {
		attach_init(str5);
		document.all.ATTMSG.style.visibility = "visible";
		document.D_Submit.target='ifr_P';
		document.D_Submit.action = ref + "file_move.html";
		document.D_Submit.type.value = 'del';
		document.D_Submit.submit();
		return;
	}
}

// ÆÄÀÏ ÁøÇà Ç¥½Ã ½ÃÀÛ
function attach_init(str5) {
	ATTMSG.document.open();
	ATTMSG.document.write('<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0><img src="'+str5+'/iconname/data/send_img.gif" border=0></body>');
	ATTMSG.document.close();
}

// ÆÄÀÏ ÁøÇà Ç¥½Ã ´Ý±â
function ATT_close() {
	document.all.ATTMSG.style.visibility = "hidden";
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////


function check_ID_Window(ref) {
	var winl = (screen.width - 365) / 2;
	var wint = (screen.height - 200) / 2;
   window.open(ref, 'checkIDWin', 'width=365 height=200 scrollbars=no left='+winl+' top='+wint);
} //»õÃ¢¶ç¿ì±â 2

function mkWin(path){
	window.open(path,'newfile1','width=550 height=500 scrollbars=yes');
} //»õÃ¢¶ç¿ì±â 3

function mkWin2(path){
	window.open(path,'newfile2','width=800 height=700 scrollbars=yes');
} //»õÃ¢¶ç¿ì±â 4

function title_win(path,name,width,height,scroll){

	var str = document.Submit.title.value;

	if(str == ""){
	   alert("±ÛÁ¦¸ñÀ» ³Ö¾îÁÖ¼¼¿ä");
	   return false;
    }
	
	var total = path+"&title_con=" + str;
    var winl = (screen.width - width) / 2;
    var wint = (screen.height - height) / 2;
    window.open(total,name,'width='+width+' height='+height+' scrollbars='+scroll+' left='+winl+' top='+wint);
}
