
//¼ýÀÚ¸¸ ÀÔ·Â¹ÞÀ½
//Çü½Ä : OnlyNum(Æûvalue°ª)
//¿¹ : OnlyNum(document.form1.jumin1.value)
//°á°ú : ¼ýÀÚ(true), ¼ýÀÚ¾Æ´Ô(false)

function OnlyNum(str){
	var ret;
	for (var i = 0; i < str.length; i++) {
	    ret = str.charCodeAt(i);
		if (!((ret > 47) && (ret < 58)))  {
			return false;
		}
	}
	return true;
}


//ÇÑ±Û¸¸ ÀÔ·Â¹ÞÀ½
//Çü½Ä : OnlyHan(Æûvalue°ª)
//¿¹ : OnlyHan(document.form1.name.value)
//°á°ú : ÇÑ±Û(true), ÇÑ±Û¾Æ´Ô(false)

function OnlyHan(str) 
{
	var ret;

	for (var i = 0; i < str.length; i++) {
	    ret = str.charCodeAt(i);
		if (ret > 31 && ret < 127) {
			return false;
		}
	}
	return true;
}


//°ø¹éÀ» Á¦¿ÜÇÑ ±æÀÌ
//Çü½Ä : ExceptBlankLength(Æûvalue°ª)
//¿¹ : ExceptBlankLength(document.form1.name.value)
//°á°ú : ±æÀÌ¹ÝÈ¯

function ExceptBlankLength(strOriginal)
{
	var position, strOri_Length;

	position = strOriginal.indexOf(' ');

	while (position != -1){
		strOriginal = strOriginal.replace(' ', '');
		position    = strOriginal.indexOf(' ');
	}

	strOri_Length = strOriginal.length;

	return strOri_Length;
}


//¸ÞÀÏÀ¯È¿¼ºÃ¼Å©
//Çü½Ä : MailCheck(Æûvalue°ª)
//¿¹ : MailCheck(document.form1.email.value)
//°á°ú : Á¤»ó(true), ºñÁ¤»ó(false)
function MailCheck(ObjMail)
{
	if (ObjMail.search(/(\S+)@(\S+)\.(\S+)/) == -1 ) 
	{
		return false;    
	}
	return true;
}


//±æÀÌ°è»ê
//Çü½Ä : StringSize(Æûvalue°ª)
//¿¹ : StringSize(document.form1.title.value)
//°á°ú : ±æÀÌ¹ÝÈ¯
function StringSize(str) {
	var i, len=0;
	for(i=0;i < str.length; i++) len++;
	return len;
}



// focus  ÀÌµ¿
//Çü½Ä : MoveFocus(this,6,jumin2)
//°á°ú : ÀÏÁ¤±æÀÌÈÄ ÀÚµ¿À¸·Î Æ÷Ä¿½º ÀÌµ¿
function MoveFocus( val, len, nextfocus ){
	var myvalue = val.value;
	if ( myvalue.length == len ) {
		nextfocus.select();
		nextfocus.focus();
	}
}



//ÁÖ¹Î¹øÈ£ À¯È¿¼º Ã¼Å©
//Çü½Ä : CheckRID(ÁÖ¹Î1, ÁÖ¹Î2)
//¿¹ : CheckRID(731211,1211125)
//°á°ú : Á¤»ó(true), ºñÁ¤»ó(false)

var NUM = "0123456789";
var CHAR = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

function CheckRID (sRIDFirst, sRIDLast) {
	var chk = 0;
	
	var nYear = sRIDFirst.substring(0,2);
	var nMondth = sRIDFirst.substring(2,4);
	var nDay = sRIDFirst.substring(4,6);
	
	var nSex = sRIDLast.charAt(0);
	
	if ( sRIDFirst.length!=6 ||  nMondth<1 || nMondth>12 || nDay<1 || nDay>31) {
		return false;
	}
	
	
	if ( sRIDLast.length!=7 || (nSex!=1 && nSex!=2 && nSex!=3 && nSex!=4) ) {
		return false;
	}
	
	var i;

	for (i=0; i<6; i++) {
		chk += ( (i+2) * parseInt( sRIDFirst.charAt(i) ));
	}
	
	for (i=6; i<12; i++) {
		chk += ( (i%8+2) * parseInt( sRIDLast.charAt(i-6) ));
	}
	
	chk = 11 - (chk%11);
	chk %= 10;
	
	if (chk != parseInt( sRIDLast.charAt(6))) {
		return false;
	}
	
	return true;
}


//===================================================================================================
// Ã¤Å©¹Ú½º ³ª ¶óµð¿À ¹öÆ° ¼±ÅÃ¿©ºÎÈ®ÀÎ ÇÔ¼ö
//	if (!checkSelect(form,"memberID"))
//	{
//		alert("¼±ÅÃÇÏ½Å ¾ÆÀÌµð°¡ ¾ø½À´Ï´Ù.");
//	}

function checkSelect(form, InputName) {

	var i = 0; 
	while (i < form.elements.length) {
		if (form.elements[i].name == InputName) {
			if (form.elements[i].checked == true) {
				return true
			}
		}
		i++;
	}
	return false
}


// Textarea ¾È¿¡ Á¤ÇØÁø byte¸¸Å­¸¸ µé¾î°¡±â

