function prepage(){
  history.go(-1);
}

function boardsch(fld){
  var k=fld.value.replace(/ /g,"");
  if(!k){
    alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
    return false;
  }else{
	return true
  }
}

function del(form){ 
  var cnt = 0;          
  for(i=0;i<form.elements.length;i++){        
    if(form.elements[i].checked){      
      cnt++;         
    }     
  }         
  if(cnt < 1){           
    alert("»èÁ¦ÇÒ °Ô½Ã¹°À» ¼±ÅÃÇØÁÖ¼¼¿ä.");          
    return;           
  }
  ans = confirm("¼±ÅÃÇÏ½Å °Ô½Ã¹°À» Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?");        
  if(ans == true){             
    form.submit();            
  }else{           
    return;            
  }   
}


function imgRsize(img, rW, rH){
        var iW = img.width;
        var iH = img.height;
        var g = new Array;
        if(iW < rW && iH < rH) { // °¡·Î¼¼·Î°¡ Ãà¼ÒÇÒ °ªº¸´Ù ÀÛÀ» °æ¿ì
                g[0] =  iW; 
                g[1] =  iH; 
        } else {
                if(img.width > img.height) { // ¿øÅ©±â °¡·Î°¡ ¼¼·Îº¸´Ù Å©¸é
                        g[0] = rW;
                        g[1] = Math.ceil(img.height * rW / img.width);
                } else if(img.width < img.height) { //¿øÅ©±âÀÇ ¼¼·Î°¡ °¡·Îº¸´Ù Å©¸é
                        g[0] = Math.ceil(img.width * rH / img.height);
                        g[1] = rH;
                } else {
                        g[0] = rW;
                        g[1] = rH;
                }
                if(g[0] > rW) { // ±¸ÇØÁø °¡·Î°ªÀÌ Ãà¼Ò °¡·Îº¸´Ù Å©¸é
                        g[0] = rW;
                        g[1] = Math.ceil(img.height * rW / img.width);
                }
                if(g[1] > rH) { // ±¸ÇØÁø ¼¼·Î°ªÀÌ Ãà¼Ò ¼¼·Î°ª°¡·Îº¸´Ù Å©¸é
                        g[0] = Math.ceil(img.width * rH / img.height);
                        g[1] = rH;
                }
        }
        g[2] = img.width; // ¿ø»çÀÌÁî °¡·Î
        g[3] = img.height; // ¿ø»çÀÌÁî ¼¼·Î
        return g;
}

function Rsize(img, ww, hh, aL){
        var tt = imgRsize(img, ww, hh);
		if(img.width > "1000"){
			imgw = "1000";
		}else{
			imgw = img.width;
		}
		if(img.height > "700"){
			imgh = "700";
		}else{
			imgh = img.height;
		}
        if(img.width > ww || img.height > hh){ // °¡·Î³ª ¼¼·ÎÅ©±â°¡ Á¦ÇÑÅ©±âº¸´Ù Å©¸é
            img.width = tt[0]; // Å©±âÁ¶Á¤
            img.height = tt[1];
            img.alt = 'Å¬¸¯ÇÏ½Ã¸é ¿øº»ÀÌ¹ÌÁö¸¦ º¸½Ç¼öÀÖ½À´Ï´Ù.';
            if(aL){ // ÀÚµ¿¸µÅ© on
                    img.onclick = function(){
                        wT = Math.ceil((screen.width - tt[2])/2.6); // Å¬¶óÀÌ¾ðÆ® Áß¾Ó¿¡ ÀÌ¹ÌÁöÀ§Ä¡.
                        wL = Math.ceil((screen.height - tt[3])/2.6);
                        mm = window.open("", 'viewOrig', 'width='+imgw+',height='+imgh+',top='+wT+',left='+wL+',scrollbars=1');
                        var doc = mm.document;
                        doc.body.style.margin = 0; // ¸¶ÁøÁ¦°Å
                        doc.body.style.cursor = "hand";
                        var previewimg = doc.createElement("img");
                        previewimg.src = img.src;
                        doc.body.appendChild(previewimg);
                       // doc.body.onmousedown = function(){ mm.close();}
                        doc.title = '¿øº»ÀÌ¹ÌÁö';
                    }
                    img.style.cursor = "hand";
            }
        } else {
            return;
        }
}



function comment_check(form){
	if(!form.cname.value){
		alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä");
		form.cname.focus();
		return false;
	}else if(!form.cpw.value){
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		form.cpw.focus();
		return false;
	}else if(!form.comment.value){
		alert("ÄÚ¸àÆ®¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		form.comment.focus();
		return false;
	}else{
		return true;
	}
}


function viewimage(file,width,height){
	window.open('../upload/'+file,'image','width='+width+',height='+height+',toolbars=no,menubars=no,scrollbars=auto');
}

function viewimage2(file){
	//window.open(file,'image','toolbars=no,menubars=no,scrollbars=auto');
	 window.open('/img_pop.php?filename='+file,'','resizable=yes,scrollbars=no, width=10,height=10');

}
function memapp(){
  	location.href="/bboard/lib/lib.php?req=join";
}

function sloginchk(){
	if(!document.slogin_form.id.value){
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		document.slogin_form.id.focus();
		return false;
	}else if(!document.slogin_form.pw.value){
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		document.slogin_form.pw.focus();
		return false;
	}else{
		return true;
	}
}
