//³¯Â¥ Çü½Ä Ã¼Å©
//¸í³² 2008.08.20
function date_Check(y,m,d){
	var fy = y;
	var fm = m;
	var fd = d;

	var getDate = fy+fm+fd;

	var error = 0; // ¿¡·¯ º¯¼ö
	var arrday = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

	if (fy%1000 != 0 && fy%4 == 0){arrday[1] = 29;}		// À±³â
	if (fd > arrday[fm-1] || fd < 1){error = 1;}			// ³¯Â¥ Ã¼Å©
	if (fm < 1 || fm > 12){error = 1;}					// ¿ù Ã¼Å©
	if (fm%1 != 0 || fy%1 != 0 || fd%1 != 0){error = 1;}	// Á¤¼ö Ã¼Å©
	if (getDate.length!=8){error = 1;}

	return error;
}

// Global Navigation
function navSwitch(menunum)	{
	var totalmenu = document.getElementById('navigation').getElementsByTagName('ul').length;
	var activateMenu = document.getElementsByName("choice");
	
	for (i=0;i<totalmenu;i++) {
		if(i==menunum)	{
			// ¸¶Áö¸· ¶óÀÎ ±¸ÇÏ±â
			if(totalmenu > 12) {
				document.getElementById('topmenu'+ (totalmenu-1)).className = "endLine";
			}
			activateMenu[i].className = "choice";
			document.getElementById('submenu'+i).style.display = "block";
		} else {
			// ¸¶Áö¸· ¶óÀÎ ±¸ÇÏ±â
			if(totalmenu > 12) {
				document.getElementById('topmenu'+ (totalmenu-1)).className = "endLine";
			}
			activateMenu[i].className = null;
			document.getElementById('submenu'+i).style.display = "none";
		}
	}
}

// ¸Þ´º ³ôÀÌ ±¸ÇÏ±â
function navHeight() {
	var totalmenu = document.getElementById('navigation').getElementsByTagName('ul').length;
	var menuH = document.getElementById('navigation').scrollHeight;
	for (i=0;i<totalmenu;i++) {
		// ¸¶Áö¸· ¶óÀÎ ±¸ÇÏ±â
		if(totalmenu > 12) {
			document.getElementById('topmenu'+ (totalmenu-1)).className = "endLine";
		}
		document.getElementById('submenu'+i).style.top = menuH + 2 +("px");
	}
}

//ÀÌ¹ÌÁöÅ©±â·Î ÆË¾÷¶ç¿ì±â...½ÃÀÛ
function open_img(img_name,img_path)
{ 
	var largh = 30;
	var altez = 30;
	var winl = 0;
	var wint = 0;
	stringa="width="+largh+",height="+altez+',top='+wint+',left='+winl+',scrollbars=no,resizable=yes';
	pop_win=window.open("/Netville/img_pop.asp?sfile_name="+img_name+"&img_path="+img_path,"img001",stringa);
}

//µ¿¿µ»óÆË¾÷¶ç¿ì±â...½ÃÀÛ
function open_movie(movie_path, move_type)
{ 
	var largh = 420;
	var altez = 340;
	var winl = 0;
	var wint = 0;
	stringa="width="+largh+",height="+altez+',top='+wint+',left='+winl+',scrollbars=no,resizable=yes';
	pop_win=window.open("/Netville/movie_pop.asp?filepath="+movie_path+"&filetype="+move_type,"movie001",stringa);
}

//°ø¹éÃ¼Å©
function fnc_data_space_check(arg_object,arg_msg)
{
	var len_data = arg_object.value.length;
	var value_data = arg_object.value;
	
	for (loopid=0; loopid<len_data; loopid++)
	{
		if(value_data.substring(loopid,loopid+1)==" ")
			break;
	}

	if(len_data!=loopid)
	{
		alert(arg_msg)
		arg_object.value=""
		arg_object.focus();
		return true;
	}
	return false;
}

// null°ª Ã¼Å©
function fnc_data_null_check(arg_object,arg_msg)
{
	var len_data = arg_object.value.length;
	var value_data = arg_object.value;
	var temp_data = "";
	
	for (loopid=0; loopid<len_data; loopid++)
		temp_data = temp_data+value_data.substring(loopid,loopid+1).replace(" ","");
	
	var return_value = temp_data.length;
	if(return_value==0)
	{
		alert(arg_msg)
		arg_object.value=""
		arg_object.focus();
		return true;
	}
	return false;
}

