// ÀÔ·Â°ªÀÌ Æ¯Á¤ ¹®ÀÚ(chars)¸¸À¸·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
function containsCharsOnly(input,chars){
	for(var inx=0; inx<input.value.length; inx++){
		if(chars.indexOf(input.value.charAt(inx)) == -1){
			return false;
		}
	}
	return true;
}

// ÀÔ·Â°ªÀÌ ¼ýÀÚ·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
function isNumber(input){
	var chars = "0123456789";
	return containsCharsOnly(input,chars);
}

// ÁÖ¾îÁø ¹®ÀÚ¿­ÀÌ ¼ýÀÚÀÎÁö¸¦ °Ë»ç
function _isDigit(sStr){
	if(sStr<"0" || sStr>"9"){
		return false;
	}
	return true;
}

// ÁÖ¾îÁø ¹®ÀÚ¿­ÀÌ ¼ýÀÚ È¤Àº "-" ¹®ÀÚ·Î¸¸ ÀÌ·ç¾îÁ³´ÂÁö¸¦ °Ë»ç
function isBankNumber(objName, DispMsg){
	var strValue = objName.value;
	var retChar;

	for(i=0; i<strValue.length; i++){
		retChar = strValue.substr(i, 1)
		if(_isDigit(retChar)==false && retChar!='-'){
			alert(DispMsg+" Ç×¸ñ¿¡´Â \n¼ýÀÚ¿Í '-'¸¸ °¡´ÉÇÕ´Ï´Ù.");
			return false;
		}
	}
	return true;
}

// ÁÖ¾îÁø ¹®ÀÚ¿­ÀÌ ¿µ¹®ÀÚÀÎÁö¸¦ °Ë»ç
function _isAlpha(sStr){
	if((sStr<"A" || sStr>"Z") && (sStr<"a" || sStr>"z")){
		return false;
	}
	return true;
}

// ¹®ÀÚ¿­¿¡¼­ ½ºÆäÀÌ½º¸¦ Ã¼Å©ÇÑ´Ù
function _CheckSpaces(strValue){
	for(var i=0; i<strValue.length; i++){
		if(strValue.charAt(i) != " "){
			return false;
		}
	}
	return true;
}

// Ç×¸ñÀÇ À¯È¿¼º °Ë»ç
function checkForm(obj, msg){
	if(obj.value=="" || _CheckSpaces(obj.value)){
		alert("["+msg+"] Ç×¸ñÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä");
		obj.focus();
		return true;
	}else{
		return false;
	}
}

// ¹®ÀÚ¿­ÀÌ ÁÖ¾îÁø ±æÀÌ ÀÎÁö¸¦ Á¡°Ë
function isValidLength(objName, MinLen, MaxLen, DispMsg){
	var sValue = objName.value;

	nStrLen = HGetStrLength(sValue);
	// ÃÖ¼ÒÇÑÀÇ ±æÀÌ Ã¼Å©
	if(nStrLen < MinLen){
		alert("\'" + DispMsg + "' Ç×¸ñ¿¡ ³Ê¹« ÀÛ°Ô ÀÔ·ÂµÇ¾î ÀÖ½À´Ï´Ù."+MinLen+"ÀÚ ÀÌ»ó ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù.");
		objName.focus();
		return false;
	}
	// ÃÖ´ëÇÑÀÇ ±æÀÌ Ã¼Å©
	if(nStrLen > MaxLen){
		alert("\'"+DispMsg+"' Ç×¸ñ¿¡ ³Ê¹« ±æ°Ô ÀÔ·ÂµÇ¾î ÀÖ½À´Ï´Ù."+MaxLen+"ÀÚ ÀÌÇÏ·Î ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù.");
		objName.focus();
		return false;
	}
	return true;
}

