function whitespaces(value)
{

	var text=value;

	while(text.indexOf(' ') == 0)
	text=text.substring(1,text.length);

	while(text.lastIndexOf(' ') == text.length-1 && text.length != 0)
	text=text.substring(0,text.length-1);

	return text;
}

function isEmpty( theField, name ) 
{
	var fieldValue = "";
	//alert(theField.type);
	if ( theField.type == 'select-one' )
		fieldValue = theField[theField.selectedIndex].value;
	else
		fieldValue = theField.value;
	if ( fieldValue == "" ) {
		alert("Please Enter " + name );
		theField.focus();
		return (false);
	}
	return (true);
}

function isDigit( theField, name )
{
	var checkOK = "0123456789.";
	var checkStr = theField.value;
	var allValid = true;
	var decPoints = 0;
	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;
	    }
		allNum += ch;
	}
	if ( !allValid ) {
		alert( "Please enter only numbers in " + name + " field." );
	    theField.focus();
	    return(false);
	}
	return(true);
}

function isNotAlphabets(str){
	for (var i = 0; i < str.length; i++){
		var ch = str.substring(i, i + 1);
		if((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) {
			return true;
		}
	}
	return false;
}