_onLoad = "";
spc = / /g;
num = /[^0-9]/;
alphanum = /[^0-9A-Za-z@.,\-()\ ]/;
alphanum_error = " alpha-numeric characters only and .,@()-\n";

function removeSpaces( f, field ) {
	eval( "var s = new String( f." + field + ".value );" );
	s = s.replace( spc, new String("") );
	eval( "f." + field + ".value = s.toUpperCase();" );
}

function checkEqualto( f, fields, fieldnames ) {
	var ok = new Boolean();

	eval( "ok = (f." + fields[0] + ".value == f." + fields[1] + ".value );" );

	if( ok == false )
		alert( ((fieldnames != null) ? fieldnames[0] : fields[0]) + " and " + ((fieldnames != null) ? fieldnames[1] : fields[1]) + " do not match." );
	
	return ok;
}

function checkAlphaNum( f, fields ) {
	var err = new String();
	var ok = new Boolean();

	for( x=0; x<fields.length; x++ ) {
		eval( "ok = alphanum.test( f." + fields[x] +  ".value );" );
		if( ok )
			err += "     " + fields[x] + " " + alphanum_error;
	}

	if( err.length ) {
		alert( "The required following field(s) have been left blank: \n" + err );
		return false;
	} else return true;
}

function checkRequired( f, fields, fieldnames ) {
	var err = new String();
	var ok = new Boolean();

	for( x=0; x<fields.length; x++ ) {
		eval( "var Type = f." + fields[x] + ".type;" );
		switch( Type ) {
			case "text":
			case "password":
				eval( "ok = (f." + fields[x] + ".value.length > 0);" );
			break;
			case "select-one":
				eval( "ok = (f." + fields[x] + ".selectedIndex > 0);" );
			break;
		}
		if( !ok )
			err += "     " + ((fieldnames != null) ? fieldnames[x] : fields[x]) + " is required\n";
	}

	if( err.length ) {
		alert( "The following errors have been encountered: \n" + err );
		return false;
	} else return true;
}

function popMe(where,who,dX,dY) {
	var newwin=open(where,who,"width="+dX+",height="+dY+",scrollbars=yes,status=no,resize=no,toolbar=yes");
}

function round( number, X ) {
	X = ( !X ? 2 : X );
	return Math.round( number * Math.pow(10, X) ) / Math.pow( 10, X );
}

function bon ( imgName ) {
   eval( "document [imgName].src = " + imgName + "1.src;" );
}

function boff ( imgName ) {
   eval( "document [imgName].src = " + imgName + ".src;" );
}

