/*******************************************************************************
 FILE          : common.js
 DESCRIPTIONS  : ÀÚ¹Ù½ºÅ©¸³Æ® °øÅë ¸ðµâ
 REMARKS       : °øÅëÀûÀ¸·Î ¾²ÀÌ´Â ÀÚ¹Ù½ºÅ©¸³Æ® ÇÔ¼ö
 DATE          : 2006-08-??

 *******************************************************************************/

/*ºê¶ó¿ìÀú XP¿©ºÎ Ã¼Å© */
var isXp = navigator.userAgent.indexOf('Windows NT 5.1') > 0;
var isIE = is_IE();
var bodyClick = {'x':0,'y':0};
var vn_screenx = screen.availWidth; // È­¸é½ºÅ©¸° ³ÐÀÌ
var vn_screeny = screen.availHeight; // È­¸é½ºÅ©¸° ³ôÀÌ

function is_IE() {
	if(navigator.appName && navigator.appName.indexOf("Microsoft") != -1) return true;
	else return false; 
}


//=============================================================================
// ¼³  ¸í: ¼ýÀÚ¸¸ ÀÔ·Â
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function numberCheck(){
	 if((event.keyCode < 48)||(event.keyCode > 57))  event.returnValue=false;
}


//=============================================================================
// ¼³  ¸í: ¼±ÅÃµÈ ¹Ú½º »ö»ó º¯°æ/º¹±¸
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function FocusColor(This) { 
	This.style.backgroundColor = "#F3F9F4"; 
}

function BlurColor(This) { 
	This.style.backgroundColor = "#FFFFFF";
}

//=============================================================================
// ¼³  ¸í: ÁöÁ¤µÈ À§Ä¡¿¡ »õÃ¢ ¿­±â
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function fn_clickWin(newPage,winNm,width,height){
	var iLeft;
	var iTop;
	iLeft = (window.screen.width/2) - ((width/2) + 10); 
	iTop = (window.screen.height/2) - ((height) + 50); 
	var winPopup;
	winPopup = window.open(newPage,winNm,'width='+width+',height='+height+',scrollbars=yes,resizable=no,menubar=no,status=no,toolbar=no,left='+iLeft+',top='+iTop+',screenX='+iLeft+',screenY='+iTop);
	winPopup.focus();
} 

function fn_clickWinNS(newPage,winNm,width,height){ //½ºÅ©·Ñ¹Ù ¾øÀ½
	var iLeft;
	var iTop;
	iLeft = (window.screen.width/2) - ((width/2) + 10); 
	iTop = (window.screen.height/2) - ((height/2)); 
	var winPopup;
	winPopup = window.open(newPage,winNm,'width='+width+',height='+height+',scrollbars=no,resizable=no,menubar=no,status=no,toolbar=no,left='+iLeft+',top='+iTop+',screenX='+iLeft+',screenY='+iTop);
	winPopup.focus();
} 

function fn_clickWinWithToolBar(newPage,winNm,width,height){
	var iLeft;
	var iTop;
	iLeft = screen.availWidth/2 - width/2; 
	iTop = screen.availHeight/2 - height/2; 
	var winPopup;
	winPopup = window.open(newPage,winNm,'width='+width+',height='+height+',scrollbars=yes,resizable=yes,menubar=yes,status=yes,toolbar=yes,location=yes,left='+iLeft+',top='+iTop+',screenX='+iLeft+',screenY='+iTop);
	winPopup.focus();
} 

function fn_clickWinWithFullScreen(newPage,winNm){
	var wid = screen.availWidth;
	var hei = screen.availHeight-150;
	var winPopup;
	winPopup = window.open(newPage,winNm,'width='+wid+',height='+hei+',scrollbars=yes,resizable=yes,menubar=yes,status=yes,toolbar=yes,location=yes,left=0,top=0,screenX=0,screenY=0');
	winPopup.focus();
} 

function fn_clickBlogWithToolBar(newPage,blogger, winNm,width,height){
	var wid = screen.availWidth;
	var hei = screen.availHeight-150;
	var winPopup;
	winPopup = window.open("http://beauty.aranchy.com/rank/moveBlog.jsp?blog="+newPage+"&blogger="+blogger,winNm,'width='+wid+',height='+hei+',scrollbars=yes,resizable=yes,menubar=yes,status=yes,toolbar=yes,location=yes,left=0,top=0,screenX=0,screenY=0');
	winPopup.focus();
} 

function fn_clickBlogBBSWithToolBar(newPage,blogger, idx, winNm,width,height){
	var wid = screen.availWidth;
	var hei = screen.availHeight-150;
	var winPopup;
	winPopup = window.open("http://beauty.aranchy.com/tag/moveBlogTagBBS.jsp?blog="+newPage+"&blogger="+blogger+"&idx="+idx,winNm,'width='+wid+',height='+hei+',scrollbars=yes,resizable=yes,menubar=yes,status=yes,toolbar=yes,location=yes,left=0,top=0,screenX=0,screenY=0');
	winPopup.focus();
} 

//=============================================================================
// ¼³  ¸í: ÀÚµ¿À¸·Î ¼±ÅÃµÈ À§Ä¡¿¡ Æ÷Ä¿½º
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function moveTab(from, leng,  dest) {	
	var obj = from.value;
	var len = leng;
	var destination = dest;
	var l = from.value.length;

	if(eval(l) == len){
		destination.focus();
	}
}

//=============================================================================
// ¼³  ¸í: ¼±ÅÃ ÅäÅ¬
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function selectToggle(what){
	if(document.all[what] == null) {
		alert("´ë»óÀÌ ¾ø½À´Ï´Ù.");
		return;
	}
	if(document.all[what].length > 0){
		for(i=0;i<document.all[what].length;i++) document.all[what][i].checked=!document.all[what][i].checked;
	}else document.all[what].checked=!document.all[what].checked;
}

// Åä±ÛÀÌ Ã¼Å©¹Ú½ºÀÓ
function selectToggleCheckbox(what, cbox){
	if(document.all[what] == null) {
		alert("´ë»óÀÌ ¾ø½À´Ï´Ù.");
		document.all[cbox].checked = false;
		return;
	}

	if(document.all[what].length > 0){
		for(i=0;i<document.all[what].length;i++) {
			document.all[what][i].checked=document.all[cbox].checked;
		}
	}else document.all[what].checked=document.all[cbox].checked;
}

//=============================================================================
// ¼³  ¸í: ÆÄÀÏ Ã·ºÎ½Ã ÀÌ¹ÌÁö¸¸ °¡´É
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function display_image(what){
	var file = what.value;
	var allowSubmit = false;
	var extArray = new Array(".gif", ".jpg", ".png");

	extArray.join(" ");

	if (!file) return;

	while (file.indexOf("\\") != -1)
			file = file.slice(file.indexOf("\\") + 1);

	var ext = file.slice(file.indexOf(".")).toLowerCase();

	for (var i = 0; i < extArray.length; i++) {
			if (extArray[i] == ext) {
					allowSubmit = true;
					break;
			}
	}

	if (allowSubmit) {
	}
	else {
			alert("±×¸² »ðÀÔÀº GIF, JPG, PNG ÆÄÀÏ¸¸ °¡´ÉÇÕ´Ï´Ù. ´Ù½Ã ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä.");
			what.select();
			document.selection.clear();
			return;
	}
}

