/*
 * ÆÄ ÀÏ ¸í : check.js
 * ÀÛ ¼º ÀÚ : ÀÌ¿µ¶õ
 * ÀÛ ¼º ÀÏ : 2002.08.
 * ¼öÁ¤³»¿ª :
 *					³¯Â¥ :
 *					³»¿ª :
 * ¼³   ¸í : ´ÙÀ½ ÇÊµå·Î Ä¿¼­ ³Ñ±â±â, Æ¯Á¤ÆÄÀÏ¸¸ ¾÷·Îµå
*/

//´ÙÀ½ ÇÊµå·Î Ä¿¼­ ³Ñ±â±â.
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; 
} 

// Æ¯Á¤ÆÄÀÏ¸¸ ÀúÀå
extArray = new Array(".gif", ".jpg"); 
function LimitAttach(form, file) { 
	allowSubmit = false; 

	if (!file) return; 
	
	while (file.indexOf("\\") != -1) 
	file = file.slice(file.indexOf("\\") + 1); 
	ext = file.slice(file.indexOf(".")).toLowerCase(); 

	for (var i = 0; i < extArray.length; i++) { 
		if (extArray[i] == ext) { allowSubmit = true; break; } 
	} 

	if (allowSubmit){
		return true; 
	}else {
	 	alert("¾Æ·¡ ÇüÅÂÀÇ ÆÄÀÏ¸¸ ¾÷·Îµå ÇÒ ¼ö ÀÖ½À´Ï´Ù:  " + (extArray.join("  ")) + "\n´Ù½Ã ¼±ÅÃ ÇØ ÁÖ¼¼¿ä"); 
		return false;	
	}
} 

