function emailValidator(elem)
{
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp))
    {
		return true;
	}
    else
    {		
		elem.style.background="lightyellow";
		return false;
		document.getElementById("abc").innerHTML="This is not a valid email address";
	}
}


function chk_numeric(e,x)
{
	var checkOK = "0123456789()-";
	var checkStr = e;
	var allValid = true;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		document.getElementById("abc").innerHTML="Enter only digits in this field.";
		return 0;
	}
	else
	{
		return 1;
	}
}

function chk_number_or_empty(e,x)
{
	// Return if zero lenght
	if(e.length<=0)
	{
		//document.getElementById("abc").innerHTML='Write  ..'+x;
		return 1;
	}
	
	// Make sure we have an integer only
	var checkOK = "0123456789";
	var checkStr = e;
	var allValid = true;
	var allNum = "";
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
		if (ch != ",")
		allNum += ch;
	}
	if (!allValid)
	{
		document.getElementById("abc").innerHTML="Enter only digits in this field.";
		return 0;
	}
	else
	{
		return 1;
	}
} // chk_number_or_empty


// Make sure that there is something entered, not too long or empty
function empty_chk(e,x)
{
	if(e.length<=0 || e.length>20)
	{
		//document.getElementById("abc").innerHTML='Write  ..'+x;
		return 0;
	}
	else
	{
		//document.getElementById(x).style.background="white";
		return 1;
	}
}