/********************************************************** 
	jkpark 2008-06-14
	¿À´Ã ³¯Â¥ ±¸ÇÏ±â 
 **********************************************************/
function getToday()
{
	var YYYMMDD = null;
	var today = new Date();
	var thisYear = today.getYear();
	var thisMonth = today.getMonth()+1;
	var thisDay = today.getDate();
  
	if (thisMonth < 10)//¿ùÀÌ 10ÀÏ º¸´Ù ÀÛÀ¸¸é
	{
	  thisMonth = '0'+thisMonth
	}

	if (thisDay < 10) //ÀÏÀÌ 10ÀÏ º¸´Ù ÀÛÀ¸¸é
	{
	  thisDay = '0'+thisDay
	}
 
		YYYMMDD = today.getYear()+'-'+ thisMonth + '-'+ thisDay

	  return YYYMMDD

}
/********************************************************** 
	jkpark 2008-06-14
	³¯Â¥ ºñ±³ StrtDate FnshDate º¸´Ù Å©¸é:-1 ÀÛÀ¸¸é:1 °°À¸¸é:0  
 **********************************************************/
function compareDay(StrtDate,FnshDate)
{
	if ( FnshDate - StrtDate  < 0 )
	{
		return -1;
	}
	else if( FnshDate - StrtDate == 0 )
	{
		return 0;
	}
	else
	{
		return 1;
	}


}
/********************************************************** 
	jkpark 2008-06-14
	³¯Â¥ Çü½ÄÀ¸·Î º¯È¯
 **********************************************************/

function getFormatDay(strDate)
{
	var ArrDate = strDate.split("-");
		return new Date( ArrDate[0] , ArrDate[1]-1 , ArrDate[2]);

}

function showMpgObject(objSource, objWidth, objHeight)
{

	document.write('<object id="Player" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" WIDTH="' + objWidth + '" HEIGHT="' + objHeight + '">');
	document.write('<param name="AutoStart" value="true">');
	document.write('<param name="TransparentAtStart" value="True">');
	document.write('<param name="ShowControls" value="1">');
	document.write('<param name="ShowDisplay" value="0">');
	document.write('<param name="ShowStatusBar" value="1">');
	document.write('<param name="ShowPositionControls" value="true">');
	document.write('<param name="EnableContextMenu" value="false">');
	document.write('<param name="AutoSize" value="1">');
	document.write('<param name="AnimationAtStart" value="false">');
	document.write('<param name="FileName" value="' + objSource + '">');
	document.write('</object>');

}

