<!--//
// getLastDay - Æ¯Á¤´ÞÀÇ ¸¶Áö¸· ³¯Â¥ ±¸ÇÏ±â 
function getLastDay(year,month) 
{ 
	var lastDayArray  = new Array(0,31,28,31,30,31,30,31,31,30,31,30,31); 
	lastDay = lastDayArray[month]; 
		if(month==2) 
		{ 
			if(year%100 == 0)  
			{ 
				if(year%400 == 0) 
				{ 
				lastDay = 29; 
				} 
			}  
			else if(year%4 == 0)  
			{ 
			lastDay = 29; 
			} 
		} 
	return lastDay; 
} 


// ÇÑ±ÛÃ¼Å©
function ChkHan(strValue) { 
  for(i=0;i<strValue.length;i++) { 
  var a=strValue.charCodeAt(i); 
    if (a > 128) { 
      return true; 
    }else{ 
      return false; 
    } 
  } 
} 


// °ø¹éÃ¼Å©
function ChkSpace(strValue) { 
  if (strValue.indexOf(" ")>=0) { 
    return true; 
  }else { 
    return false; 
  } 
} 


//°ø¹éÃ¼Å©
function ChkSpace(strValue) { 
  if (strValue.indexOf(" ")>=0) { 
    return true; 
  }else { 
    return false; 
  } 
}

//¼ýÀÚ,¾ËÆÄºª¸¸
function ChkAlNum(strValue) { 
  for(var i=0; i<strValue.length;i ++) { 
    var strCh = strValue.charAt(i).toUpperCase(); 
    if(strCh >="A" && strCh <="Z") continue; 
    if(strCh >="0" && strCh <="9") continue; 
    if(strCh  =" ") continue; 
    return false; 
  } 
}

//¼ýÀÚ¸¸
function ChkOnlyNum(strValue) {
  alert(strValue);
  for(var i=0; i<strValue.length;i ++) { 
    var strCh = strValue.charAt(i).toUpperCase(); 
    if(strCh >="0" && strCh <="9") continue; 
    return false; 
  } 
}


function CheckStr(strOriginal, strFind, strChange){
    var position, strOri_Length;
    position = strOriginal.indexOf(strFind); 

    while (position != -1){
      strOriginal = strOriginal.replace(strFind, strChange);
      position = strOriginal.indexOf(strFind);
    }

    strOri_Length = strOriginal.length;
    return strOri_Length;
}


//ÆË¾÷Ã¢ ¿ÀÇÂ
function open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable){
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';
	
	window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}


//ÀÌ¸ÞÀÏ Çü½Ä Ã¼Å©
function check_mail(str){
	emailEx1 = /[^@]+@[A-Za-z0-9_-]+.[A-Za-z]+/;
	emailEx2 = /[^@]+@[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-z]+/;

	if(emailEx1.test(str)) return true;;
	if(emailEx2.test(str)) return true;
	if(emailEx3.test(str)) return true;

	return false;
}


//Ä¿¼­ ¿Å±â±â
function moveFocus(onKeyup_cursor,onNextkeyup_cursor,input_size){
	if (onKeyup_cursor.value.length >= input_size){
		 onNextkeyup_cursor.focus();
	}
}

function Move_focus(onKeyup_cursor, onNextkeyup_cursor){
	onKeyup_cursor.blur();
	onNextkeyup_cursor.focus();
}


// select ¸Þ´º¿¡¼­ link »çÀÌÆ® »õÃ¢¶ç¿ì±â
function linkSiteGo(theForm){
	if(!(theForm.elements[0].options[0].selected)){
		 window.open(theForm.elements[0].options[theForm.elements[0].selectedIndex].value,'linkSite')
	}
}


// onBlur,onFocus ½Ã ±âº»°ª ³ªÅ¸³»±â
function check_w(vv){if (vv.value == ''){vv.value = vv.defaultValue;}}
function clear_w(vv){if (vv.value == vv.defaultValue){vv.value = '';}}


