String.prototype.trim = function() {
	a = this.replace(/^\s+/, '');
	return a.replace(/\s+$/, '');
};

function alertError( Page, Error ){
	
	if( Error.trim() == "" ) return false;
	
	Error = Error.replace( / /, "" );
	Error = Error.split( "," );
	switch( Page ){
		case "sample":
			ErrorList = new Array(
				/* 0 */"",
				/* 1 */"Please fill in all fields.",
				/* 2 */"Invalid birthdate!",
				/* 3 */"Invalid Email!",
				/* 4 */"This e-mail address is already registered with us!"
				);
			break;
			case "tell":
			   ErrorList = new Array(
				/* 0 */"",
				/* 1 */"Please fill in all fields.",
				/* 2 */"Invalid Email!"				
				);
			break;
	}

	ErrorMsg = "";
	
	for( var i=0; i<Error.length; i++ ){
		if( ErrorList[ Error[i] ] )
			ErrorMsg += ErrorList[ Error[i] ] + "\n";
	}
	
	if( ErrorMsg.trim() != "" )
		alert( ErrorMsg );
	
	return true;
}