_onLoad = "";
not_here = "";
spc = / /g;
num = /[^0-9]/;
alphanum = /[^0-9A-Za-z@.,\-()\ ]/;
alphanum_error = " alpha-numeric characters only and .,@()-\n";

var ProgramDisclaimer = "PROGRAM DISCLAIMER\n" +
	"\n" +
	"The information presented in this program is intended for general use, and\n" +
	"may not apply to all circumstances. The program is not a definitive guide\n" +
	"to all applicable government legislation and regulation, and does not relieve\n" +
	"participants using this program from their responsibilities under the applicable\n" +
	"legislation and regulation. The program is provided as a public service, and we\n" +
	"do not guarantee the accuracy or completeness of, or assume liability for, the\n" +
	"information presented in this program.";

var TAXEs = new Array();
	TAXEs['AB'] = 0.07;
	TAXEs['BC'] = 0.07;
	TAXEs['MB'] = 0.07;
	TAXEs['NB'] = 0.15;
	TAXEs['NF'] = 0.15;
	TAXEs['NS'] = 0.15;
	TAXEs['NT'] = 0.07;
	TAXEs['NU'] = 0.07;
	TAXEs['ON'] = 0.07;
	TAXEs['PE'] = 0.15;
	TAXEs['QC'] = 0.07;
	TAXEs['SK'] = 0.07;
	TAXEs['YT'] = 0.07;

function checkPIN( f ) {
	var err = new String("");

	f.prefix.value = new String( f.prefix.value ).toUpperCase();

	if( f.prefix.value.length != 3 )
		err += "\tFirst section of PIN needs to be 3 characters long.\n";
	if( f.pin.value.length != 5 )
		err += "\tSecond section of PIN needs to be 5 characters long.\n";
	if( f.password.value.length == 0 )
		err += "\tPassword cannot be blank\n";
	
	if( err.length == 0 )
		return true;
	else {
		alert( "The following error(s) have been encontered:\n" + err );
		return false;
	}
}

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 following errors have been encountered: \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;" );
}

function Login() {
	document.forms['Login'].submit();
}