// »ç¾÷ÀÚ µî·Ï¹øÈ£ Ã¼Å©
function checkComIdentity(formElement1,formElement2,formElement3){
	var com_ip = formElement1.value + formElement2.value + formElement3.value;
	var arrCom_ip = new Array();
	for(i=0 ; i<com_ip.length ; i++ ){
		 arrCom_ip[i] = com_ip.substring(i,i+1);
	}
	var intTmp = parseInt(arrCom_ip[com_ip.length-2]) * 5;
	var intTmp1 = intTmp.toString().substr(0,1);
	var intTmp2 = intTmp.toString().substr(1,1);

	intTmp = parseInt(intTmp1) + parseInt(intTmp2);
	var totalTmp = intTmp;
	for(i=0 ; i<com_ip.length-2 ;i++ ){
		 if((i%3) == 0){
		      totalTmp = parseInt(totalTmp) + parseInt(arrCom_ip[i]);
		 }else if((i%3) == 1){
		      totalTmp = parseInt(totalTmp) + (parseInt(arrCom_ip[i])*3);
		 }else if((i%3) == 2){
		      totalTmp = parseInt(totalTmp) + (parseInt(arrCom_ip[i])*7);
		 }
	}
	var lastTmp = totalTmp.toString().substring(totalTmp.toString().length-1,totalTmp.toString().length)
	if( ((10-parseInt(lastTmp))%10) != arrCom_ip[com_ip.length-1] ){
		 return false;
	}else{
		 return true;
	}
}