//=============================================================================
// ¼³  ¸í: ÆÄÀÏ Ã·ºÎ½Ã Æ¯Á¤ È®ÀåÀÚ »ç¿ë ºÒ°¡´É
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function extTypeCheck(what, extExcept, delfile) {
	var file = what.value;

	if (!file) return;
	var ext			= file.slice(file.lastIndexOf (".")+1).toLowerCase();

	if(ext != "") {
		if(extExcept == '') {
		}else {
			if(extExcept.indexOf(ext) != -1) {
				alert(ext+" È®ÀåÀÚ´Â »ç¿ëÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				what.select();
				document.selection.clear();
				return;
			}
		}
	}

	if(document.getElementById(delfile)) {
		document.getElementById(delfile).checked = true;
	}
}


//=============================================================================
// ¼³  ¸í: Æ¯Á¤°Ç¿¡ ´ëÇÑ ÀÏ°ý »èÁ¦
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================
function listdelete(form, what){
	var sData = "";
	var flag=0;
	var j = 0;
	var dData = "";
	
	if(document.all[what] == undefined) {
		alert("´ë»óÀÌ ¾ø½À´Ï´Ù.");
		return;
	}

	if(document.all[what].length > 0){
		for(i=0;i<document.all[what].length;i++){
			if(document.all[what][i].checked){
				dData += document.all[what][i].value+"^";
				j++;
				flag=1;
			}
		}
	}else{
		if(document.all[what].checked) {
			flag=1;
			dData += document.all[what].value+"^";
		}
	}

	if(!flag){
		alert("´ë»óÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		return;
	}
	if(confirm("»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")){
		form.targetData.value=dData;
		form.submit();
	}else{
		return;
	}
	return;
}

//=============================================================================
// ¼³  ¸í: Æ¯Á¤°Ç¿¡ ´ëÇÑ ÀÏ°ý »èÁ¦
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================
function listdelete2(form, what){
	var sData = "";
	var flag=0;
	var j = 0;
	var dData = "";
	
	if(document.all[what] == undefined) {
		alert("´ë»óÀÌ ¾ø½À´Ï´Ù.");
		return;
	}

	if(document.all[what].length > 0){
		for(i=0;i<document.all[what].length;i++){
			if(document.all[what][i].checked){
				dData += document.all[what][i].value+"^";
				j++;
				flag=1;
			}
		}
	}else{
		if(document.all[what].checked) {
			flag=1;
			dData += document.all[what].value+"^";
		}
	}

	if(!flag){
		alert("´ë»óÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		return;
	}
	if(confirm("»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")){
		form.targetData.value=dData;
		form.submit();
	}else{
		return;
	}
	return;
}


//=============================================================================
// ¼³  ¸í: Æ¯Á¤°Ç¿¡ ´ëÇÑ ÀÏ°ý »èÁ¦
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================
function actionTargetDel(form, what){
	var sData = "";
	var flag=0;
	var j = 0;
	var dData = "";
	
	if(document.all[what] == undefined) {
		alert("´ë»óÀÌ ¾ø½À´Ï´Ù.");
		return;
	}

	if(document.all[what].length > 0){
		for(i=0;i<document.all[what].length;i++){
			if(document.all[what][i].checked){
				dData += document.all[what][i].value+"^";
				j++;
				flag=1;
			}
		}
	}else{
		if(document.all[what].checked) {
			flag=1;
			dData += document.all[what].value+"^";
		}
	}

	if(!flag){
		alert("´ë»óÀ» ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
		return;
	}

	if(confirm("»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")){
		form.targetData.value=dData;
		form.submit();
	}else{
		return;
	}
	return;
}

//=============================================================================
// ¼³  ¸í: ÀÌ¹ÌÁö³ª ÆÄÀÏÀ» ÀÔ·ÂÇÏ±â
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function add_file(obj, gubun, place) {
	winobj = window.open('/common/upload_form.jsp?obj='+obj+'&gubun='+gubun, 'event', 'width=400, height=150, top=200, left=200');
	winobj.focus();
}


function imgUpload(uploadDir, downloadDir){
	fn_clickWinNS('/common/img_upload_regist_form.jsp?prefile1='+strTrim(document.form1.file1.value)+"&seq=1&uploadDir="+uploadDir+"&downloadDir="+downloadDir,'imgUpload',420,170);
}

function imgSeqUpload(uploadDir, downloadDir, prefile, seq){
	fn_clickWinNS('/common/img_seq_upload_regist_form.jsp?prefile1='+strTrim(prefile)+"&seq="+seq+"&uploadDir="+uploadDir+"&downloadDir="+downloadDir+"&seq="+seq,'imgUpload',420,170);
}

function avatarUpload(prefile, uploadDir, downloadDir){
	fn_clickWinNS('/common/avatar_upload_regist_form.jsp?prefile1='+strTrim(prefile)+"&seq=1&uploadDir="+uploadDir+"&downloadDir="+downloadDir,'imgUpload',420,170);
}


function empFileUpload(seq, dir){
	if(seq == 1) {
		window.open("../common/file_upload_regist_form.jsp?prefile1="+strTrim(document.getElementById("file"+seq).value)+"&seq="+seq+"&uploadDir="+dir, "empFileUpload", "width=420,height=120,menubar=0,location=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,top=30,left=200");
	}else if(seq == 2) {
		window.open("../common/file_upload_regist_form.jsp?prefile2="+strTrim(document.getElementById("file"+seq).value)+"&seq="+seq+"&uploadDir="+dir, "empFileUpload", "width=420,height=120,menubar=0,location=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,top=30,left=200");
	}
}

function fileUpload(seq, uploadDir, downloadDir){
	if(seq == 1) {
		window.open("/common/file_upload_regist_form.jsp?prefile1="+strTrim(document.getElementById("file"+seq).value)+"&seq="+seq+"&uploadDir="+uploadDir+"&downloadDir="+downloadDir, "fileUpload", "width=420,height=170,menubar=0,location=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,top=30,left=200");
	}else if(seq == 2) {
		window.open("/common/file_upload_regist_form.jsp?prefile2="+strTrim(document.getElementById("file"+seq).value)+"&seq="+seq+"&uploadDir="+uploadDir+"&downloadDir="+downloadDir, "fileUpload", "width=420,height=170,menubar=0,location=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,top=30,left=200");
	}
}

function empFileUpload2(seq, dir){
	window.open("../common/file_upload_regist_form.jsp?prefile2="+strTrim(document.getElementById("file"+seq).value)+"&seq="+seq+"&uploadDir="+dir, "empFileUpload", "width=420,height=120,menubar=0,location=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,top=30,left=200");
}


ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

//=============================================================================
// ¼³  ¸í: ±ÛÀÚ¼ö Ç¥½Ã ¹× textarea ÃÖ´ë nÀÚ Ã¼Å©
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function checkLength(form, str,limit) {
	var obj = form;
	tlength = str.length+(escape(str)+"%u").match(/%u/g).length-1;
	
	var li_byte = 0;
	var i = 0;

	for (i=0; i<str.length; i++) {
		li_byte += (str.charCodeAt(i) > 128) ? 2 : 1;
		if(li_byte > limit) break;
	}

	if(li_byte > limit) {
		alert("ÃÖ´ë " + limit +" ÀÚ ±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù. ÃÊ°úµÈ ³»¿ëÀº ÀÚµ¿ »èÁ¦ µË´Ï´Ù.");
		TempVal = obj.content.value.substring(0,i);
		obj.content.value = ""
		obj.content.value = TempVal;
		var tvalue = limit;
		layerWrite('textlen',null,tvalue);
		return false;
	} else { 
		var tvalue = li_byte;
		layerWrite('textlen',null,tvalue);
	}
	var tvalue = li_byte;
	layerWrite('textlen',null,tvalue);
	if(obj.content.value == "") layerWrite('textlen',null,0);
}

function layerWrite(id,nestref,text) {
	if (ns4) {
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document
		lyr.open()
		lyr.write(text)
		lyr.close()
	}
	else if (ie4) document.all[id].innerHTML = text
}

function submit_com(str,limit) {
	var obj = document.frmcomment;

	if(obj.comments.value == "") {
		alert('³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä');
		obj.comments.focus();
		return;
	}
	
	tlength = str.length+(escape(str)+"%u").match(/%u/g).length-1;
	var li_byte = 0;
	var i = 0;

	for (i=0; i<str.length; i++) {
		li_byte += (str.charCodeAt(i) > 128) ? 2 : 1;
		if(li_byte > limit) break;
	}

	if(li_byte > limit) {
		alert("ÃÖ´ë " + limit +" ÀÚ ±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù");
		TempVal = obj.comments.value.substring(0,i);
		obj.comments.value = ""
		obj.comments.value = TempVal;
		return;
	}
	obj.submit();
}


//=============================================================================
// ¼³  ¸í: ÀÌ¹ÌÁö ·Ñ¿À¹ö / ·Ñ¾Æ¿ô
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================
function fnRollOver(oImg) {
	newSrc	= (oImg.src).replace(/_2.gif/g,"") + '.gif';
	oImg.src = newSrc;
}

function fnRollOut(oImg) {
	newSrc	= (oImg.src).replace(/.gif/g,"") + '_2.gif';
	oImg.src = newSrc;
}

function fnRollOver2(oImg) {
	newSrc	= (oImg.src).replace(/.gif/g,"") + '_2.gif';
	oImg.src = newSrc;
}

function fnRollOut2(oImg) {
	newSrc	= (oImg.src).replace(/_2.gif/g,"") + '.gif';
	oImg.src = newSrc;
}

function fnRollOver3(oImg) {
	newSrc	= (oImg.src).replace(/_off.gif/g,"") + '_over.gif';
	oImg.src = newSrc;
}

function fnRollOut3(oImg) {
	newSrc	= (oImg.src).replace(/_over.gif/g,"") + '_off.gif';
	oImg.src = newSrc;
}

function changePhotoImg(oImg, oCont) {
	if(oImg=="../images/common/blank.gif") {
	}else {
		newSrc = oImg;
		document.getElementById("bigImg").src=newSrc;
		document.getElementById("bigContent").innerHTML=oCont;
	}
	
}


//=============================================================================
// ¼³  ¸í: ÀÌ¸ÞÀÏ Ã¼Å©
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================
function email_chk(email) {
  var invalidChars = "\"|&;<>!*\'\\"   ;
  for (var i = 0; i < invalidChars.length; i++) {
    if (email.indexOf(invalidChars.charAt ) != -1) {
    //alert("Àß¸øµÈ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÔ´Ï´Ù.");
      return false;
    }
  }
  if (email.indexOf("@")==-1){
    //alert("Àß¸øµÈ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÔ´Ï´Ù. '@'°¡ ¾ø½À´Ï´Ù..");
    return false;
  }
  if (email.indexOf(" ") != -1){
    //alert("Àß¸øµÈ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÔ´Ï´Ù.");
    return false;
  }
  if (window.RegExp) {
    var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
    var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
    var reg1 = new RegExp (reg1str);
    var reg2 = new RegExp (reg2str);
 
    if (reg1.test(email) || !reg2.test(email)) {
    //alert("Àß¸øµÈ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÔ´Ï´Ù.");
      return false;
    }
  }
  return true;
}


//=============================================================================
// ¼³  ¸í: ÁÖ¹Î¹øÈ£ Ã¼Å©
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================
 function juminCheck(form){ 
  var strs = form.juminno1.value + form.juminno2.value;
  if((form.juminno1.value.length >= 6) && (form.juminno2.value.length >= 7)) { 
    juminno1 = form.juminno1.value; 
    juminno2 = form.juminno2.value; 
    check = false; 
    total = 0; 
    temp = new Array(13); 
 
    for(i=1; i<=6; i++) 
     temp[i] = juminno1.charAt(i-1); 
 
    for(i=7; i<=13; i++) 
     temp[i] = juminno2.charAt(i-7); 
 
    for(i=1; i<=12; i++)  { 
     k = i + 1; 
     if(k >= 10) 
     k = k % 10 + 2; 
 
     total = total + temp[i] * k; 
    } 
 
    mm = temp[3] + temp[4]; 
    dd = temp[5] + temp[6]; 
    totalmod = total % 11; 
    chd = 11 - totalmod; 
 
    if(chd ==11) { 
     chd =1; 
    }else if(chd==10) { 
     chd =0; 
    }; 

    if(chd == temp[13] && mm < 13 && dd < 32 && (temp[7]==1 || temp[7]==2|| temp[7]==3|| temp[7]==4)) check = true; 
 
    if((!check) &&(temp[7]!=5)&&(temp[7]!=6)){ 
     //alert("Àß¸øµÈ ÁÖ¹Îµî·Ï¹øÈ£ ÀÔ´Ï´Ù."); 
     //form.juminno1.value=""; 
     //form.juminno2.value=""; 
     //form.juminno1.select(); 
 
     return false; 
    } 
   } else { 
    //alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ Á¤È®È÷ ÀÔ·ÂÇÏÁö ¾Ê¾Ò½À´Ï´Ù."); 
    //form.juminno1.value = ""; 
    //form.juminno2.value = ""; 
    //form.juminno1.select(); 
    return false; 
   } 
  return true; 
 } 

//=============================================================================
// ¼³  ¸í: resizeTo¿¡¼­ Æø°ú ³ôÀÌ ¼ýÀÚ´Â ¿ÜºÎÃ¢ÀÇ Å©±â,  status ÀÖÀ» °æ¿ì
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function resizeToXP(reWidth, reHeight) {
 reWidth += 15;
 if (isXp) {
  reHeight += 58;
 } else {
  reHeight += 49;
 }
 self.resizeTo(reWidth, reHeight);
}

//=============================================================================
// ¼³  ¸í: resizeTo¿¡¼­ Æø°ú ³ôÀÌ ¼ýÀÚ´Â ¿ÜºÎÃ¢ÀÇ Å©±â,  status ¾øÀ» °æ¿ì
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function resizeToXPnostatus(reWidth, reHeight) {
 reWidth += 10;
 if (isXp) {
  reHeight += 58;
 } else {
  reHeight += 29;
 }
 self.resizeTo(reWidth, reHeight);
}


//=============================================================================
// ¼³  ¸í: ¸Þ´º º¯È­
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================
function menuSet(id) {
	document.all(id).style.display = '' ;
}


function menuClear() {
	document.all("layer_01").style.display = 'none' ;
	document.all("layer_02").style.display = 'none' ;
	document.all("layer_03").style.display = 'none' ;
	document.all("layer_04").style.display = 'none' ;
	document.all("layer_05").style.display = 'none' ;
	document.all("layer_06").style.display = 'none' ;
	document.all("layer_07").style.display = 'none' ;
}



//=============================================================================
// ¼³  ¸í: »óÇ° Ä«Å×°í¸® º¯È­
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================
function overM(obj,num) {
	var mtype = eval('mtype_' + num);
	mtype.style.display = 'block';
}

function outM(obj,num) {
	var mtype = eval('mtype_' + num);
	mtype.style.display = 'none';
}

function overMS(obj) {
	obj.style.background = '#f5f5f5';
}
function outMS(obj) {
	obj.style.background = 'FFFFFF';
}


//=============================================================================
// ¼³  ¸í: ÅÇ º¯È­
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================
function sectTab(n, total, imgName) {
	for(var i = 1; i < total; i++) {
		obj = document.getElementById('sectTab'+i);
		img = document.getElementById('sectTab_roll'+i);
		if ( n == i ) {
			obj.style.display = "block";
			img.src = imgName+"_"+i+"_on.gif";
		} else {
			obj.style.display = "none";
			img.src = imgName+"_"+i+".gif";
		}
	}
}

function sectTabA(n, total, imgName) {
	for(var i = 1; i < total; i++) {
		obj = document.getElementById('sectTabA'+i);
		img = document.getElementById('sectTabA_roll'+i);
		if ( n == i ) {
			obj.style.display = "block";
			img.src = imgName+""+i+"_on.gif";
		} else {
			obj.style.display = "none";
			img.src = imgName+""+i+".gif";
		}
	}
}

function sectTabB(n, total, imgName) {
	for(var i = 1; i < total; i++) {
		obj = document.getElementById('sectTabB'+i);
		img = document.getElementById('sectTabB_roll'+i);
		if ( n == i ) {
			obj.style.display = "block";
			img.src = imgName+"_"+i+"_2.gif";
		} else {
			obj.style.display = "none";
			img.src = imgName+"_"+i+".gif";
		}
	}
}

function sectTabC(n, total, imgName) {
	for(var i = 1; i < total; i++) {
		obj = document.getElementById('sectTabC'+i);
		img = document.getElementById('sectTabC_roll'+i);
		if ( n == i ) {
			obj.style.display = "block";
			img.src = imgName+"_"+i+"_2.gif";
		} else {
			obj.style.display = "none";
			img.src = imgName+"_"+i+".gif";
		}
	}
}

function sectTabMainA(n, total) {
	for(var i = 1; i < total; i++) {
		obj = document.getElementById('sectTabMainA'+i);
		img = document.getElementById('sectTabMainA_roll'+i);

		if ( n == i ) {
			obj.style.display = "block";
			img.style.backgroundImage = "url(/images/main/new/tab_over.gif)";
			//img.className = "pink_s_b";
			//img.src = imgName+"_"+i+"_on.gif";
		} else {
			obj.style.display = "none";
			img.style.backgroundImage = "url(/images/main/new/tab_off.gif)";
			img.className = "small";
			//img.src = imgName+"_"+i+".gif";
		}
	}
}

function sectTabMainP(n, total) {
	for(var i = 1; i < total; i++) {
		obj = document.getElementById('sectTabMainP'+i);
		img = document.getElementById('sectTabMainP_roll'+i);

		if ( n == i ) {
			obj.style.display = "block";
			img.style.backgroundImage = "url(/images/main/new/tab_over.gif)";
			//img.className = "pink_s_b";
			//img.src = imgName+"_"+i+"_on.gif";
		} else {
			obj.style.display = "none";
			img.style.backgroundImage = "url(/images/main/new/tab_off.gif)";
			img.className = "small";
			//img.src = imgName+"_"+i+".gif";
		}
	}
}

function sectTabMainR(n, total) {
	for(var i = 1; i < total; i++) {
		obj = document.getElementById('sectTabMainR'+i);
		img = document.getElementById('sectTabMainR_roll'+i);

		if ( n == i ) {
			obj.style.display = "block";
			img.style.backgroundImage = "";
			//img.className = "pink_s_b";
			//img.src = imgName+"_"+i+"_on.gif";
		} else {
			obj.style.display = "none";
			img.style.backgroundImage = "url(/images/main/new/tab_off2.gif)";
			img.className = "small_b";
			//img.src = imgName+"_"+i+".gif";
		}
	}
}


//=============================================================================
// ¼³  ¸í: ¼ýÀÚ ÀÔ·Â½Ã ÀÚµ¿ , »ðÀÔ
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function substrThree2(num){ 
	var sign=""; 
	if(isNaN(num)) {
		alert("¼ýÀÚ¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.");
		return 0;
	} 
	if(num==0) {
		return num;
	}

	if(num<0){ 
		num=num*(-1);
		sign="-";
	}else{ 
		num=num*1;
	} 
	num = new String(num) 
	var temp="";
	var pos=3;
	num_len=num.length;
	while (num_len>0){ 
		num_len=num_len-pos;
		if(num_len<0) {
			pos=num_len+pos;
			num_len=0;
		} 
		temp=","+num.substr(num_len,pos)+temp;
	} 
	return sign+temp.substr(1); 
} 

function substrThree(num){ 
	num=new String(num); 
	num=num.replace(/,/gi,"");
	return substrThree2(num);
} 

//=============================================================================
// ¼³  ¸í: ÀÌ¸ÞÀÏ Ã¼Å©
// ÀÛ¾÷ÀÏ: 2006-08-??
// ÀÛ¾÷ÀÚ: ¹Ú¿µ¼ú
//=============================================================================

function emailChk(email) {
  var invalidChars = "\"|&;<>!*\'\\"   ;
  for (var i = 0; i < invalidChars.length; i++) {
    if (email.indexOf(invalidChars.charAt ) != -1) {
    //alert("Àß¸øµÈ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÔ´Ï´Ù.");
      return false;
    }
  }
  if (email.indexOf("@")==-1){
    //alert("Àß¸øµÈ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÔ´Ï´Ù. '@'°¡ ¾ø½À´Ï´Ù..");
    return false;
  }
  if (email.indexOf(" ") != -1){
    //alert("Àß¸øµÈ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÔ´Ï´Ù.");
    return false;
  }
  if (window.RegExp) {
    var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
    var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
    var reg1 = new RegExp (reg1str);
    var reg2 = new RegExp (reg2str);
 
    if (reg1.test(email) || !reg2.test(email)) {
    //alert("Àß¸øµÈ ÀÌ¸ÞÀÏ ÁÖ¼ÒÀÔ´Ï´Ù.");
      return false;
    }
  }
  return true;
}


function isCheckResidentID(id0, id1) {
	var id0 = String(id0);
	var id1 = String(id1);
	var id = id0+id1;
	var sum = 0;
	var digit = id.substring(12, 13);
	for (var i = 0; i<12; i++) {
		if (i<8) {
						sum += id.substring(i, i+1)*(i+2);
		} else {
						sum += id.substring(i, i+1)*(i-6);
		}
	}
	var magicDigit = (11-sum%11)%10;
	if (magicDigit == digit) {
		return true;
	} else {
		return false;
	}
}


function removelist() {
	fromAttender = document.form1.fromUser;
	toAttender = document.form1.toUser;

	var attLen_1 = fromAttender.options.length;
	var attLen_2 = toAttender.options.length;

	for (i=0; i<attLen_2; i++) {
		if(toAttender.options[i].selected) {
			fromAttender[attLen_1] = new Option(toAttender[toAttender.selectedIndex].text, fromAttender.value );
			toAttender.options[i] = null;
			attLen_2--;
			i--;
			continue;
		}
	}
	//return true;
}

function removelist2(val) {
	fromAttender = document.form1.fromUser;
	toAttender = document.form1.toUser;

	var attLen_1 = fromAttender.options.length;
	var attLen_2 = toAttender.options.length;

	for (i=0; i<attLen_2; i++) {
		if(toAttender.options[i].selected) {
			fromAttender[attLen_1] = new Option(toAttender[toAttender.selectedIndex].text, fromAttender.value );
			toAttender.options[i] = null;
			attLen_2--;
			i--;
			continue;
		}
	}
	//return true;
}


function addlist() {
	fromAttender = document.form1.fromUser;
	toAttender = document.form1.toUser;

	var attLen_1 = fromAttender.options.length;
	var attLen_2 = toAttender.options.length;

	for (i=0; i<attLen_1; i++) {
		if(fromAttender.options[i].selected) {
			toAttender[attLen_2] = new Option(fromAttender[fromAttender.selectedIndex].text, fromAttender.value );
			fromAttender.options[i] = null;
			attLen_1--;
			i--;
			continue;
		}
	}
	//return true;
}


function addlist2(val) {
	fromAttender = document.form1.fromUser;
	toAttender = document.form1.toUser;

	var attLen_1 = fromAttender.options.length;
	var attLen_2 = toAttender.options.length;

	for (i=0; i<attLen_1; i++) {
		if(fromAttender.options[val].selected) {
			toAttender[attLen_2] = new Option(fromAttender[fromAttender.selectedIndex].text, fromAttender.value );
			fromAttender.options[val] = null;
			attLen_1--;
			i--;
			continue;
		}
	}
	//return true;
}

function addUserlist(department, userid, username, rank, userpcs) {
	toAttender = document.form1.toUser;
	var attLen_2 = toAttender.options.length;
	for (i=0; i<attLen_2; i++) {
		if(userid+'|'+username+'|'+userpcs == toAttender.options[i].value) {
			alert('ÀÌ¹Ì ¼±ÅÃµÇ¾îÁ® ÀÖ½À´Ï´Ù.');
			return;
		}
	}
	toAttender[attLen_2] = new Option('['+department+'] '+username+' '+rank, userid+'|'+username+'|'+userpcs);
	//return true;
}

function removeUserlist(val) {
	if(confirm("»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")) {
		toAttender = document.form1.toUser;
		var attLen_2 = toAttender.options.length;

		for (i=0; i<attLen_2; i++) {
			if(toAttender.options[i].selected) {
				toAttender.options[i] = null;
				attLen_2--;
				i--;
				continue;
			}
		}
	}else {
	}
	//return true;
}


//iframe Å©±â µ¿ÀûÀ¸·Î º¯°æ
function resize_it(f_height, position){
  document.all[position].style.height=f_height; //iframe »çÀÌÁî Á¶Àý
}


//°ø¹éÁ¦°Å
function strTrim(str) {
	return str.replace(/(^\s*)|(\s*$)/g, "");
}


//Æ¯¼ö¹®ÀÚ
function checkSpecialChar(expression) {
	var strSpecial = " ,`~!@?%#$%^&*+|\;\\/:=-<>'\" "; 
	for(i=0;i<expression.length;i++) {
		for(j=0;j<strSpecial.length;j++) {
			if(expression.charAt(i) == strSpecial.charAt(j)) {
				return false;   // Æ¯¼ö¹®ÀÚ°¡ ÀÖÀ¸¸é.. false
			}
		}
	}
	return true;
}

//Æ¯¼ö¹®ÀÚ¿­
function checkSpecialString(expression) {
	expression = expression.toLowerCase();
	if(
		(expression.indexOf("script") != -1)	||
		(expression.indexOf("exec") != -1)		||
		(expression.indexOf("insert") != -1)	||
		(expression.indexOf("update") != -1)	||
		(expression.indexOf("delete") != -1)	||
		(expression.indexOf("select") != -1)	||
		(expression.indexOf("declare") != -1)	||
		(expression.indexOf("union") != -1)		||
		(expression.indexOf("drop") != -1)		||
		(expression.indexOf("create") != -1)	||
		(expression.indexOf("sysobject") != -1)		||
		(expression.indexOf("syscolumn") != -1)	||
		(expression.indexOf("alter table") != -1)		||
		(expression.indexOf("alter column") != -1)	||
		(expression.indexOf("sp_") != -1)			||
		(expression.indexOf("xp_") != -1)			||
		(expression.indexOf("iframe") != -1)  ) {
			return false;   // Æ¯¼ö¹®ÀÚ¿­ÀÌ ÀÖÀ¸¸é.. false
	}
	return true;
}

//Æ¯¼ö¹®ÀÚ¿­
function checkSpecialString2(expression) {
	expression = expression.toLowerCase();
	if(
		(expression.indexOf("<script") != -1)	||
		(expression.indexOf("</script") != -1)	||
		(expression.indexOf("sysobject") != -1)		||
		(expression.indexOf("syscolumn") != -1)	||
		(expression.indexOf("sp_") != -1)			||
		(expression.indexOf("xp_") != -1))			{
			return false;   // Æ¯¼ö¹®ÀÚ¿­ÀÌ ÀÖÀ¸¸é.. false
	}
	return true;
}

//ÀÌ¹ÌÁö È®ÀåÀÚ Ã¼Å©
function checkImageExt(expression) {
	expression = expression.toLowerCase();
	if(
		(expression.indexOf("gif") != -1)	||
		(expression.indexOf("jpg") != -1)		||
		(expression.indexOf("jpeg") != -1)	||
		(expression.indexOf("png") != -1)) {
			return true;   // ÀÌ¹ÌÁö È®ÀåÀÚ°¡ ÀÖÀ¸¸é true
	}
	return false;
}

function isUndefined(a) {
	if(typeof a == 'undefined') return true;
	else return false;
 } 

function isValidFormat(input,format) {
	if (input.search(format) != -1) {
			return true; //¿Ã¹Ù¸¥ Æ÷¸Ë Çü½Ä
	}
	return false;
}

function isValidPhone(input) {	
	var format = /^(\d+)-(\d+)-(\d+)$/;
	return isValidFormat(input,format);
}

function isValidYYYYMM(input) {	
	var format = /^(\d+)-(\d+)$/;
	return isValidFormat(input,format);
}

function isValidYYYYMMDD(input) {	
	var format = /^(\d+)-(\d+)-(\d+)$/;
	return isValidFormat(input,format);
}

//¹®ÀÚ ¹Ù²Ù±â, »ç¿ë¹ý var str = ¹®ÀÚ¿­.replaceAll("a", "1");  
String.prototype.trim = function(){
	return this.replace(/(^\s*)|(\s*$)/gi, "");
}

String.prototype.replaceAll = function(str1, str2) {
	var temp_str = "";
	if (this.trim() != "" && str1 != str2) {
		temp_str = this.trim();
		while (temp_str.indexOf(str1) > -1){
				temp_str = temp_str.replace(str1, str2);
		}
	}
	return temp_str;
}


//º¹»ç ±ÝÁö
function ctrlVRestrict() {
	if(event.ctrlKey  && event.keyCode ==86){ 
		alert("ºÙ¿©³Ö±â´Â »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù");
		event.returnValue = false; 
	}    
}


function ctrlV(source) {
	var header = "";

	if (window.clipboardData) {        
		window.clipboardData.setData("Text", source); 
	}else if (window.netscape) {
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
		if (!clip) return;       
		var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);        
		if (!trans) return;        
		trans.addDataFlavor('text/unicode');        
		var str = new Object();        
		var len = new Object();        
		var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);        
		var copytext=source;        
		str.data=copytext;        
		trans.setTransferData("text/unicode",str,copytext.length*2);        
		var clipid=Components.interfaces.nsIClipboard;        
		if (!clip) return false;        
		clip.setData(trans,null,clipid.kGlobalClipboard);    
	}
	alert('¼Ò½º°¡ º¹»çµÇ¾ú½À´Ï´Ù.\n\nCTRL+v ¸¦ ÀÌ¿ëÇÏ¿© ºÙ¿©³Ö±â¸¦ ÇÏ½Ã¸é µË´Ï´Ù.');
}

function MM_preloadImages() { file://v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


/**
 * ÄÞ¸¶Á¦°Å
 * param : val
 * return : ±Ý¾×
 */
function removeComma(val){ 
	val = new String(val); 
	val = val.replace(/,/gi,"");	
	return val;
} 


/**
 * 3ÀÚ¸®¸¶´Ù ÄÞ¸¶
 * param : val
 * return : ±Ý¾×
 */
function signMoneyType(val){ 
	val = new String(val); 
	val = val.replace(/,/gi,"");	
	return signMoneyDetailType(val);
} 

function signMoneyDetailType(val){ 
 	var sign=""; 
	
	if(val == "") val = 0;

 	if(val == 0) {
		return val;
	}

 	val = new String(val)

	var temp="";
	var pos=3;
	val_len=val.length;

	while(val_len>0) {
		val_len=val_len-pos;
		if(val_len < 0) {
			pos=val_len+pos;
			val_len=0;
		} 
    temp=","+val.substr(val_len,pos)+temp;
  } 
  return sign+temp.substr(1); 
} 


/**
 * Å°º¸µå ´­¸² (¼ýÀÚ) Ã¼Å©.(','±îÁö ±¦ÂúÀ½)
 * ¿£ÅÍÅ° Á¦¿Ü
 * param : sVal ÀÔ·Â½ºÆ®¸µ
 * return : Boolean  TrueÀÌ¸é ¼ýÀÚ°ª
 */
function getOnlyNumberComma() {
	if((event.keyCode < 48)||(event.keyCode > 57))  {
		if(event.keyCode==13 || event.keyCode == 188 || event.keyCode == 44 ) {
		}else {
			alert("¼ýÀÚ¿Í ÄÞ¸¶(,)¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù.");
			event.returnValue=false;
		}
	}
}


/**
 * ÀÌ¹ÌÁöÅ©°Ôº¸±â
 */
String.prototype.popupView = function () {
    var img_view = this;
    var x = x + 20 ;
    var y = y + 30 ;
    htmlz = "<html><head><title>ÀÌ¹ÌÁöÅ© °Ôº¸±â</title><style>body{margin:0;cursor:hand;}</style></head><body scroll=auto onload='width1=document.all.Timage.width;if(width1>1024)width1=1000;height1=document.all.Timage.height;if(height1>768)height1=700;top.window.resizeTo(width1+30,height1+90);' onclick='top.window.close();'><img src='"+img_view+"'  title='Å¬¸¯ÇÏ½Ã¸é ´ÝÈü´Ï´Ù.' name='Timage' id='Timage'></body></html>"
    imagez = window.open('', "image", "width="+ 100 +", height="+ 100 +", top=0,left=0,scrollbars=auto,resizable=1,toolbar=0,menubar=0,location=0,directories=0,status=1");
    imagez.document.open();
    imagez.document.write(htmlz)
    imagez.document.close();
}



function frame_init(){
 parent.reSize();
 var locate = parent.document.location.href;
}

function iFrameResize(obj) {

	try {
		if ( window.navigator.appName.indexOf("Explorer") !=-1 ) {
			var doc = obj.contentWindow.document;
			var h = doc.body.scrollHeight;
		}else {
			var doc = obj.contentWindow.document;
			var s = doc.body.appendChild(document.createElement('DIV'));
			s.style.clear = 'both';
			var h = s.offsetTop;
			s.parentNode.removeChild(s);
		}
		obj.style.height = h + 'px';
		setTimeout(function(){ iFrameResize(obj) }, 200); // check 5 times for IE bug
	}catch (e){ 
		//alert(e);
	}
}

function myPageRssResize(obj) {

	try {
		if ( window.navigator.appName.indexOf("Explorer") !=-1 ) {
			var doc = obj.contentWindow.document;
			var h = doc.body.scrollHeight;
		}else {
			var doc = obj.contentWindow.document;
			var s = doc.body.appendChild(document.createElement('DIV'));
			s.style.clear = 'both';
			var h = s.offsetTop;
			s.parentNode.removeChild(s);
		}
		obj.style.height = h + 'px';
		setTimeout(function(){ iFrameResize(obj) }, 200); // check 5 times for IE bug
	}catch (e){ 
		//alert(e);
	}
}


function content_print(id){    
	var initBody = document.body.innerHTML;
	window.onbeforeprint = function(){
		document.body.innerHTML = document.getElementById(id).innerHTML;
	}
	window.onafterprint = function(){
		document.body.innerHTML = initBody;	
	}
	window.print();  
	location.reload();
}            


function content_print_direct(target){    
	var initBody = document.body.innerHTML;
	window.onbeforeprint = function(){
		document.body.innerHTML = target;
	}
	window.onafterprint = function(){
		document.body.innerHTML = initBody;	
	}
	window.print();  
	location.reload();
}            



//--------------------------------------------------------------------------------------------------------------
function emailSend() { 
	if (document.emailForm.email.value==""){
		alert("ÀÌ¸ÞÀÏ ÁÖ¼Ò¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä");
		document.emailForm.email.focus();
		return false;
	}
	if (document.emailForm.title.value=="") {
		alert("ÀÌ¸ÞÀÏ Á¦¸ñÀ» ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä");
		document.emailForm.title.focus();
		return false;
	}
	var pars= Form.serialize($('emailForm'));
	var url = "/common/article_email_regist.jsp";
	new Ajax.Updater('messageBox', url, {parameters: pars, asynchronous:true, evalScripts: true } );
}

function userArticleEmailSend() { 
	if (document.emailForm.email.value==""){
		alert("ÀÌ¸ÞÀÏ ÁÖ¼Ò¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä");
		document.emailForm.email.focus();
		return false;
	}
	if (document.emailForm.title.value=="") {
		alert("ÀÌ¸ÞÀÏ Á¦¸ñÀ» ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä");
		document.emailForm.title.focus();
		return false;
	}
	var pars= Form.serialize($('emailForm'));
	var url = "/common/user_article_email_regist.jsp";
	new Ajax.Updater('messageBox', url, {parameters: pars, asynchronous:true, evalScripts: true } );
}


function clientCoords(e) {
	var tempX = 0;
	var tempY = 0;  
	var browser = navigator.appName
	if(is_IE()) {   //ºê¶ó¿ìÀú°¡ IEÀÏ¶§ µ¹¾Æ°£´Ù. Å©·Ò¿¡¼­ ½áµµ Àß µÈ´Ù.
		tempX = event.clientX + document.body.scrollLeft;
		tempY = event.clientY + document.body.scrollTop;
		if (tempX < 0){tempX = 0;}
		if (tempY < 0){tempY = 0;}  
	}else {//±×¿Ü(ÆÄÀÌ¾îÆø½º)ÀÏ ¶§ µ¹¾Æ°£´Ù.
		tempX = e.clientX + document.body.scrollLeft;
		tempY = e.clientY + document.body.scrollTop;
		if (tempX < 0){tempX = 0;}
		if (tempY < 0){tempY = 0;}  
	}
	alert(tempY);
	return tempY;
}


//---------------¶ó¿îµå ¸¸µé±â----------------------------------------------------------------------------------
function makeRound(objID) {
	 var obj = document.getElementById(objID);
	 var Parent, objTmp, Table, TBody, TR, TD;
	 var bdcolor, bgcolor, Space;
	 var trIDX, tdIDX, MAX;
	 var styleWidth, styleHeight;

	 Parent = obj.parentNode;
	 objTmp = document.createElement('SPAN');
	 Parent.insertBefore(objTmp, obj);
	 Parent.removeChild(obj);

	 bdcolor = obj.getAttribute('rborder');
	 bgcolor = obj.getAttribute('rbgcolor');
	 radius = parseInt(obj.getAttribute('radius'));
	 if (radius == null || radius < 1) radius = 1;
	 else if (radius > 6) radius = 6;

	 MAX = radius * 2 + 1;

	 Table = document.createElement('TABLE');
	 TBody = document.createElement('TBODY');

	 Table.cellSpacing = 0;
	 Table.cellPadding = 0;

	 for (trIDX=0; trIDX < MAX; trIDX++) {
			TR = document.createElement('TR');
			Space = Math.abs(trIDX - parseInt(radius));
			for (tdIDX=0; tdIDX < MAX; tdIDX++) {
				 TD = document.createElement('TD');
				 
				 styleWidth = '1px'; styleHeight = '1px';
				 if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
				 else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
				 else if (radius > 2) {
						if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
						if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
				 }

				 if (styleWidth != null) TD.style.width = styleWidth;
				 if (styleHeight != null) TD.style.height = styleHeight;

				 if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
				 else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = bgcolor;
				 
				 if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
				 TR.appendChild(TD);
			}
			TBody.appendChild(TR);
	 }
	 Table.appendChild(TBody);
	 Parent.insertBefore(Table, objTmp);
}

//---------------Å×µÎ¸® Á¡¼± ¾ø¾Ö±â----------------------------------------------------------------------------------
function bluring(){ 
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
}


//--------------------------------------------------------------------------------------------------------------
function postingURLModify() { 
	if (document.postingURLForm.postingID.value==""){
		alert("ID¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä");
		document.postingURLForm.postingID.focus();
		return false;
	}
	if (document.postingURLForm.postingPasswd.value=="") {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä");
		document.postingURLForm.postingPasswd.focus();
		return false;
	}

	if(document.postingURLForm.autoCheck.checked) {
		if(document.postingURLForm.oldGubun.value=="ºäÆ¼´©¸®") {
			document.postingURLForm.autoPostingYN.value = "Y";
		}else {
			if(document.postingURLForm.defaultCategory.value == "") {
				alert("ÀÚµ¿Æ÷½ºÆÃ»ç¿ëÀ» ¼±ÅÃÇÏ¼Ì½À´Ï´Ù.\n±ÛÀÌ µî·ÏµÉ¼ö ÀÖ´Â Ä«Å×°í¸®¸¦ ÁöÁ¤ÇØ ÁÖ¼¼¿ä.");
				return false;
			}else {
				document.postingURLForm.autoPostingYN.value = "Y";
			}
		}
	}else {
		document.postingURLForm.autoPostingYN.value = "N";
	}

	var pars= Form.serialize($('postingURLForm'));
	var url = "/common/posting_url_modify.jsp";
	new Ajax.Updater('messageBox', url, {parameters: pars, asynchronous:true, evalScripts: true } );
}

function postingURLRegist() { 
	var i;
  var ch;

	if (strTrim(document.postingURLForm.name.value)==""){
		alert("Æ÷½ºÆÃÀÌ¸§À» ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä");
		document.postingURLForm.name.focus();
		return false;
	}
	if (document.postingURLForm.typeCheck[0].checked && strTrim(document.postingURLForm.daumurl.value)=="") {
		alert("´ÙÀ½ºí·Î±× ID¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä\n\n¿¹)http://blog.daum.net/test");
		document.postingURLForm.daumurl.focus();
		return false;
	}
	for (i=0;i<document.postingURLForm.daumurl.value.length;i++) {
		ch = escape(document.postingURLForm.daumurl.value.charAt(i));        //ISO-Latin-1 ¹®ÀÚ¼ÂÀ¸·Î º¯°æ
		if (strCharByte(ch) == 2) { //ÇÑ±ÛÀÏ°æ¿ì
			alert("´ÙÀ½ºí·Î±× ID¿¡ ÇÑ±ÛÀ» »ç¿ëÇÒ¼ö ¾ø½À´Ï´Ù.");
			return false;
		}
	}
	if (document.postingURLForm.typeCheck[1].checked && strTrim(document.postingURLForm.naverurl.value)=="") {
		alert("³×ÀÌ¹öºí·Î±× ID¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä\n\n¿¹)http://blog.naver.com/test");
		document.postingURLForm.naverurl.focus();
		return false;
	}
	for (i=0;i<document.postingURLForm.naverurl.value.length;i++) {
		ch = escape(document.postingURLForm.naverurl.value.charAt(i));        //ISO-Latin-1 ¹®ÀÚ¼ÂÀ¸·Î º¯°æ
		if (strCharByte(ch) == 2) { //ÇÑ±ÛÀÏ°æ¿ì
			alert("³×ÀÌ¹öºí·Î±× ID¿¡ ÇÑ±ÛÀ» »ç¿ëÇÒ¼ö ¾ø½À´Ï´Ù.");
			return false;
		}
	}
	if (document.postingURLForm.typeCheck[2].checked && strTrim(document.postingURLForm.tistoryurl.value)=="") {
		alert("Æ¼½ºÅä¸®ºí·Î±× ID¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä\n\n¿¹)http://test.tistory.com/");
		document.postingURLForm.tistoryurl.focus();
		return false;
	}
	for (i=0;i<document.postingURLForm.tistoryurl.value.length;i++) {
		ch = escape(document.postingURLForm.tistoryurl.value.charAt(i));        //ISO-Latin-1 ¹®ÀÚ¼ÂÀ¸·Î º¯°æ
		if (strCharByte(ch) == 2) { //ÇÑ±ÛÀÏ°æ¿ì
			alert("Æ¼½ºÅä¸®ºí·Î±× ID¿¡ ÇÑ±ÛÀ» »ç¿ëÇÒ¼ö ¾ø½À´Ï´Ù.");
			return false;
		}
	}
	if (document.postingURLForm.typeCheck[3].checked && strTrim(document.postingURLForm.paranurl.value)=="") {
		alert("ÆÄ¶õºí·Î±× ID¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä\n\n¿¹)http://blog.paran.com/test");
		document.postingURLForm.paranurl.focus();
		return false;
	}
	for (i=0;i<document.postingURLForm.paranurl.value.length;i++) {
		ch = escape(document.postingURLForm.paranurl.value.charAt(i));        //ISO-Latin-1 ¹®ÀÚ¼ÂÀ¸·Î º¯°æ
		if (strCharByte(ch) == 2) { //ÇÑ±ÛÀÏ°æ¿ì
			alert("ÆÄ¶õºí·Î±× ID¿¡ ÇÑ±ÛÀ» »ç¿ëÇÒ¼ö ¾ø½À´Ï´Ù.");
			return false;
		}
	}
	if (strTrim(document.postingURLForm.postingID.value)=="") {
		alert("Æ÷½ºÆÃÁÖ¼ÒID¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä");
		document.postingURLForm.postingID.focus();
		return false;
	}
	if (strTrim(document.postingURLForm.postingPasswd.value)=="") {
		alert("Æ÷½ºÆÃÁÖ¼Ò ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ½Ê½Ã¿ä");
		document.postingURLForm.postingPasswd.focus();
		return false;
	}

	if(document.postingURLForm.autoCheck.checked) {
		if(document.postingURLForm.typeCheck[4].checked) {
			document.postingURLForm.autoPostingYN.value = "Y";
		}else {
			if(document.postingURLForm.defaultCategory.value == "") {
				alert("ÀÚµ¿Æ÷½ºÆÃ»ç¿ëÀ» ¼±ÅÃÇÏ¼Ì½À´Ï´Ù.\n±ÛÀÌ µî·ÏµÉ¼ö ÀÖ´Â Ä«Å×°í¸®¸¦ ÁöÁ¤ÇØ ÁÖ¼¼¿ä.");
				return false;
			}else {
				document.postingURLForm.autoPostingYN.value = "Y";
			}
		}
	}else {
		document.postingURLForm.autoPostingYN.value = "N";
	}
	var pars= Form.serialize($('postingURLForm'));
	var url = "/common/posting_url_regist.jsp";
	new Ajax.Updater('messageBox', url, {parameters: pars, asynchronous:true, evalScripts: true } );
}

//------------DIV SCROLL
function nowheel(e) {
	if(!isIE) {
		e.preventDefault();
	}
	return false;
}

function wheel_splayer(e) {
	var divBody = document.getElementById('scrollBody');
	var wheelAmount = 100;
	var wheelDirection;
	if(isIE)
		wheelDirection = -1*event.wheelDelta/Math.abs(event.wheelDelta);
	else
		wheelDirection = e.detail/Math.abs(e.detail);
	divBody.scrollTop += wheelDirection*wheelAmount;
}

function wheel_splayer_iframe(evt) {
	window.frameWin = document.getElementById('cFrame').contentWindow;
	evt = evt || frameWin.event;
	var delta = evt.wheelDelta;
	var scrollDiff = 50;
	scrollDiff = scrollDiff * delta/Math.abs(delta);
	frameWin.document.documentElement.scrollTop -= scrollDiff;
}

//ÀÔ·Â ¹®ÀÚ ÇÑ±Û Ã¼Å©
function strCharByte(chStr) {
	if (chStr.substring(0, 2) == '%u') {
		if (chStr.substring(2,4) == '00')
			return 1;
		else
			return 2;        //ÇÑ±Û
	} else if (chStr.substring(0,1) == '%') {
			if (parseInt(chStr.substring(1,3), 16) > 127)
				return 2;        //ÇÑ±Û
			else
				return 1;
	} else {
				return 1;
	}
}

/**
 * Form¿ÀºêÁ§Æ® ¾È¿¡ ÀÖ´Â ÄÁÆ®·ÑÀ» QueryStringÀ¸·Î ±¸¼ºÇÑ´Ù. ÀÌ¶§, ÇÑ±ÛÀº ÀÎÄÚµùÇÏÁö ¾Ê´Â´Ù.
 * @param : form      - ÀÌµ¿ ¿øº» SheetÀÇ Object id
 * @return : Form¿ÀºêÁ§Æ® ¾È¿¡ ControlÀ» QueryStringÀ¸·Î ±¸¼ºÇÑ ¹®ÀÚ¿­
 * @version : 1.0.0.0
 * @sample
 *  var sCondParam=FormQueryString(document.frmSearch);
 */

function FormQueryString(form) {
  if (typeof form != "object" || form.tagName != "FORM") {
    alert("FormQueryStringÇÔ¼öÀÇ ÀÎÀÚ´Â FORM ÅÂ±×°¡ ¾Æ´Õ´Ï´Ù.");
    return "";
  }
  
	var name = new Array(form.elements.length); 
	var value = new Array(form.elements.length); 
	var j = 0;
	var plain_text="";

	//»ç¿ë°¡´ÉÇÑ ÄÁÆ®·ÑÀ» ¹è¿­·Î »ý¼ºÇÑ´Ù.
	len = form.elements.length; 
	for (i = 0; i < len; i++) {
	  switch (form.elements[i].type) {
	    case "button":
	    case "reset":
	    case "submit":
	      break;
	    case "radio":
	    case "checkbox":
  				if (form.elements[i].checked == true) {
  					name[j] = form.elements[i].name; 
  					value[j] = form.elements[i].value;
  					j++;
  				}
  				break;
  		case "select-one":
  				name[j] = form.elements[i].name; 
					var ind = form.elements[i].selectedIndex;
					if(ind >= 0) {
						if (form.elements[i].options[ind].value != '')
							value[j] = form.elements[i].options[ind].value;
						else
							value[j] = form.elements[i].options[ind].text;
					} else {
						value[j] = "";
					}
					j++;
					break;
			case "select-multiple":
  				name[j] = form.elements[i].name; 
					var llen = form.elements[i].length;
					var increased = 0;
					for( k = 0; k < llen; k++) {
						if (form.elements[i].options[k].selected) {
							name[j] = form.elements[i].name; 
							if (form.elements[i].options[k].value != '')
								value[j] = form.elements[i].options[k].value;
							else
								value[j] = form.elements[i].options[k].text;
							j++;
							increased++;
						}
					}
					if(increased > 0) {
						j--;
					} else {
						value[j] = "";
					}
					j++;
					break;
				default :
  				name[j] = form.elements[i].name; 
					value[j] = form.elements[i].value;
  				j++;
		}
	}

  //QueryStringÀ» Á¶ÇÕÇÑ´Ù.
	for (i = 0; i < j; i++) {
		 if (name[i] != '') plain_text += name[i]+ "=" + value[i] + "&";
	}
  
  //¸¶Áö¸·¿¡ &¸¦ ¾ø¾Ö±â À§ÇÔ
  if (plain_text != "")
    plain_text = plain_text.substr(0, plain_text.length -1); 
	return plain_text;
}


/**
 * Form¿ÀºêÁ§Æ® ¾È¿¡ ÀÖ´Â ÄÁÆ®·ÑÀ» QueryStringÀ¸·Î ±¸¼ºÇÑ´Ù. ÀÌ¶§, ÇÑ±ÛÀº ÀÎÄÚµùÇÏÁö ¾Ê´Â´Ù.
 * @param : form      - ÀÌµ¿ ¿øº» SheetÀÇ Object id
 * @return : Form¿ÀºêÁ§Æ® ¾È¿¡ ControlÀ» QueryStringÀ¸·Î ±¸¼ºÇÑ ¹®ÀÚ¿­
 * @version : 1.0.0.0
 * @sample
 *  var sCondParam=FormQueryString(document.frmSearch);
 */

function FormQueryStringOnlyCheckboxChecked(form) {
  if (typeof form != "object" || form.tagName != "FORM") {
    alert("FormQueryStringÇÔ¼öÀÇ ÀÎÀÚ´Â FORM ÅÂ±×°¡ ¾Æ´Õ´Ï´Ù.");
    return "";
  }
  
	var name = new Array(form.elements.length); 
	var value = new Array(form.elements.length); 
	var j = 0;
	var plain_text="";

	//»ç¿ë°¡´ÉÇÑ ÄÁÆ®·ÑÀ» ¹è¿­·Î »ý¼ºÇÑ´Ù.
	len = form.elements.length; 
	for (i = 0; i < len; i++) {
	  switch (form.elements[i].type) {
	    case "button":
	    case "reset":
	    case "submit":
	      break;
	    case "radio":
	    case "checkbox":
  				if (form.elements[i].checked == true) {
  					name[j] = form.elements[i].name; 
  					value[j] = form.elements[i].value;
  					j++;
  				}
  				break;
  		case "select-one":
  				name[j] = form.elements[i].name; 
					var ind = form.elements[i].selectedIndex;
					if(ind >= 0) {
						if (form.elements[i].options[ind].value != '')
							value[j] = form.elements[i].options[ind].value;
						else
							value[j] = form.elements[i].options[ind].text;
					} else {
						value[j] = "";
					}
					j++;
					break;
			case "select-multiple":
  				name[j] = form.elements[i].name; 
					var llen = form.elements[i].length;
					var increased = 0;
					for( k = 0; k < llen; k++) {
						if (form.elements[i].options[k].selected) {
							name[j] = form.elements[i].name; 
							if (form.elements[i].options[k].value != '')
								value[j] = form.elements[i].options[k].value;
							else
								value[j] = form.elements[i].options[k].text;
							j++;
							increased++;
						}
					}
					if(increased > 0) {
						j--;
					} else {
						value[j] = "";
					}
					j++;
					break;
				default :
  				name[j] = form.elements[i].name; 
					value[j] = form.elements[i].value;
  				j++;
		}
	}

  //QueryStringÀ» Á¶ÇÕÇÑ´Ù.
	for (i = 0; i < j; i++) {
		 if (name[i] != '') plain_text += name[i]+ "=" + value[i] + "&";
	}
  

  //¸¶Áö¸·¿¡ &¸¦ ¾ø¾Ö±â À§ÇÔ
  if (plain_text != "")
    plain_text = plain_text.substr(0, plain_text.length -1); 
	return plain_text;
}

function showSubPostMenu() {
	if(document.getElementById("subPost"+0).style.display == "none") {
		document.getElementById("subPost"+0).style.display = "";
		document.getElementById("subPost"+1).style.display = "none";
	}else {
		document.getElementById("subPost"+1).style.display = "";
		document.getElementById("subPost"+0).style.display = "none";
	}
}

function doBlink() { 
	var blink = document.all.tags("BLINK") 
	for (var i=0; i < blink.length; i++) 
		blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
} 
function startBlink() { 
	if (document.all) setInterval("doBlink()",800) 
}


function goCPDetailPage(newPage,winNm,width,height){
	var iLeft;
	var iTop;
	iLeft = (screen.availWidth/2 - width/2)-50; 
	//iTop = screen.availHeight/2 - ((height) + 50); 
	iTop=10;
	var winPopup;
	winPopup = window.open(newPage,winNm,'width='+width+',height='+height+',scrollbars=yes,resizable=no,menubar=no,status=no,toolbar=no,left='+iLeft+',top='+iTop+',screenX='+iLeft+',screenY='+iTop);
	winPopup.focus();
} 

window.onload = startBlink; 