// ¹®ÀÚ¿­ÀÇ ±æÀÌ¸¦ ¸®ÅÏ(ÇÑ±ÛÀº 2¹ÙÀÌÆ®·Î Ã³¸®)
function HGetStrLength(sValue){
	var nStrLength = 0;
	var i;

	for(i=0; i<sValue.length; i++){
		if(parseInt(sValue.charCodeAt(i)) > 127){
			nStrLength = nStrLength + 2;
		}else{
			nStrLength++;
		}
	}
	return nStrLength;
}

// ÁÖ¾îÁø CheckBox ³ª RadidButtonÀÌ ¼±ÅÃµÇ¾ú´ÂÁö °Ë»ç
function isNotEmptyChecked(objName, DispMsg){
	var count = 0;
	
	for(var i=0; i<objName.length;i++){
		if(objName[i].checked ){
			count=count+1;
		}
	}
	if(count<1){
		alert("\'"+DispMsg+"' Ç×¸ñÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		return false;
	}
	return true;
}

// ÁÖ¾îÁø ¹®ÀÚ¿­ÀÌ ÇÑ±ÛÀÌ ¾Æ´ÑÁö¸¦ °Ë»ç
function isNotHangul(objName, DispMsg){
	var sValue = objName.value;

	if(HGetStrLength(sValue) != sValue.length){
		alert("\'" + DispMsg + "' Ç×¸ñ¿¡ ÇÑ±ÛÀº Çã¿ëµÇÁö ¾Ê½À´Ï´Ù.");
		objName.focus();
		return false;
	}
	return true;
}

function isHangul(objName, DispMsg){
	var sValue = objName.value;
	
	for(i=0; i<sValue.length; i++){
		retChar = sValue.substr(i, 1);
		if(HGetStrLength(retChar) == retChar.length){
			alert("\'" + DispMsg + "' Ç×¸ñ¿¡ ÇÑ±Û¸¸ Çã¿ëµË´Ï´Ù.");
			objName.value = "";
			objName.focus();
			return true;
		}
	}
	return false;
}

// ¼ýÀÚ¿Í ¿µ¹®ÀÚ °Ë»ç
function isValidID(objName, DispMsg){
	var sValue = objName.value;
	var i;
	var retChar;

	for(i=0; i<sValue.length; i++){
		retChar = sValue.substr(i, 1)
		if((_isDigit(retChar)==false) && (_isAlpha(retChar)==false)){
			alert("\'"+DispMsg+"' Ç×¸ñ¿¡ ¿µ¹®ÀÚ¿Í ¼ýÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
			objName.focus();
			return false;
		}
	}
	return true;
}

// ÀÌ¸ÞÀÏ °Ë»ç
function isEMail(obj){
	var str = obj.value ;

	// ÀÔ·Â°ªÀÌ ¾øÀ¸¸é ±×³É return ÇÑ´Ù.
	if(str == "") return true;

	emailEx1 = /[A-Za-z0-9_\-]@[A-Za-z0-9_\-]+\.[A-Za-z]+/;
	emailEx2 = /[A-Za-z0-9_\-]@[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z]+/;
	emailEx3 = /[A-Za-z0-9_\-]@[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z0-9_\-]+\.[A-Za-z]+/;
	if(emailEx1.test(str)) return true;
	if(emailEx2.test(str)) return true;
	if(emailEx3.test(str)) return true;
	alert('ÀüÀÚ¿ìÆíÀÌ Çü½Ä¿¡ ¸ÂÁö ¾Ê½À´Ï´Ù \n\n ¿¹) webmaster@naver.com');
	obj = document.member_join.usr_email1;
	obj.focus();
	return false;
}

// ÁÖ¹Î¹øÈ£ °Ë»ç
function isJuminNo(obj1,obj2){
	var i = 0;
	var Sum = 0;
	var Mod = 0;
	var YearIn = 0;
	var MonthIn = 0;
	var DateIn = 0;
	var ID = "";

	head_num = obj1.value;
	tail_num = obj2.value;

	ID = head_num+tail_num;

	//ÁÖ¹Î¹øÈ£ 13ÀÚ¸®¸¦ ÇÑÀÚ¸®¾¿ Ã¼Å©
	for(i=0; i<12; i++){
		if(!_isDigit(ID.charAt(i))){
			alert("ºñÁ¤»óÀûÀÎ ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù..!");
			obj1.focus();
			return false;
		}
	}

	for(i=0; i<12; i++){
		if(i==0)
			YearIn+=parseInt(ID.charAt(i))*10;
		if(i==1)
			YearIn+=parseInt(ID.charAt(i));
		if(i==2)
			MonthIn+=parseInt(ID.charAt(i))*10;
		if(i==3)
			MonthIn+=parseInt(ID.charAt(i));
		if(i==4)
			DateIn+=parseInt(ID.charAt(i))*10;
		if(i==5)
			DateIn+=parseInt(ID.charAt(i));
		if(i<6)
			Sum+=parseInt(ID.charAt(i))*(i+2);
		if(i>5 && i<8)
			Sum+=parseInt(ID.charAt(i))*(i+2);
		if(i>7)
			Sum+=parseInt(ID.charAt(i))*(i-6);
	}

	Mod=11-(Sum%11);

	if((11-(Sum%11))>=10) Mod-=10;

	if(Mod!=parseInt(ID.charAt(12))){
		alert('ÁÖ¹Îµî·Ï¹øÈ£°¡ Àß¸øµÈ ¹øÈ£ÀÔ´Ï´Ù!!');
		obj1.focus();
		return false;
	}
	if(MonthIn<1 || MonthIn>12 || DateIn<1 || DateIn>31){
		alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ Àß¸øµÈ ¹øÈ£ÀÔ´Ï´Ù !! ");
		obj1.focus();
		return false;
	}
	if((MonthIn==4 || MonthIn==6 || MonthIn==9 || MonthIn==11) && DateIn>30){
		alert("ÁÖ¹Îµî·Ï¹øÈ£°¡  Àß¸øµÈ ¹øÈ£ÀÔ´Ï´Ù !! ");
		obj1.focus();
		return false;
	}
	if(MonthIn==2 && DateIn>29){
		alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ Àß¸øµÈ ¹øÈ£ÀÔ´Ï´Ù !! ");
		obj1.focus();
		return false;
	}
	return true;
}

function login_submit(f) {
	if(f.usr_id.value == ""){
		alert("È¸¿ø¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ½Ê½Ã¿À.");
		f.usr_id.focus();
		return false;
	}
	if(f.usr_passwd.value == ""){
		alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇÏ½Ê½Ã¿À.");
		f.usr_passwd.focus();
		return false;
	}

	f.submit();
	
	return true;
}

// login
function login(form){
	form.submit();
}

// logout
function check_logout(form){
	if(typeof(form)=='object'){
		form.submit();
	}else{
		alert('·Î±×ÀÎ »óÅÂ°¡ ¾Æ´Õ´Ï´Ù.');
	}
}

// 3ÀÚ¸® ´ÜÀ§ ,Ç¥½Ã
function commaStr(num){
	var num_str = num.toString()
	var result = ''

	for(var i=0; i<num_str.length; i++){
		var tmp = num_str.length-(i+1)
		if(i%3==0 && i!=0) result = ',' + result
		result = num_str.charAt(tmp) + result
	}
	return result
}

// ÀÌ¹ÌÁö swap
function na_restore_img_src(name, nsdoc){
	var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
	if (name == ''){
		return;
	}
	if(img && img.altsrc){
		img.src    = img.altsrc;
		img.altsrc = null;
		}
}

// ÀÌ¹ÌÁö swap
function na_preload_img(){ 
	var img_list = na_preload_img.arguments;
	if(document.preloadlist == null){
		document.preloadlist = new Array();
	}
	var top = document.preloadlist.length;
	for(var i=0; i<img_list.length-1; i++) {
		document.preloadlist[top+i] = new Image;
		document.preloadlist[top+i].src = img_list[i+1];
	} 
}

// ÀÌ¹ÌÁö swap
function na_change_img_src(name, nsdoc, rpath, preload){ 
	var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
	if(name == ''){
		return;
	}
	if(img){
		img.altsrc = img.src;
		img.src    = rpath;
	}
}

// div º¸ÀÌ±â
function div_visibility(div_id1, mod1, div_id2, mod2){
	if(mod1 == "show"){
		document.getElementById(div_id1).style.visibility = "visible";
	}else{
		document.getElementById(div_id1).style.visibility = "hidden";
	}

	if(mod2 == "show"){
		document.getElementById(div_id2).style.visibility = "visible";
	}else{
		document.getElementById(div_id2).style.visibility = "hidden";
	}
}

function textarea_decrease(id, row){
	if (document.getElementById(id).rows - row > 0)
		document.getElementById(id).rows -= row;
}

function textarea_original(id, row){
	document.getElementById(id).rows = row;
}

function textarea_increase(id, row){
	document.getElementById(id).rows += row;
}

// ÆË¾÷(½ºÅ©·Ñ¾øÀ½)
function openPopup(url,width,height){
	var left = (screen.width - width)/2 - 60;
	var top = (screen.height - height)/2 - 60;
	window.open(url, '', 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar=no ,directories=no,menubar=no,location=no,scrollbars=no,resizable=no,status=no');
}

// ÆË¾÷(½ºÅ©·ÑÀÚµ¿)
function openPopup2(url,width,height){
	var left = (screen.width - width)/2 - 60;
	var top = (screen.height - height)/2 - 60;
	window.open(url, '', 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar=no ,directories=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no');
}

// ÆË¾÷(³×ÀÌ¹Ö)
function openPopupName(url,popup_name,width,height){
	var left = (screen.width - width)/2 - 60;
	var top = (screen.height - height)/2 - 60;
	window.open(url, popup_name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar=no ,directories=no,menubar=no,location=no,scrollbars=no,resizable=no,status=no');
}

// ÆË¾÷(³×ÀÌ¹Ö)
function openPopupName2(url,popup_name,width,height){
	var left = (screen.width - width)/2 - 60;
	var top = (screen.height - height)/2 - 60;
	window.open(url, popup_name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar=no ,directories=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no');
}

// ¿øº» ÀÌ¹ÌÁö º¸±â
function imgResize(img){ 
	img1= new Image(); 
	img1.src=(img); 
	imgControll(img); 
} 

// ¿øº» ÀÌ¹ÌÁö º¸±â
function imgControll(img){ 
	if((img1.width!=0)&&(img1.height!=0)){ 
		viewImage(img); 
	} 
	else{ 
		controller="imgControll('"+img+"')"; 
		intervalID=setTimeout(controller,20); 
	} 
} 

// ¿øº» ÀÌ¹ÌÁö º¸±â
function viewImage(img){ 
	W=img1.width;
	H=img1.height; 

	var screen_width = screen.width;
	var screen_height = screen.height;
	if(W>screen_width){
		W = screen_width * 0.8;
		H = H * (W/img1.width);
	}else if(H>screen_height){
		H = screen_height * 0.8;
		W = W * (H/img1.height);
	}

	O="width="+W+",height="+H+",menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0"; 
	imgWin=window.open("","",O); 
	imgWin.document.write("<html><head><title>PDF ¹Ì¸®º¸±â</title>");
	imgWin.document.write("<meta http-equiv='Content-Type' content='text/html; charset=euc-kr'></head>");
	imgWin.document.write("<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>");
	imgWin.document.write("<img src="+img+" width='"+W+"' height='"+H+"' onclick='self.close()' style=cursor:hand>");
	imgWin.document.close();
} 

// ÆÄÀÏ ¾÷·Îµå
function check_upload(form){
	if(!form.file_name.value){
		alert('ÆÄÀÏÀ» ¼±ÅÃÇÏ¿© ÁÖ¼¼¿ä.');
	}else if(form.filelist!=null){
		var temp = form.file_name.value;
		var exist_file = false;
		if(form.filelist.length==null){
			if(temp.indexOf(form.filelist.value)>0) exist_file = true;
		}else{
			for(var i=0;i<form.filelist.length;i++){
				if(temp.indexOf(form.filelist[i].value)>0) exist_file = true;
			}
		}
		if(exist_file){
			alert('ÆÄÀÏ¸íÀÌ Áßº¹µË´Ï´Ù.');
		}else{
			form.submit();
		}
	}else{
		form.submit();
	}
}

// ÆäÀÌÁö ÀÌµ¿
function go_page(go_page, currentPage){
	if(go_page.indexOf("?") > 0){
		location.href=go_page+"&currentPage="+currentPage;
	}else{
		location.href=go_page+"?currentPage="+currentPage;
	}
}

// ÀÎÆ®·Î ¿­±â
function intro_open(url){
	window.open(url, 'intro','width=616,height=580,marginwidth=0,marginheight=0,top=20, left=20 ,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=YES,resizable=no');
}

// ÈÄ¿øÈ¸¿ø ÀüÈ¯
function ViewTermMemberWin(islogin){
	if(islogin){
		location.href = "/order/pay_select.php";
	}else{
		alert("·Î±×ÀÎÀ» ÇÏ¼¼¿ä");
		return;
	}
}

// µ¥³ª¸®¿Â ÃæÀü
function ViewTermMemberWin_point(islogin){
	if(islogin){
		location.href = "/order/pay_select.php";
	}else{
		alert("·Î±×ÀÎÀ» ÇÏ¼¼¿ä");
		return;
	}
}

// ÅÇ¸Þ´º º¯°æ
function change_tab_menu(menu){
	if(menu=="theme"){
		document.getElementById("theme_area").style.display = "block";
		document.getElementById("julgi_area").style.display = "none";
		document.getElementById("kind_image").src = "/images/bod/tab1ov.gif";
		document.getElementById("julgi_image").src = "/images/bod/tab2.gif";
	}else{
		document.getElementById("julgi_area").style.display = "block";
		document.getElementById("theme_area").style.display = "none";
		document.getElementById("kind_image").src = "/images/bod/tab1.gif";
		document.getElementById("julgi_image").src = "/images/bod/tab2ov.gif";
	}
}

// td»ö»ó º¯°æ
function change_td(mode, no){
	if(mode=="over"){
		document.getElementById("item_ico_"+no).style.border = "2px solid #0099ff";
	}else{
		document.getElementById("item_ico_"+no).style.border = "2px solid #f4f4f4";
	}
}

// td»ö»ó º¯°æ(short_image)
function change_td_short(mode, board_name, no){
	if(mode=="over"){
		document.getElementById("item_ico_"+board_name+"_"+no).style.border = "2px solid #0099ff";
	}else{
		document.getElementById("item_ico_"+board_name+"_"+no).style.border = "2px solid #f4f4f4";
	}
}

// ÀüÃ¼¼±ÅÃ
function SelectAll(){
	if(document.all.CheckBasket.length){
		for(var i=0; i<document.all.CheckBasket.length; i++){
			document.all.CheckBasket[i].checked = true;
		}
	}else{
		document.all.CheckBasket.checked = true;
	}
}

// ¼±ÅÃÇØÁ¦
function ClearAll(){
	if(document.all.CheckBasket.length){
		for(var i=0; i<document.all.CheckBasket.length; i++){
			document.all.CheckBasket[i].checked = false;
		}
	}else{
		document.all.CheckBasket.checked = false;
	}
}

// CDÁ¦ÀÛ ÀÌµ¿
function insertGropCD(islogin){
	var cnt = 0;
	var bbs_no = "";
	if(!islogin){
		alert("·Î±×ÀÎÀ» ÇÏ¼¼¿ä.");
		return;
	}else{
		if(document.all.CheckBasket.length){
			for(var i=0; i<document.all.CheckBasket.length; i++){
				if(document.all.CheckBasket[i].checked==true){
					cnt++;
					bbs_no += document.all.bbs_no[i].value+",";
				}
			}
			if(cnt==0){
				alert("Á¦ÀÛÇÒ Á¦Ç°À» ¼±ÅÃÇØÁÖ¼¼¿ä.");
			}else{
				document.getElementById("send_bbs_no").value = bbs_no;
				document.getElementById("cd_make").submit();
			}
		}else{
			if(document.all.CheckBasket.checked==true){
				cnt++;
				bbs_no += document.all.bbs_no.value+",";
			}
			if(cnt==0){
				alert("Á¦ÀÛÇÒ Á¦Ç°À» ¼±ÅÃÇØÁÖ¼¼¿ä.");
			}else{
				document.getElementById("send_bbs_no").value = bbs_no;
				document.getElementById("cd_make").submit();
			}
		}
	}
}

// CDÁ¦ÀÛ ÀÌµ¿
function insertCD(bbs_no){
	document.getElementById("send_bbs_no").value = bbs_no;
	document.getElementById("cd_make").submit();
}

//±Û¾²±â Ã¼Å©
function checkBoardWrite(form){
	if(!form.bbs_title.value){
		alert('Á¦¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä');
		form.bbs_title.focus();
	}else{
		// ¿¡µðÅÍÀÇ ³»¿ëÀ» ¿¡µðÅÍ »ý¼º½Ã¿¡ »ç¿ëÇß´ø textarea¿¡ ³Ö¾î ÁÝ´Ï´Ù.
		oEditors.getById["ir1"].exec("UPDATE_IR_FIELD", []);
		
		// ¿¡µðÅÍÀÇ ³»¿ë¿¡ ´ëÇÑ °ª °ËÁõÀº ÀÌ°÷¿¡¼­ document.getElementById("ir1").value¸¦ ÀÌ¿ëÇØ¼­ Ã³¸®ÇÏ¸é µË´Ï´Ù.

		try{
			form.submit();
		}catch(e){}
	}
}

// È¸¿ø Å»Åð
function out_member(islogin){
	if(islogin){
		if(confirm("Å»ÅðÇÏ½Ã¸é ´Ù½Ã °¡ÀÔ ÇÒ ¼ö ¾ø½À´Ï´Ù.\nÀç°¡ÀÔÀ» ¿øÇÒ °æ¿ì´Â\n°í°´¼¾ÅÍ·Î ¹®ÀÇ ÇÏ¿©ÁÖ¼¼¿ä!\n\nÁ¤¸» Å»ÅðÇÏ½Ã°Ú½À´Ï±î?")){
			empty.location.href = "<?$root_path?>/member/out_process.php";
		}
	}else{
		alert("·Î±×ÀÎÀ» ÇÏ¼¼¿ä.");
		return;
	}
}

// sitemap¿ë ·Î±×ÀÎÃ¼Å© ¹× ÀÌµ¿
function checkLogin(islogin, url){
	if(islogin){
		location.href = url;
	}else{
		alert("·Î±×ÀÎÀ» ÇÏ¼¼¿ä.");
		return;
	}
}

// sitemap¿ë ·Î±×ÀÎÃ¼Å© ¹× ÀÌµ¿
function checkLogout(islogin, url){
	if(islogin){
		alert("·Î±×ÀÎ»óÅÂ¿¡¼­´Â ÀÌ¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
		return;
	}else{
		location.href = url;
	}
}

// ½º¸¶Æ®¿¡µðÅÍ ÀÌ¹ÌÁö ¹Ì¸®º¸±â
function imgPreview(area_name,img){
	var imgObj = document.getElementById(area_name);
	var fakeObj = document.getElementById(area_name+"_hid");
	if(img.value.match(/\.(gif|jpg|jpeg|png)$/i)){
		fakeObj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img.value+"',sizingMethod='image')";

		var w = fakeObj.offsetWidth;
		var h = fakeObj.offsetHeight;
		var x_axis = 0;
		var y_axis = 0;
		if(w > 260) { // °¡·Î ±æÀÌ°¡ 115 ÀÌ»óÀÏ °æ¿ì¸¸ Ãà¼ÒÇÏ±â
			x_axis = w / 260; // XÃàÀÇ Ãà¼Ò ºñÀ² ±¸ÇÏ±â
			y_axis = parseInt(h / x_axis); // XÃàÀÌ µé¾îµç ¸¸Å­ YÃàÀÇ Å©±â¸¦ Ãà¼ÒÇÑ´Ù.
			if(y_axis > 154){
				y_axis = 154;
			}
			w = 260;
		}else{
			y_axis = h;
		}

		// ½æ³×ÀÏ ÄÁÅ×ÀÌ³ÊÀÇ Å©±â Á¶Á¤
		imgObj.style.width = w+'px';
		imgObj.style.height = y_axis+'px';

		imgObj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img.value+"',sizingMethod='scale')";
	} else {
		img.outerHTML = img.outerHTML;
		imgObj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='',sizingMethod=scale)";
		alert('ÀÌ¹ÌÁöÆÄÀÏ¸¸ ¿Ã¸±¼ö ÀÖ½À´Ï´Ù.');
	}
}

// ½º¸¶Æ®¿¡µðÅÍ »çÁø/ÆÄÀÏÃ·ºÎ
function upload_dispaly(area_name){
	var Obj = document.getElementById(area_name);
	if(Obj.style.display == "block"){
		Obj.style.display = "none";
	}else{
		Obj.style.display = "block";
	}
}

// ½º¸¶Æ®¿¡µðÅÍ »çÁø/ÆÄÀÏÃ·ºÎ
function upload_cancle(area_name,view_area,form){
	var Obj = document.getElementById(area_name);
	var viewObj = document.getElementById(view_area);
	form.reset();
	if(area_name == "picture_area"){
		viewObj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='',sizingMethod='scale')";
	}
	Obj.style.display='none';
}

// ÇÃ·¡½Ãº¸±â
function swfWrite(source,width,height) {
	var T = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+width+"' height='"+height+"'>" +
			"<param name='movie' value='"+source+"'>" +
			"<param name='quality' value='high'>" +
			"<param name='wmode' value='transparent'>" +
			"<embed src='"+source+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+width+"' height='"+height+"'></embed></object>"

	document.write(T);
}

// »çÀÌ¹ö¼ºÁö¼ø·Ê ÀÌµ¿
function goSungji(cat) {
	alert(cat);
	var url = '/board/sungji/'
	var query = (cat != '') ? '?sec='+cat : ''
	
	//location.href = url+query;
}

// ajax¸¦ À§ÇÑ ÇÔ¼öÀÔ´Ï´Ù.
function getXmlHttpRequest(){
	var xmlhttp = false;
	// Mozilla/Safari
	if(window.XMLHttpRequest){
		xmlhttp = new XMLHttpRequest();
	}
	// IE
	else if(window.ActiveXObject){
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xmlhttp;
}

// ajax°¡ ÇÊ¿äÇÑ ¿µ¿ª¿¡ °øÅë»ç¿ë
function include_ajax(area_name ,url){
	if(area_name=="file_area") document.getElementById(area_name).innerHTML = "File Loading...";
	var xmlhttp = getXmlHttpRequest();
	//alert(url);
	if(url){
		xmlhttp.open("GET", url, true);
		xmlhttp.onreadystatechange = function(){
			if(xmlhttp.readyState == 4){
				if(xmlhttp.status == 200){
					document.getElementById(area_name).innerHTML = xmlhttp.responseText;
					//if(area_name=='file_area') checkUsedPicture();
				}else{
					//alert("Error loading "+url+", "+xmlhttp.status+"("+xmlhttp.statusText+")");
					empty.document.writeln("Error loading "+url+", "+xmlhttp.status+"("+xmlhttp.statusText+")");
				}
				xmlhttp = null; // <-- ÀÌ°÷¿¡ Ãß°¡ 
			}
		}
		xmlhttp.send(null);
	}
	return false;
}

// ajax°¡ ÇÊ¿äÇÑ ¿µ¿ª¿¡ °øÅë»ç¿ë
function include_ajax_sync(area_name,url){
	var xmlhttp = getXmlHttpRequest();
	if(url){
		xmlhttp.open("GET", url, false);
		xmlhttp.onreadystatechange = function(){
			if(xmlhttp.readyState == 4){
				if(xmlhttp.status == 200){
					//document.getElementById(area_name).innerHTML = xmlhttp.responseText;
				}else{
					//alert("Error loading "+url+", "+xmlhttp.status+"("+xmlhttp.statusText+")");
				}
				xmlhttp = null; // <-- ÀÌ°÷¿¡ Ãß°¡ 
			}
		}
		xmlhttp.send(null);
	}
	return false;
}

// ajax°¡ ÇÊ¿äÇÑ ¿µ¿ª¿¡ °øÅë»ç¿ë
function include_ajax_href(area_name,url){
	if(area_name=='file_area') document.getElementById(area_name).innerHTML = "File Loading...";
	var xmlhttp = getXmlHttpRequest();
	if(url){
		xmlhttp.open("GET", url, true);
		xmlhttp.onreadystatechange = function(){
			if(xmlhttp.readyState == 4){
				if(xmlhttp.status == 200){
					document.getElementById(area_name).innerHTML = xmlhttp.responseText;
				}else{
					//alert("Error loading "+url+", "+xmlhttp.status+"("+xmlhttp.statusText+")");
					empty.document.writeln("Error loading "+url+", "+xmlhttp.status+"("+xmlhttp.statusText+")");
				}
				xmlhttp = null; // <-- ÀÌ°÷¿¡ Ãß°¡ 
			}
		}
		xmlhttp.send(null);
	}
	return;
}

// ajax°¡ ÇÊ¿äÇÑ ¿µ¿ª¿¡ °øÅë»ç¿ë(¹Ýº¹½Ã°£»ç¿ë)
function include_ajax_repeat(area_name,url,repeat_time){
	var xmlhttp = getXmlHttpRequest();
	if(url){
		xmlhttp.open("GET", url, true);
		xmlhttp.onreadystatechange = function(){
			if(xmlhttp.readyState == 4){
				if(xmlhttp.status == 200){
					document.getElementById(area_name).innerHTML = xmlhttp.responseText;
				}else{
					//alert("Error loading "+url+", "+xmlhttp.status+"("+xmlhttp.statusText+")");
				}
				xmlhttp = null; // <-- ÀÌ°÷¿¡ Ãß°¡ 
			}
		}
		xmlhttp.send(null);
	}
	setTimeout("include_ajax_repeat('"+area_name+"','"+url+"','"+repeat_time+"')", repeat_time);//msec ¸¶´Ù ¼­¹ö¿Í Åë½ÅÇÔ
	return false;
}

// Å×ÀÌÅ¸ Àü¼Û¸¸ ÇÏ´Â ajax
function send_ajax(url){
	var xmlhttp = getXmlHttpRequest();
	if(url){
		xmlhttp.open("GET", url, true);
		xmlhttp.onreadystatechange = function(){
			if(xmlhttp.readyState == 4){
				if(xmlhttp.status == 200){
					//xmlhttp.responseText ¾Æ¹«Ã³¸® ¾ÈÇÑ´Ù.;
				}else{
					alert("Error loading "+url+", "+xmlhttp.status+"("+xmlhttp.statusText+")");
				}
				xmlhttp = null; // <-- ÀÌ°÷¿¡ Ãß°¡ 
			}
		}
		xmlhttp.send(null);
	}
	return;
}