//Æ¯¼ö¹®ÀÚ ¸·±â
function checkNumber()
{
	var objEv = event.srcElement;
	var num =",{}[]()<>?_|~`!@#$%^&*-+\"'\\/ ";
	event.returnValue = true;
	
	for (var i=0;i<objEv.value.length;i++){
		if(-1 != num.indexOf(objEv.value.charAt(i))) event.returnValue = false;
	}
	
	if (!event.returnValue){
		alert("Æ¯¼ö¹®ÀÚ´Â ÀÔ·ÂÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
		objEv.value="";
	}
}

//Tag Á¦°Å
function removeTags(strValue)
{
	return strValue.replace(/<[a-z|/]+[^<>]*>/gi, "");
}

//¸ðµç °ø¹éÁ¦°Å
function strTrim(strValue)
{
	return strValue.replace(/(^\s*)|(\s*$)/g, "");
}

//¿ÞÂÊ °ø¹éÁ¦°Å
function strLtrim(strValue)
{
	return strValue.replace(/^\s*/g, "");
}

//¿À¸¥ÂÊ °ø¹éÁ¦°Å
function strRtrim(strValue)
{
	return strValue.replace(/\s*$/g, "");
}

/*********************************** Æû¿ä¼Ò ÀüÃ¼ Ã¼Å© Begin *****************************************/
function checkForm(f, saveMsg){
	var fLen = f.elements.length;
	var fObj; //Æû ¿ä¼Ò
	var fTyp; //Æû ¿ä¼Ò Type
	var fVal; //Æû ¿ä¼Ò Value
	var fMsg; //°æ°í ¸Þ½ÃÁö ¼Ó¼º
	var fNum; //¼ýÀÚ¸¸ ÀÔ·Â ¼Ó¼º
	var fMax; //ÃÖ´ë±æÀÌÁöÁ¤
	var fMin; //ÃÖ¼Ò±æÀÌÁöÁ¤
	var fEqu; //±æÀÌÀÏÄ¡ÁöÁ¤
	var fMxN; //ÃÖ´ë°ªÁöÁ¤
	var fMnN; //ÃÖ¼Ò°ªÁöÁ¤
	var fMal; //¸ÞÀÏÇü½Ä
	var fJumin; //ÁÖ¹Î¹øÈ£
	var fFocus; // nofocus ÀÌ¸é Æ÷Ä¿½º ¾øÀ½
	var fSaveMsg=saveMsg; // ÀúÀå ¹®±¸
	for(i=0;i<fLen;i++){
		fObj = f.elements[i];
		fTyp = mm_ToUpperCase(fObj.getAttribute("type"));
		fVal = fObj.getAttribute("value");
		fMsg = fObj.getAttribute("msg");				// °æ°í¸Þ¼¼Áö
		fNum = fObj.getAttribute("chknum");				// ¼ýÀÚ¸¸ ±âÀÔ °¡´ÉÇÏµµ·Ï
		fMax = fObj.getAttribute("maxlen");				// ÃÖ´ë ÀÔ·Â±ÛÀÚ¼ö Á¦ÇÑ
		fMin = fObj.getAttribute("minlen");				// ÃÖ¼Ò ÀÔ·Â±ÛÀÚ¼ö Á¦ÇÑ
		fEqu = fObj.getAttribute("equlen");				// ÀÔ·Â±ÛÀÚ¼ö ÀÏÄ¡ Á¦ÇÑ
		fMxN = fObj.getAttribute("maxnum");				// ÃÖ´ë ¼ýÀÚ Á¦ÇÑ
		fMnN = fObj.getAttribute("minnum");				// ÃÖ¼Ò ¼ýÀÚ Á¦ÇÑ
		fMal = fObj.getAttribute("chkmail");			// ÀÌ¸ÞÀÏ Ã¼Å©
		fJumin = fObj.getAttribute("chkjumin");         // ÁÖ¹Î¹øÈ£ Ã¼Å©
		fFocus = fObj.getAttribute("nofocus");          // Æ÷Ä¿½º ¾ø¾Ö±â
		
		if(fMsg != null && (fTyp == "TEXT" || fTyp == "HIDDEN" || fTyp == "TEXTAREA" || fTyp == "PASSWORD" || fTyp == "FILE") && fVal.replace(/ /gi,"")==""){
			if(fMsg!="" ) alert(fMsg + " ÀÔ·ÂÇØÁÖ¼¼¿ä");
			if (fTyp != "HIDDEN" && fFocus==null){fObj.focus();}
			return false;
		}
		
		if(fMsg != null && fTyp == "TEXT" && fVal == "µ¿»çÀÔ·Â"){
			if(fMsg!="" ) alert(fMsg + " ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
			if (fFocus==null) fObj.focus();
			return false;
		}
		if(fMsg != null && fTyp == "TEXT" && fVal == "Å°¿öµåÀÔ·Â"){
			if(fMsg!="" ) alert(fMsg + " ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
			if (fFocus==null) fObj.focus();
			return false;
		}

		if(fMsg != null && (fTyp == "SELECT-ONE" || fTyp == "SELECT-MULTIPLE") && fVal == ""){
			if(fMsg!="" ) alert(fMsg + " ¼±ÅÃÇØ ÁÖ¼¼¿ä");
			if (fFocus==null) fObj.focus();
			return false;
		}
		
		if(fMsg != null && (fTyp == "RADIO" || fTyp =="CHECKBOX") && checkChecked(fObj) == false){
			if(fMsg!="" ) alert(fMsg + " ¼±ÅÃÇØ ÁÖ¼¼¿ä");
			if (fFocus==null) fObj.focus();
			return false;
		}
		
		if(fNum != null && isNaN(fVal)){
			alert("¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù.");
			if (fFocus==null) fObj.focus();
			return false;
		}
		
		if(fMax != null && fMax < getLen(fVal)){
			alert("ÀÔ·ÂµÈ ±ÛÀÚ¼ö°¡" + fMax + "ÀÚ º¸´Ù ÀÛ¾Æ¾ß ÇÕ´Ï´Ù.\n(¿µ¹® " + fMax + "ÀÚ, ÇÑ±Û "+Math.floor(fMax/2) + "ÀÚ ±îÁö °¡´ÉÇÕ´Ï´Ù.)");
			if (fFocus==null) fObj.focus();
			return false;
		}
		
		if(fMin != null && fMin > getLen(fVal)){
			alert("ÀÔ·ÂµÈ ±ÛÀÚ¼ö°¡ " + fMin + "ÀÚº¸´Ù Ä¿¾ßÇÕ´Ï´Ù.");
			if (fFocus==null) fObj.focus();
			return false;
		}

		if(fEqu != null && fEqu != getLen(fVal)){
			alert("ÀÔ·ÂµÈ ±ÛÀÚ¼ö°¡ " + fEqu + "ÀÚ ÀÌ¾î¾ß ÇÕ´Ï´Ù.\n(¿µ¹® " + fEqu + "ÀÚ, ÇÑ±Û "+ fEqu/2 + "ÀÚ)");
			if (fFocus==null) fObj.focus();
			return false;
		}
		
		if(fMxN != null && parseInt(fMxN) < parseInt(fVal)){
			alert("ÀÔ·ÂµÈ ¼ýÀÚ´Â " + fMxN + "º¸´Ù ÀÛ¾Æ¾ßÇÕ´Ï´Ù.");
			if (fFocus==null) fObj.focus();
			return false;
		}
		
		if(fMnN != null && parseInt(fMnN) > parseInt(fVal)){
			alert("ÀÔ·ÂµÈ ¼ýÀÚ´Â " + fMnN + "º¸´Ù Ä¿¾ßÇÕ´Ï´Ù.");
			if (fFocus==null) fObj.focus();
			return false;
		}

		if(fMal != null && check_mail(fVal) == false && fVal != ""){
			alert("ÀÌ¸ÞÀÏ ÁÖ¼Ò°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
			if (fFocus==null) fObj.focus();
			return false;
		}
		
		if(fJumin != null && checkIdentity(f.jumin1.value,f.jumin2.value) == false && fVal != ""){
			alert("ÁÖ¹Î¹øÈ£°¡ ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.");
			if (fFocus==null) fObj.focus();
			return false;
		}
	}
	
	if (!(fSaveMsg=="" || fSaveMsg==null)) {
		if (!confirm(fSaveMsg)) return false;	
	}
	
	return true;
}


// ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
function checkIdentity(formElement1,formElement2){
	var str_serial1 = formElement1;
	var str_serial2 = formElement2;
	var digit=0
	for (var i=0;i<str_serial1.length;i++){
		var str_dig=str_serial1.substring(i,i+1);
		if (str_dig<'0' || str_dig>'9'){ 
		digit=digit+1 
		}
	}
	if ((str_serial1 == '') || ( digit != 0 )){
	 	return false;   
	}
	var digit1=0
	for (var i=0;i<str_serial2.length;i++){
		var str_dig1=str_serial2.substring(i,i+1);
		if (str_dig1<'0' || str_dig1>'9'){ 
			digit1=digit1+1 
		}
	}
	if ((str_serial2 == '') || ( digit1 != 0 )){
		return false;   
	}
	if (str_serial1.substring(2,3) > 1){
		return false;   
	}
	if (str_serial1.substring(4,5) > 3){
		return false;   
	} 
	if (str_serial2.substring(0,1) > 4 || str_serial2.substring(0,1) == 0){
		return false;   
	}
	var a1=str_serial1.substring(0,1)
	var a2=str_serial1.substring(1,2)
	var a3=str_serial1.substring(2,3)
	var a4=str_serial1.substring(3,4)
	var a5=str_serial1.substring(4,5)
	var a6=str_serial1.substring(5,6)
	var check_digit=a1*2+a2*3+a3*4+a4*5+a5*6+a6*7
	var b1=str_serial2.substring(0,1)
	var b2=str_serial2.substring(1,2)
	var b3=str_serial2.substring(2,3)
	var b4=str_serial2.substring(3,4)
	var b5=str_serial2.substring(4,5)
	var b6=str_serial2.substring(5,6)
	var b7=str_serial2.substring(6,7)
	var check_digit=check_digit+b1*8+b2*9+b3*2+b4*3+b5*4+b6*5 
	check_digit = check_digit%11
	check_digit = 11 - check_digit
	check_digit = check_digit%10
	if (check_digit != b7){
		return false;   
	}
	else{	
		return true;
	}
}

//¹è¿­¿ä¼ÒÀÏ °æ¿ì checked µÈ°ÍÀÌ ÀÖ´ÂÁö È®ÀÎ
function checkChecked(obj) {
	var fname = obj.form.name;
	var objnm = obj.name;
	var oElem = eval(fname+"."+objnm);
	var ret = false;
	//alert(typeof(oElem.length));
	if(typeof(oElem.length) != "undefined"){
	//alert(oElem.length);
		if(oElem.checked){
			ret = true;
		}else{
			for(var i=0;i<oElem.length;i++){
				
				if(oElem[i].checked){
					ret = true;
				}
			}
		}
	}
	return ret;
}


//¹®ÀÚ±æÀÌ ¹ÝÈ¯(¿µ¹® 1byte, ÇÑ±Û 2byte °è»ê)
function getLen(str) {
	var len;
	var temp;
	len = str.length;
	var tot_cnt = 0;
	for(k=0;k<len;k++){
		temp = str.charAt(k);
		if(escape(temp).length>4)
			tot_cnt += 2;
		else
			tot_cnt++;
	}
	return tot_cnt;
}
//±ÛÀÚ¼öÁ¦ÇÑ
function CheckStrLength(txtName, intMaxLength){
	var tmpStr;
	var strLen;
	var onechar;
	var tcount = 0;
	
	tmpStr = txtName.value;
	strLen = getLen(tmpStr);
	if(strLen>intMaxLength){
		alert("¸Þ½ÃÁö ³»¿ëÀº "+intMaxLength+"byte ÀÌ»óÀº Àü¼ÛÇÏ½Ç¼ö ¾ø½À´Ï´Ù.\r\nÃÊ°úµÈ ºÎºÐÀº ÀÚµ¿À¸·Î »èÁ¦µË´Ï´Ù.");
		
		for(var k=0;k<strLen;k++){
			onechar = tmpStr.charAt(k);
			if(escape(onechar).length > 4){
				tcount += 2;
			} else {
				// ¿£ÅÍ°ªÀÌ µé¾î¿ÔÀ»¶§ °ª(\r\n)ÀÌ µÎ¹ø½ÇÇàµÇ´Âµ¥ Ã¹¹øÂ° °ª(\n)ÀÌ µé¾î¿ÔÀ»¶§ tcount¸¦ Áõ°¡½ÃÅ°Áö ¾Ê´Â´Ù.
				if(escape(onechar)=='%0A'){
				}else{
					tcount++;
				}
			}
			
			if(tcount>intMaxLength) {
				tmpStr = tmpStr.substring(0,k);
				break;
			}
		}
		txtName.value=tmpStr;
	}
}

function Fn_SelectAll(f, chkName){
	var chkObj = chkName;
	var objCnt = chkObj.length;

	//  Ã¼Å©¹Ú½º°¡ ÇÑ°³ÀÏ °æ¿ì
	if(chkObj.value) {
		if(f.selectchk.checked == false) {
			//("sComId").checked = false;
			chkObj.checked = false;
		}else {
			//("sComId").checked = true;
			chkObj.checked = true;
		}
	} else {
		if(f.selectchk.checked == false) {
			for(var i = 0; i < objCnt; i++) {
				chkObj[i].checked = false;
			}
		}else {
			for(var i = 0; i < objCnt; i++) {
				chkObj[i].checked = true;
			}
		}

	}
}

//´ë¹®ÀÚ º¯È¯
function mm_ToUpperCase(str) {
	var ret;
	str !=null ? ret = str.toUpperCase() : ret = "";
	return ret;
}
/*********************************** Æû¿ä¼Ò ÀüÃ¼ Ã¼Å© End *****************************************/

function printFlash(flash, width, height, transparent) {
	document.write("<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+"'>");
	document.write("<PARAM name='movie' value='"+flash+"'>");
	document.write("<PARAM name='quality' value='high'>");
	if(transparent)
		document.write(" <param name='wmode' value='transparent'>");

	document.write("<EMBED src='"+flash+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash 'width='"+width+"' height='"+height+"'></EMBED></OBJECT>");
}

function preview_img(f1, f2)
{
	if (f1.value=="") {		
		f2.style.display = "none"
	}
	else
	{
		f2.src=f1.value;
		f2.style.display = "";
		imgResize(f2)
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	var h_pop = window.open(theURL,winName,features);
	h_pop.focus();
}

function imgResize(f_img){
	var width, height;
	var newWidth,newHeight,maxWidth,maxHeight,defaultheight;

	maxWidth  = 300;
	maxHeight = 200;

	var img = new Image();
	img.src = f_img.src;
	width = img.width;
	height = img.height;

if(width > maxWidth || height > maxHeight)//³ÐÀÌ ¶Ç´Â ³ôÀÌ°¡ ÃÖ´ë»çÀÌÁî¸¦ ÃÊ°úÇßÀ»¶§
	{
	if(width > height)//³ÐÀÌ°¡ ³ôÀÌº¸´Ù Å©´Ù¸é	 ³ÐÀÌ´Â ÀÌ¹Ì ÃÖ´ë³ÐÀÌ¸¦ ÃÊ°úÇÑ°ÍÀÌ´Ù
		{
		newWidth = maxWidth; //»õ³ÐÀÌ´Â ÃÖ´ë³ÐÀÌÀÌ´Ù
		newHeight = Math.round((height*newWidth)/width);//»õ³ôÀÌ´Â ºñÀ²°è»êÇÑ´Ù.
		}
	else	// ³ôÀÌ°¡ ³ÐÀÌº¸´Ù Å©°Å³ª °°´Ù´Â ¾ê±â´Ù.
		{
		newHeight = maxHeight;	//»õ·Î¿î ³ôÀÌ´Â ÃÖ´ë³ôÀÌÀÌ´Ù.
		newWidth = Math.round((width*newHeight)/height); //³ÐÀÌ¸¦ ºñÀ²°Ô»êÇÑ´Ù.
		}
	}
else	//À§ Á¶°Çµé¿¡ °É¸®Áö ¾ÊÀ¸¸é ¿ø·¡°ª ±×´ë·Î Ãâ·ÂÇØÁà¶ó
	{
	newWidth = width;
	newHeight = height;
}

f_img.width = newWidth;
f_img.height = newHeight;
}
//-->
