//-------------------------- Write Start ------------------------------//

function check_email(str){
emailStr = str.value
if(emailStr != "") {
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var firstChars=validChars
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom="(" + firstChars + validChars + "*" + ")"
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
		alert("E-mail ÁÖ¼Ò°¡ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù.");
		str.focus();
		return false;
		}
	}
}


function write_ok() 
{
	if ( document.write.writer.value == "" ) 
	{
		alert("ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		document.write.writer.focus();
		return false;
	}
	
	
	if ( document.write.title.value == "" ) 
	{
		alert("Á¦¸ñÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		document.write.title.focus();
		return false;
	}
	
	
	if ( document.write.context.value == "" ) 
		{
			alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
			document.write.context.focus();
			return false;
		}
	
	if (( document.write.pwd.value.length < 6 ) || (document.write.pwd.value == "" ))
		{
			alert("ÀÌ±ÛÀÇ ¼öÁ¤°ú »èÁ¦½Ã ÇÊ¿äÇÏ¹Ç·Î ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.\n\nºñ¹Ð¹øÈ£´Â 6ÀÚ ÀÌ»óÀÔ´Ï´Ù.");
			document.write.pwd.focus();
			return false;
		}
					
		show_progress();
	}
		  
function show_progress() {
  var _x = document.body.clientWidth/2 + document.body.scrollLeft - 145;
  var _y = document.body.clientHeight/2 + document.body.scrollTop - 44;
  progress.style.posLeft=_x;
  progress.style.posTop=_y;
  progress.style.visibility='visible';
 }


//---------------------Zoom-------------------------------------------//

 function check_zoom(mode){
	if(mode=="+"){document.write.content.rows += 3;}
	if(mode=="-" && document.write.content.rows > 3){document.write.content.rows -= 3;}
 }

//----------------------ÀÚµ¿ ÁÙ¹Ù²Þ--------------------------------------//

 function check_coding(){
  if(document.write.coding.checked){
	if(confirm("ÀÚµ¿ ÁÙ¹Ù²ÞÀ» ÇÏ½Ã°Ú½À´Ï±î?\n\nÀÚµ¿ ÁÙ¹Ù²ÞÀº °Ô½Ã¹° ³»¿ëÁß ÁÙ¹Ù²ï °÷À»<br>ÅÂ±×·Î º¯È¯ÇÏ´Â ±â´ÉÀÔ´Ï´Ù.")){
		document.write.coding.value=2;
	}else{
		document.write.coding.value=1;
	}
  }
 }
 



//----------------------Comment Write Start-----------------------//
function comment_write()
	{
	if ( document.Com_form.co_content.value == "" ) 
//	if (document.Com_form.co_content.value.length == 0) 
		{
			alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
			document.Com_form.co_content.focus();
			return false;
		}
	if ( document.Com_form.co_name.value == "" ) 
//	if (document.Com_form.co_name.value.length == 0) 
		{
			alert("ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
			document.Com_form.co_name.focus();
			return false;
		}
	if (document.Com_form.ckeck_js_value.value == "")
		{
			if ( document.Com_form.co_pass.value == "" ) 
	//		if (document.Com_form.co_pass.value.length == 0) 
			{
				alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
				document.Com_form.co_pass.focus();
				return false;
			}
		}
	
	}


//----------------------Comment Write End-----------------------//

	


//--------------------- ÀüÃ¼¼±ÅÃ ¹× ¼±ÅÃÇØÁ¦---------------------//

function check_all(field){
	var cntBox = field.check.length-1;
	for(var i = 0; i <= cntBox; i++) {
		if (field.check[i].checked == false){
			field.check[i].checked=true;
		}
		else{
			field.check[i].checked=false;
		}
	}
}

//--------------------- ÀüÃ¼ ¼±ÅÃ ¹× ¼±ÅÃ ÇØÁ¦---------------------//


function check_view(){
	var i, j=0, k=0;
	for(i=0;i<document.mainform.length;i++) {
	if(document.mainform[i].checked)
	k++;
	}
	if(k1 || k==1){
		alert("°Ô½Ã¹°À» ÃÖ¼Ò 2°³ ÀÌ»óÀÌ Ã¼Å©ÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
	//return false;
	}
	if(k>1){
		document.mainform.action = "check_view.asp"
		document.mainform.submit();
		return true;
	}
}



//-------------------------·Î±×ÀÎ Ã¼Å©-------------------------------//

 function login_check()
	{
		if(document.login_frm.user_id.value == 0)
		{
			alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
			document.login_frm.user_id.focus();
			return false;
		}
		if(document.login_frm.user_pwd.value == 0)
		{
			alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
			document.login_frm.user_pwd.focus();
			return false;
		}
	}
//-------------------------ÀÚµ¿ ·Î±×ÀÎ Ã¼Å©-------------------------------//
function autologin_check() { 
	if (document.login_frm.autologin.checked==true) {
		var check;  
		check = alert("°ø°øÀå¼Ò ¹× PC ¹æ¿¡¼­´Â ÀÚµ¿·Î±×ÀÎ ±â´ÉÀ» ¼³Á¤ÇÏÁö ¸¶¼¼¿ä. \n\n°³ÀÎÁ¤º¸°¡ À¯ÃâµÉ¼ö ÀÖ½À´Ï´Ù.");
	}                               
}  
 

//------------------------ÆË¾÷Ã¢ ¶ç¿ì±â-----------------------------------//
function popup_win(url,p_name,s_width,s_height,s_scrol)
{
	x = screen.width;
	y = screen.height;
	wid = (x / 2) - (s_width / 2);
	hei = (y / 2) - (s_height / 2);

   window.open(url, p_name, "toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=" + s_scrol + ",width=" + s_width + ",height=" + s_height + ",top=" + hei + ",left=" + wid + ",scrolbar=no"); 
}


//------------------------¿øº»ÀÌ¹ÌÁö º¸±â-----------------------------------//
function originalimg(url,imagepath)
{
	
	var imgTmp = new Image();
	imgTmp.src = imagepath;
	
	imgwidth = imgTmp.width; 
	imgheight = imgTmp.height; 
	
	window.open(url,"popup","width="+imgwidth+",height="+imgheight+",status=no,toolbar=no,scrollbars=no,resizable=no");

}

//-----------------------ÀÌ¹ÌÁö »çÀÌÁî ±¸ÇÏ±â--------------------------------//
function upload_img_resize(target_img,str,imgsize) 
{ 
var newX; 
var newY; 
var newHeight; 
var newWidth; 
if (imgsize < 100){
	var maxWidth = 800;
	var maxHeight = 600;
}else{
	var maxWidth = imgsize;
	var maxHeight = imgsize*0.75;
}

var newImg = new Image(); 
newImg.src = target_img.src; 

imgw = newImg.width; 
imgh = newImg.height; 

if (imgw > maxWidth || imgh > maxHeight) { 
	if (imgw > imgh) { 
		if (imgw > maxWidth) 
			newWidth = maxWidth; 
		else 
			newWidth = imgw; 
			newHeight = Math.round((imgh * newWidth) / imgw); 
	} else { 
		if (imgh > maxHeight) 
			newHeight = maxHeight; 
		else 
			newHeight = imgh; 
			newWidth = Math.round((imgw * newHeight) / imgh); 
		} 
}else { 
	newWidth = imgw; 
	newHeight = imgh; 
} 

newWidth = newWidth.toFixed(0)
newHeight = newHeight.toFixed(0)

newX = maxWidth / 2 - newWidth / 2; 
newY = maxHeight / 2 - newHeight / 2; 
target_img.onload = null; 
target_img.src = newImg.src; 
target_img.width = newWidth; 
target_img.height = newHeight; 
} 



//-----------------------È¸¿øÁ¤º¸º¸±â--------------------------------//

function send_email(url)
{
	window.open(url,'member_email','scrollbars=yes,width=400,height=500,top=0,left=0,toolbar=no');
}

//-----------------------È¸¿øÁ¤º¸º¸±â--------------------------------//

function member_info(url)
{
	window.open(url,'red_club','scrollbars=yes,width=400,height=500,top=0,left=0,toolbar=no');
}

//-----------------------ÂÊÁö º¸³»±â--------------------------------//
function member_memo(url)
{
	window.open(url,'member_memo','scrollbars=yes,width=400,height=500,top=0,left=0,toolbar=no');
}

//-----------------------¾ÆÀÌµð ¹× ºñ¹Ð¹øÈ£ Ã£±â--------------------------------//
function member_lost()
{
	window.open('./lost.asp','member_lost','scrollbars=no,width=380,height=170,top=0,left=0,toolbar=no');
}

//-----------------------Select Link---------------------------------------------//
 function category_change(obj) {
  var myindex=obj.selectedIndex;
  document.FindForm.category.value=obj.options[myindex].value;
  document.FindForm.submit();
  return true;
 }
 
//-----------------------ÀÌ¹ÌÁö¹Ú½º ¸µÅ©---------------------------------------------//
 function open_ImageBox(tn) 
 {
	window.open("./imagebox.asp?tn="+tn,"my_imagebox","width=600,height=620,resizable=yes,scrollbars=auto,toolbars=no,top=0,left=0");
 }
 
 //-----------------------¹Ì¸®º¸±â (Ver 1.2)---------------------------------------------//

var previewWindow;

function preview()
{
    previewWindow = window.showModelessDialog("pre_view.asp", window,"status:false;dialogWidth:450px;dialogHeight:300px");
    previewWindow.moveTo(10, 10);
}

