function openMail(email,name)
{
	var open_mail = window.open('modules/sendmail.php?to_email='+email+'&to_name='+name,'_sendmail','width=500,height=420,left=100,top=50');
	open_mail.focus();
}
function openConfig(tb)
{
	var open_Cf= window.open('board_config.php?tb='+tb,'_config','scrollbars=1,width=620,height=600');
	open_Cf.focus();
}

function viewMedia(media)
{
	var open_Media = window.open('modules/player.php?movie='+media,'_movie','width=318,height=285');
	open_Media.focus();
}

function viewFlash(swf, W, H)
{
	var open_Flash = window.open('modules/flash.php?swf='+swf+'&W='+W+'&H='+H,'_flash','width='+W+',height='+H);
	open_Flash.focus();
}

var image_win = null;
function viewImage(imgname)
{
	ImgObj = new Image();
	if(image_win != null){
		window.image_win.close();
		image_win = null;
	}
	ImgObj.src = imgname;
	open_Image(ImgObj);
}

function open_Image(ImgObj)
{
	if (!ImgObj.complete){
		setTimeout('open_Image(ImgObj)',100);
		return;
	}
	var W = 800;	//°¡·ÎÁ¦ÇÑ»çÀÌÁî
	var W_size = ImgObj.width;
	var H_size = ImgObj.height;

	if(W_size > W){
		var Width = W + 20;
		var reduce = Math.ceil((Width * 100) / W_size);
		var Height = Math.ceil((reduce * H_size) / 100);
		var scroll = 'yes';
	}
	else{
		var Width = W_size;
		var Height = H_size;
		var scroll = 'no';
	}
	var X = (document.body.clientWidth / 2) - (Width / 2);
	var Y = (document.body.clientHeight / 2) - (Height / 2);
	image_win = window.open('','open_image','scrollbars=' + scroll + ',width=' + Width + ',height=' + Height + ',left=' + X + ',top=' + Y);
	image_win.document.writeln('<html><body style=\"margin:0\">');
	image_win.document.writeln('<a href=\"javascript:self.close()\"><img src=' + ImgObj.src + ' width=' + W_size + ' height=' + H_size +' border=0></a>');
	image_win.document.writeln('</body><html>');
	image_win.document.title = 'ÀÌ¹ÌÁö Å©°Ô º¸±â';
	image_win.focus();
}

function popImage(pid)
{
	var X = (document.body.clientWidth / 2) - (522 / 2);
	var Y = (document.body.clientHeight / 2) - (490 / 2);
	window.open('pop_img.php?pid=' + pid,'open_image','scrollbars=yes,width=522,height=490,left=' + X + ',top=' + Y);
}


function multi_action(F)
{
	var num = 0;
	var multiObj = F.elements["multi[]"];
	if(multiObj.length){
		for(var i = 0; i < multiObj.length; i++){
			if(multiObj[i].checked == true) num++;
		}
	}
	else{
		if(multiObj.checked == true) num++;
	}
	if(!num){
		alert('¼±ÅÃÇÑ °Ô½Ã¹°ÀÌ ¾ø½À´Ï´Ù. »èÁ¦ ÇÒ °Ô½Ã¹°À» ¼±ÅÃÇØ ÁÖ¼¼¿ä');
		return false;
	}
	if(confirm('¼±ÅÃÇÏ½Å °Ô½Ã¹°À» Á¤¸»·Î »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?')){
		F.flag.value = 'delete';
		F.action = 'proc.php';
		F.method = 'post';
		F.submit();
	}
	return false;
}

function all_select(F)
{
	var chkObj = F.elements["multi[]"], tonum = 0, chknum = 0;

	if(chkObj){
		if(chkObj.length){
			for(var i = 0; i < chkObj.length; i++){
				if(chkObj[i].checked == true) chknum++;
				tonum++;
			}
			if(tonum != chknum){
				for(var i = 0; i < chkObj.length; i++){
					chkObj[i].checked = true;
				}
				F.selectall.checked = true;
			}
			else{
				for(var i = 0; i < chkObj.length; i++){
					chkObj[i].checked = false;
				}
				F.selectall.checked = false;
			}
		}
		else{
			if(chkObj.checked == true) chknum++;
			tonum = 1;
			if(!chknum){
				chkObj.checked = true;
				F.selectall.checked = true;
			}
			else{
				chkObj.checked = false;
				F.selectall.checked = false;
			}
		}
	}
	return false;
}

function emailCheck(email)
{
	var at = email.indexOf("@");
	var dat = email.lastIndexOf(".");
	var space = email.indexOf(" ");
	var length = email.length - 1;
	if ((at < 1) || (dat <= at + 1) || (dat == length ) || (space  != -1)) return false;
	return true;
}

function is_Field(F,field)
{
	var i = 0 , chk = 0;
	for(i; i < F.length; i++){
		if(F[i].name == field) chk++;
	}
	return chk;
}

function read_delete_check(name)
{
	if(confirm(name+'´ÔÀÇ ±ÛÀ» Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?')) return true;
	return false;
}

function pass_form_check(F)
{
	if(!F.loginPw.value){
		alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä');
		F.loginPw.focus();
		return false;
	}
	return true;
}

function showDownFile()
{
	var fObj = document.all["fileList"];
	if(fObj.style.display == "none"){
		fObj.style.display = "block";
	}
	else{
		fObj.style.display = "none";
	}
}

function previewPhoto(path,id){
	document.all["photo_" + id].src = path;
}

function openMiniConf(tb)
{
	window.open("boardConfig/mini_conf.php?tb=" + tb ,"_mini","scrollbars=yes,width=300,height=200");
}



