function validnum(mnum) {
	mlen=mnum.length;
	cnt=0;
	for (var i = 0; i < mlen; i++)	{
		if (mnum.substring(i,i+1) != 0) {
			if (!parseInt(mnum.substring(i,i+1)))
				cnt++;
		}
	}
	if ((cnt>0))
		return 0;
	else
		return 1;
}

function isName(str)
{
	if (str.length < 3)
		return false;
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i+1);
		var ch1 = str.substring(i+1, i+2);
		var ch2 = str.substring(i+2, i+3);
		if ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch != '.') && (ch != ' '))
		{
			return false;
		}
		if (ch == ch1 && ch1 == ch2)
			return false;
	}
	return true;
}


function validPhoneNum(phoneNum) {
	var ctrZeros = 0;

	phoneNum = phoneNum.replace(/\(/g, "");		// Take out all left parentheses
	phoneNum = phoneNum.replace(/\)/g, "");		// Take out all right parentheses
	phoneNum = phoneNum.replace(/\-/g, "");		// Take out all hyphens
	phoneNum = phoneNum.replace(/\s/g, "");		// Take out all spaces

	PNlen = phoneNum.length;
	if ((PNlen < 6) || (PNlen > 10)) {
		alert('The phone number entered is invalid.\n\nPhone numbers must contain at least 6 digits and not more than 10 digits.');
		return false;
	}

	for (ctr = 0; ctr < PNlen; ctr++) {
		var vDigit = phoneNum.charAt(ctr);
		if (ctr==0)
		{
		  if(vDigit=="0" || vDigit=="1")
			{
			alert('Your phone number cannot start with ' + vDigit );
			return false;
			}
		}
		if ((vDigit < "0") || (vDigit > "9")) {
			alert('There are invalid characters in your phone number.\nPlease re-enter the phone number.\n\nValid characters are (, ), -, spaces, and the digits 0 through 9.');
			return false;
		}
		else if (vDigit == "0") {
			ctrZeros = ctrZeros + 1;
		}
	}

	if (ctrZeros == PNlen) {
		alert('The phone number entered is invalid.\n\nPlease re-enter a valid phone number.');
		return false;
	}
	return true;
}

function validEmail(email) {
	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
	var checkend=/\.[a-zA-Z]{2,3}$/;

	if((email.search(exclude) != -1) || (email.search(checkend) == -1)) {
		return false;
	}

	atPos = email.indexOf("@",0);
	pPos1 = email.indexOf(".",0);
	periodPos = email.indexOf(".",atPos);

	pos1 = pPos1;
	pos2 = 0;
	while (pos2 > -1) {
		pos2 = email.indexOf(".",pos1+1);
		if (pos2 == pos1+1) {
			return false;
		} else {
			pos1 = pos2;
		}
	}

	if (atPos == -1) {
		return false;
	}

	if (atPos == 0) {
		return false;
	}

	if (pPos1 == 0) {
		return false;
	}

	if(email.indexOf("@",atPos+1) > -1) {
		return false;
	}

	if (periodPos == -1) {
		return false;
	}

	if (atPos+1 == periodPos) {
		return false;
	}

	if (periodPos+3 > email.length) {
		return false;
	}
	return true;
}


function isBlank(s)
{
	  var len,k,flg;
	  flg=true;
	  if(s!=null)
	  {
		len=s.length;
		for(k=0;k<len;k++)
		 {
		  if(s.substring(k,k+1)!=" ")
				flg=false;
		 }
	  }
	 return flg;
}