function fc_chk_byte(aro_name,ari_max)
{
   var ls_str     = aro_name.value; // ÀÌº¥Æ®°¡ ÀÏ¾î³­ ÄÁÆ®·ÑÀÇ value °ª
   var li_str_len = ls_str.length;  // ÀüÃ¼±æÀÌ

   // º¯¼öÃÊ±âÈ­
   var li_max      = ari_max; // Á¦ÇÑÇÒ ±ÛÀÚ¼ö Å©±â
   var i           = 0;  // for¹®¿¡ »ç¿ë
   var li_byte     = 0;  // ÇÑ±ÛÀÏ°æ¿ì´Â 2 ±×¹Ü¿¡´Â 1À» ´õÇÔ
   var li_len      = 0;  // substringÇÏ±â À§ÇØ¼­ »ç¿ë
   var ls_one_char = ""; // ÇÑ±ÛÀÚ¾¿ °Ë»çÇÑ´Ù
   var ls_str2     = ""; // ±ÛÀÚ¼ö¸¦ ÃÊ°úÇÏ¸é Á¦ÇÑÇÒ¼ö ±ÛÀÚÀü±îÁö¸¸ º¸¿©ÁØ´Ù.

   for(i=0; i< li_str_len; i++)
   {
      // ÇÑ±ÛÀÚÃßÃâ
      ls_one_char = ls_str.charAt(i);

      // ÇÑ±ÛÀÌ¸é 2¸¦ ´õÇÑ´Ù.
      if (escape(ls_one_char).length > 4)
      {
         li_byte += 2;
      }
      // ±×¹ÜÀÇ °æ¿ì´Â 1À» ´õÇÑ´Ù.
      else
      {
         li_byte++;
      }

      // ÀüÃ¼ Å©±â°¡ li_max¸¦ ³ÑÁö¾ÊÀ¸¸é
      if(li_byte <= li_max)
      {
         li_len = i + 1;
      }
   }
   
   // ÀüÃ¼±æÀÌ¸¦ ÃÊ°úÇÏ¸é
   if(li_byte > li_max)
   {
      if(escape(ls_one_char).length > 4) {
		// alert( (li_max / 2) + " ±ÛÀÚ¸¦ ÃÊ°ú ÀÔ·ÂÇÒ¼ö ¾ø½À´Ï´Ù. \n ÃÊ°úµÈ ³»¿ëÀº ÀÚµ¿À¸·Î »èÁ¦ µË´Ï´Ù. ");
		alert(" ±ÛÀÚ¸¦ ÃÊ°ú ÀÔ·ÂÇÒ¼ö ¾ø½À´Ï´Ù. \n ÃÊ°úµÈ ³»¿ëÀº ÀÚµ¿À¸·Î »èÁ¦ µË´Ï´Ù. ");
	  } else {
		// alert( li_max + " ±ÛÀÚ¸¦ ÃÊ°ú ÀÔ·ÂÇÒ¼ö ¾ø½À´Ï´Ù. \n ÃÊ°úµÈ ³»¿ëÀº ÀÚµ¿À¸·Î »èÁ¦ µË´Ï´Ù. ");
		alert(" ±ÛÀÚ¸¦ ÃÊ°ú ÀÔ·ÂÇÒ¼ö ¾ø½À´Ï´Ù. \n ÃÊ°úµÈ ³»¿ëÀº ÀÚµ¿À¸·Î »èÁ¦ µË´Ï´Ù. ");
	  }
      
      ls_str2 = ls_str.substr(0, li_len);
      aro_name.value = ls_str2;
	  aro_name.focus();
   }
  //    
}

 function OnlyNum() {
   if(event.keyCode<48||(event.keyCode>57)||event.keyCode>105)
   {
     event.returnValue=false;
   }
 }

/* Uplaod & validate */
function editor_upload() {

	document.form_name.p_html_content.value = document.NetEditorGlobal.Submit();

	if("" == document.form_name.p_html_content.value){
		alert("ÀÌ¹ÌÁö ¾÷·Îµå¸¦ ½ÇÆÐÇÏ¿´½À´Ï´Ù!");
		return;
	}

	var fm_ok = document.FileManagerGlobal.Submit();
	if(fm_ok == -1){
		alert("ÆÄÀÏ ¾÷·Îµå¸¦ ½ÇÆÐÇÏ¿´½À´Ï´Ù.!");
		return;
	}

	for(var i=0; i<10000; i++){
		temp = 1*100;
	}

	// ÀÌ¹ÌÁö ¾÷·Îµå °á°ú¸¦ º¸¿©ÁÙ Å×½ºÆ® °á°ú ÇÁ·Î±×·¥.
	document.form_name.p_add_con_img_list.value = document.NetEditorGlobal.GetFileList("GetAddFileList");
	document.form_name.p_del_con_img_list.value = document.NetEditorGlobal.GetFileList("GetDelFileList");

	// ÆÄÀÏ ¾÷·Îµå °á°ú¸¦ º¸¿©ÁÙ Å×½ºÆ® °á°ú ÇÁ·Î±×·¥.
	document.form_name.p_add_att_list.value = document.FileManagerGlobal.GetFileList("GetAddFileList");
	document.form_name.p_del_att_list.value = document.FileManagerGlobal.GetFileList("GetDelFileList");

	//document.form_name.submit();
	BBsWrite();
}

