// Ganesh Chandra 
var whitespace = " \t\n\r";
// Check for Empty Spaces
function isEmpty(val){
	return ((val == null) || (val.length == 0))}

// Checks for the Valid Month
function isNotValidMonth(val){
	if (val < "01" || val > "12"){
		return true;
	}   
	return false;}
// Checks for the Valid Date
function isNotValidDate(val){
	if (val < "01" || val > "31"){
		return true;
	}   
	return false;}

// Checks for the Valid Year
function isNotValidYear(val){
	if (val < "1910" || val > "2050") 
	{
		return true;}   
	return false;}

// Checks for Number

function isNotNum(val){
// Return true if characters are not '0-9' or '.' . 

	for (var i = 0; i < val.length; i++){
		var ch = val.substring(i, i + 1);
		if ((ch < "0" || "9" < ch) && ch != '.')
		return true;
	}
	return false;}

// Checks for Integer

function isNotInteger(val){
// Return true if characters are not '0-9'  
	for (var i = 0; i < val.length; i++) 
	{
		var ch = val.substring(i, i + 1);
		if ((ch < "0" || "9" < ch))
		return true;
	}
	return false;}

// For Building String

function BuildString(str, str1){
	if (str.length > 0) str = str + "\n";
		str = str + str1;
	return str;}

// Checks for Alphabets
function isNotAlpha(val){
// Return false if characters are not a-z, A-Z, or a space.
	for (var i = 0; i < val.length; i++) 
	{
		var ch = val.substring(i, i + 1);
		if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ') 
			return true;
	}
	return false;}

// Checks if item is selected or not 
// Return false if the state is not selected

function isSelected(val){
	if (val.selectedIndex == 0)
		return true;}

// Checks for LENGTH of characters
function isLength(val,len){
	if (val.length != len)
		return true;}

// Checks for LENGTH Less Than of characters
function isLengthlt(val,len){

	if (val.length < len)
		return true;
	else 
		return false;}

// Checks for LENGTH Greater Than of characters
function isLengthgt(val,len){
	if (val.length > len)
		return true;
	else
		return false;}
// Check for email

function isNotEmail(val){
	if (val.indexOf ('@',0) == -1 || val.indexOf ('.',0) == -1)
		return true}

//Check for Comma
function isNotComma(val){
	if (val.indexOf(',',0) == -1)
		return true}

function isWhitespace (val){
	var i;
	if (isEmpty(val))
		return true;
	// Search through string's characters one by one until we find a non-whitespace character. When we do, return false; if we don't, return true.
	for (i = 0; i < val.length; i++){   
		var c = val.charAt(i); // Check that current character isn't whitespace.
		if (whitespace.indexOf(c) == -1)
			return false;}
return true;} // All characters are whitespace.