function updateChar(length_limit, form, inputName)
{
	var comment='';
	comment = eval("form."+inputName);
	var length = calculate_msglen(comment.value);
	//document.getElementById("textlimit").innerHTML = length;
	if (length > length_limit) {
		alert("ÃÖ´ë " + length_limit + "byte ±îÁö ¾²½Ç¼ö ÀÖ½À´Ï´Ù.\nÃÊ°úµÈ ±ÛÀÚ¼ö´Â ÀÚµ¿À¸·Î »èÁ¦µË´Ï´Ù.");
		comment.value = comment.value.replace(/\r\n$/, "");
		comment.value = assert_msglen(comment.value, length_limit);
	}
}

function calculate_msglen(message)
{
	var nbytes = 0;

	for (i=0; i<message.length; i++) {
		var ch = message.charAt(i);
		if(escape(ch).length > 4) {
			nbytes += 2;
		} else if (ch == '\n') {
			if (message.charAt(i-1) != '\r') {
				nbytes += 1;
			}
		} else if (ch == '<' || ch == '>') {
			nbytes += 4;
		} else {
			nbytes += 1;
		}
	}

	return nbytes;
}

function assert_msglen(message, maximum)
{
	var inc = 0;
	var nbytes = 0;
	var msg = "";
	var msglen = message.length;

	for (i=0; i<msglen; i++) {
		var ch = message.charAt(i);
		if (escape(ch).length > 4) {
			inc = 2;
		} else if (ch == '\n') {
			if (message.charAt(i-1) != '\r') {
				inc = 1;
			}
		} else if (ch == '<' || ch == '>') {
			inc = 4;
		} else {
			inc = 1;
		}
		if ((nbytes + inc) > maximum) {
			break;
		}
		nbytes += inc;
		msg += ch;
	}
	//document.getElementById("textlimit").innerHTML = nbytes;
	return msg;
}




/////////////////////////////  »ó´Ü FLASH ¸Þ´º ¸µÅ© //////////////////////////////////////////////

function TopNavi(num)
{

	switch(num)
	{

		//½Ã³×¸¶ ÆÄÆ¼ ¼Ò°³
		case 100:
		location.href = ("/cinemainfo/cinemainfo_intro_01.asp");											//½Ã³×¸¶ÆÄÆ¼ ¼Ò°³ ¸ÞÀÎ
		break;

		case 101:
		location.href = ("/cinemainfo/cinemainfo_intro_01.asp")											//¼­ºñ½º ¼Ò°³
		break;

		case 102:
		location.href = ("/CinemaInfo/CinemaInfo_summary.asp")										//ÀÍ¸íÁ¶ÇÕ °³¿ä
		break;
		
		case 103:
		location.href = ("/Event/OnlineCF/")																			//¿Â¶óÀÎCF
		break;


		//ÅõÀÚÇÏ±â
		case 200:
		location.href = ("/Investment/Investment_Info_about.asp");										//ÅõÀÚÇÏ±â ¸ÞÀÎ
		break;

		case 201:
		location.href = ("/Investment/Investment_Info_about.asp")										//ÅõÀÚ¾È³»
		break;

		case 202:
		location.href = ("/Investment/Investment_Fare_Guide.asp")										//¿ä±Ý»óÇ°ÅõÀÚ
		break;

		case 203:
		location.href = ("/Investment/Investment_Cash_Guide.asp")										//Çö±ÝÅõÀÚ
		break;


		//ÅõÀÚ¿µÈ­Á¤º¸
		case 300:
		location.href = ("/InvestMovieinfo/welcom_invest_point.asp");									//ÅõÀÚ¿µÈ­Á¤º¸ (À£ÄÄÅõ µ¿¸·°ñ)
		break;

		case 301:
		location.href = ("/InvestMovieinfo/welcom_invest_point.asp")									//À£ÄÄÅõ µ¿¸·°ñ
		break;

		case 302:
		location.href = ("/InvestMovieinfo/beast_default.asp")														//¾ß¼ö¿Í ¹Ì³à
		break;


		//Á¦ÀÛÇöÀå
		case 400:
		location.href = ("/Board/Note_List.asp?MI_Num=1");													//Á¦ÀÛÇöÀå (À£ÄÄÅõ µ¿¸·°ñ)
		break;

		case 401:
		location.href = ("/Board/Note_List.asp?MI_Num=1")													//À£ÄÄÅõ µ¿¸·°ñ
		break;


		//¿µÈ­ÀÌ¾ß±â
		case 500:
		location.href = ("/MovieStory/IF_Director/IF_Director_List.asp");													//¿µÈ­ÀÌ¾ß±â
		break;

		case 501:
		location.href = ("/MovieStory/IF_Director/IF_Director_List.asp")													//³»°¡ °¨µ¶ÀÌ¶ó¸é
		break;

		case 502:
		location.href = ("/MovieStory/Review/Review_List.asp")											//ÇÑÁÙÆò
		break;


		//ÀÌº¥Æ®
		case 600:
		location.href = ("/Event/Event_001/Event01.asp");																									//ÀÌº¥Æ®
		break;

		default:
		location.href = ("/Event/Event_001/Event01.asp");		
		break;
	}
}

