function validEmailAddress(email)
{
		invalidChars = " /:,;~"
		if (email == "") 
		{
			return (false);
		}
		for (i=0; i<invalidChars.length; i++) 
		{
			badChar = invalidChars.charAt(i)
			if (email.indexOf(badChar,0) != -1) 
			{
				return (false);
			}
		}
		atPos = email.indexOf("@",1)
		if (atPos == -1) 
		{
			return (false);
		}
		if (email.indexOf("@",atPos+1) != -1) 
		{
			return (false);
		}
		periodPos = email.indexOf(".",atPos)
		if (periodPos == -1) 
		{
			return (false);
		}
		if (periodPos+3 > email.length)	
		{
			return (false);
		}
			
		return (true);
}

/*function checkEmpty(){
	var val = TrimSTR(document.getElementById('search').value) == '';
	if(val){
	alert('Please enter your search keyword.');
	document.getElementById('search').focus();
	return false;
	}
}*/

function checkEmpty(){
	var val = TrimSTR(document.getElementById('ProductName').value) == '';
	if(val){
	alert('Please enter your search keyword.');
	document.getElementById('ProductName').focus();
	return false;
	}
}

function checkEmptyemail(){
	var val = TrimSTR(document.getElementById('ProductEmail').value) == '';
	if(val)
	{
		alert('Please Enter Email Address.');
		document.getElementById('ProductEmail').focus();return false;
	 }

	 else if (!validEmailAddress(document.getElementById('ProductEmail').value)) 
		{
			alert('Please Enter Valid Email Address.');return false;
			document.getElementById('ProductEmail').focus();return false;
		}

	return true;
}

function TrimSTR(strValue) {
	// REMOVE leading spaces.
	while (true) {
		if (strValue.indexOf(" ") == 0) {								// a leading space has been found so...
			strValue = strValue.substring(1, strValue.length)			// slice it off.
		} else {														// the first character in the string is no longer a space so...
			break														// exit the loop.
		}
	}

	// REMOVE trailing spaces.
	if (strValue.length > 0) {	// the string is not null.
		while (true) {
			if (strValue.lastIndexOf(" ") == strValue.length - 1) {			// a trailing space has been found so...
				strValue = strValue.substring(0, strValue.length - 1)	// slice it off.
			} else {													// the last character in the string is no longer a space so...
				break													// exit the loop.
			}
		}
	}

	// ASSIGN return value
	return strValue
}