<!--
function isNum(str)
{	
	var num   = "0123456789";
	for(var i=0; i<str.length; i++)
		if(num.indexOf(str.substring(i, i+1))<0)
			return false;
	return true;
}

function isAlpha(str)
{
	var alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	for(var i=0; i<str.length; i++)
		if(alpha.indexOf(str.substring(i, i+1)) < 0)
			return false;
	return true;
}

function checkEmail(str) {
	var supported = 0;
	if (window.RegExp) {
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}
	if (!supported) {
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
	}
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	return (!r1.test(str) && r2.test(str));
}


function TypeCheck(target, cmt, astr, lmin, lmax)
{
	var t = target.value;

	if (t.length < lmin || t.length > lmax) 
	{
		if (lmin == lmax) alert(cmt + " should be " + lmin + " characters long!");
		else alert(cmt + " should be " + lmin + " ~ " + lmax + " characters long!");
	
		target.focus();
		target.select();
		return false;
	}

	if (astr.length > 1) 
	{
		for (i=0; i<t.length; i++)
			if(astr.indexOf(t.substring(i,i+1))<0) 
			{
				alert("There is at least one invalid character in " + cmt + "!");
				target.focus();
				target.select();
				return false;
			}
	}
	return true;
}

function isValidUserID(o) // get Object as argument
{
	var num   = "0123456789";
	var alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
	var alnum = num + alpha + "_"
	
	if(! TypeCheck(o, "User ID", alnum, 4, 15)) return false;
	
	if(alpha.indexOf(o.value.substring(0,1)) < 0) 
	{
		alert("The first letter in username should be alphabet!")
		o.focus();
		o.select();
		return false;
	}
	return true;
}

	
/////////////////////////////////////////////
var windowUserIDCheck;
function checkUserIDAvailability()
/////////////////////////////////////////////
{
	var o = MM_findObj("signup");
	var userID = trim(o.userID.value);
	if(userID == "")
	{
		alert("Please type user id first!");
		o.userID.focus();
		return;
	}
	else
	{
		if(isValidUserID(o.userID))
		{
			if(typeof(windowUserIDCheck) == "undefined" || windowUserIDCheck.closed)
			{
				var url = "checkUserID.php?userID=" + userID;
				windowUserIDCheck = window.open(url, "windowUserIDCheck", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=320,height=175");
			}
			windowUserIDCheck.focus();
		}
		else
			return;
	}
}
-->