function TextValueCheck(Obj, Msg)
{
	if(Obj.value == "")
	{
		alert(Msg);
		Obj.focus();
		return false;
	}
	return true;
}

function TextValueCheckInt(Obj, Msg)
{
	if(!CheckNumber(Obj.value)){
		alert(Msg);
		Obj.focus();
		return false;
	}
	return true;
}

function TextValueCheckEmail(Obj, Msg)
{
	if(!CheckEmail(Obj.value)){
		alert(Msg);
		Obj.focus();
		return false;
	}
	return true;
}

function RadioValueCheck(Obj, Msg)
{
	var SelectCheck;
	SelectCheck	=	false;
	for(var i=0; i < Obj.length; i++)
	{
		if(Obj[i].checked == true)
		{
			SelectCheck	=	true;
			return true;
		}
	}

	alert(Msg);
	return false;
}

function CheckNumber(CheckValue)
{
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (anum.test(CheckValue))
		return true;	
	else
		return false;
}


function CheckNumberAndEngligh(CheckValue) 
{
	var valid = "abcdefghijklmnopqrstuvwxyz0123456789"
	var temp;
	for (var i=0; i<CheckValue.length; i++) 
	{

		temp = "" + CheckValue.substring(i, i+1);
		if (valid.indexOf(temp) == "-1")
			return false;
	}
	return true;
}

function checkMixString(str){
	//f=document.frm; //Æû°´Ã¼
	//v=f.t0.value; //ÆûÀÔ·Â°ª
	rea=/[a-zA-Z~!@\#$%^&*\()\-=+_]/; //¿µ¹®¹× Æ¯¼ö¹®ÀÚ
	re0=/[0-9]/; //¼ýÀÚ
	flag=0; //Ã¼Å©ÇÃ·¡±×

	//¿¡·¯¸Þ½ÃÁö ¹è¿­
	err=new Array(
	'¿µ¹®°ú ¼ýÀÚ°¡ Æ÷ÇÔµÇ¾î¾ß µË´Ï´Ù.',
	'¼ýÀÚµµ Æ÷ÇÔµÇ¾î¾ß µË´Ï´Ù.',
	'¿µ¹®µµ Æ÷ÇÔµÇ¾î¾ß ÇÕ´Ï´Ù.',
	'ÀßÇß½À´Ï´Ù.'
	);

	if(rea.test(str)){ //¿µ¹®Å×½ºÆ®
		flag+=1;
	}   
	if(re0.test(str)){ //¼ýÀÚÅ×½ºÆ®
		flag+=2;
	}
	if(flag!=3){ //¿À·ùÀÎ°æ¿ì ¿¡·¯Ãâ·Â
		//alert('ºñ¹Ð¹øÈ£´Â ¿µ¹®(Æ¯¼ö¹®ÀÚÆ÷ÇÔ)°ú ¼ýÀÚ°¡ Æ÷ÇÔµÇ¾î¾ß µË´Ï´Ù.');
		return false;
	}
	return true;
}

function CheckEmail(CheckValue)
{
	var filter=/^((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(CheckValue)) {
		return true;
	}
	else {
		return false;
	}
}

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;
}