function fnc_Num(strValue) {
	if(isNaN(strValue.value)) 
	{
		alert("¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
		strValue.value="";	
		strValue.focus();
		return false;
	}
	return true;
}

/*---------------------------------------------------------------------------------------------------------*/
//ÀüÈ­¹øÈ£,ÈÞ´ëÆù ¹øÈ£, ÆÑ½º¹øÈ£ 4ÀÚ¸®¸é ÀÚµ¿ ÅÇÀÌµ¿...½ÃÀÛ
//*---------------------------------------------------------------------------------------------------------*/
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
        var keyCode = (isNN) ? e.which : e.keyCode; 
        var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
        if(input.value.length >= len && !containsElement(filter,keyCode))
		{
        input.value = input.value.slice(0, len);
        input.form[(getIndex(input)+1) % input.form.length].focus();
		}

function containsElement(arr, ele) {
        var found = false, index = 0;
        while(!found && index < arr.length)
        if(arr[index] == ele)
        found = true;
        else
        index++;
        return found;
}

function getIndex(input) {
        var index = -1, i = 0, found = false;
        while (i < input.form.length && index == -1)
        if (input.form[i] == input)index = i;
        else i++;
        return index;
        }
return true;
}
//ÀüÈ­¹øÈ£,ÈÞ´ëÆù ¹øÈ£, ÆÑ½º¹øÈ£ 4ÀÚ¸®¸é ÀÚµ¿ ÅÇÀÌµ¿...³¡

//flash
function showFlash1Object(objSource, objWidth, objHeight)
{

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="' + objWidth + '" HEIGHT="' + objHeight + '">');
document.write('<param name="movie" value="' + objSource + '">');
document.write('<param name=quality value=high>');
document.write('<param name="wmode" value="transparent">');
document.write('<embed src="'+ objSource +'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" WIDTH="' + objWidth + '" HEIGHT="' + objHeight + '"></embed>');
document.write('</object>');

}


//	ÀºÇà °èÁÂ¹øÈ£ ±æÀÌ Ã¼Å© 20080902 inpix ÀüÅÂÀÏ
function CheckNumberLen(theValue, theBankValue){

	var ArrayLen;
	switch (theBankValue){		// ÀºÇà¼±ÅÃ
		case "03":				// ±â¾÷
			ArrayLen = new Array('10','11','12','14');
			break;
		case "04":				// ±¹¹Î
			ArrayLen = new Array('12','14');
			break;
		case "05":				// ¿ÜÈ¯
			ArrayLen = new Array('11','12','13');
			break;
		case "07":				// ¼öÇù
			ArrayLen = new Array('11');
			break;
		case "11":				// ³óÇù
			ArrayLen = new Array('11','12','14');
			break;
		case "20":				// ¿ì¸®
			ArrayLen = new Array('11','12','13','14','15');
			break;
		case "21":				// Á¶Èï
			ArrayLen = new Array('11','12','13','14');
			break;
		case "23":				// Á¦ÀÏ
			ArrayLen = new Array('11');
			break;
		case "26":				// ½ÅÇÑ
			ArrayLen = new Array('11','12','13','14');
			break;
		case "27":				// ¾¾Æ¼(±¸ ÇÑ¹Ì)
			ArrayLen = new Array('11','13');
			break;
		case "31":				// ´ë±¸
			ArrayLen = new Array('11','12','13','14');
			break;
		case "32":				// ºÎ»ê
			ArrayLen = new Array('12');
			break;
		case "34":				// ±¤ÁÖ
			ArrayLen = new Array('12');
			break;
		case "35":				// Á¦ÁÖ
			ArrayLen = new Array('10','14');
			break;
		case "37":				// ÀüºÏ
			ArrayLen = new Array('10','12');
			break;
		case "39":				// °æ³²
			ArrayLen = new Array('12');
			break;
		case "45":				// »õ¸¶À»
			ArrayLen = new Array('13');
			break;
		case "48":				// ½ÅÇù
			ArrayLen = new Array('13');
			break;
		case "71":				// ¿ìÃ¼±¹
			ArrayLen = new Array('14','15');
			break;
		case "81":				// ÇÏ³ª
			ArrayLen = new Array('12','14');
		break;
	}

	var checkValue = 0;
	for (i=0; i < ArrayLen.length; i++)	{
		if(theValue == ArrayLen[i]) checkValue = 1;
	}

	if (checkValue < 1)	return false;		
	return true;
}