function doAction( f, button ) {
         f.action.value = button.name;
         f.submit();
         return true;
}
function doActionLink( f, action ) {
         f.action.value = action;
         f.submit();
         return true;
}
function enrollMe( f ) {
	if( f.dealer_fname.value.match(/^\s*$/) ||
	    f.dealer_lname.value.match(/^\s*$/) ||
	    f.dealer_addr1.value.match(/^\s*$/) ||
	    f.dealer_city.value.match(/^\s*$/) ||
	    f.dealer_state.selectedIndex == 0 ||
	    f.dealer_zipcode.value.match(/^\s*$/) ||
	    f.dealer_phone1.value.match(/^\s*$/) ||
	    f.dealer_email.value.match(/^\s*$/) ||
	    f.dealer_password.value.match(/^\s*$/) ||
	    f.dealer_cpassword.value.match(/^\s*$/) ) 
	{
	    alert( 'Please fill in ALL fields that has a RED * next to it!' );
	    f.dealer_fname.focus();
	    return false;
	}

	if( f.dealer_password.value.length < 6 || 
	    f.dealer_password.value != f.dealer_cpassword.value )
	{
	    alert( 'Password & Confirm Password must match and be at least 6 characters long!' );
	    f.dealer_password.focus();
	    return false;
	}

	if( game_list.length == 0  && ! f.no_exp.checked ) {
            alert( 'Please Enter Your Experience For At Least One Game\n or Check No Experience!' );
	    f.games_dealt_1.focus();
	    return false;
	}

	doActionLink( f, 'enrollDealer' );
}
function check4numeric( field ) {
	if( field.value.match(/^\s*$/) ) return;
	if( ! field.value.match(/^\d+$/) ) {
	    alert( 'Value Must Be Numeric!' );
	    field.value = '';
	    field.focus();
	    return false;
	}
	game_list.push( field );
}
function changeMonth( f, change_month, action ) {
	f.change_month.value = change_month;
	doActionLink( f, 'eventCalendar' );
}
function viewMyEvent( f, event_id ) {
	f.event_id.value = event_id;
	doActionLink( f, 'viewMyEvent' );
}
function viewEvent( f, event_id ) {
	f.event_id.value = event_id;
	doActionLink( f, 'viewEvent' );
}
function signupEvent( f, button ) {
	if( game_checked == 0 ) {
	    alert("Please Select A Game To Deal");
	    return false;
	}
	
	doAction( f, button );
}
function printerFriendly( f ) {
	var url = '/index.pl?sid=' + f.sid.value + '&action=printMyEvents';
	var settings='width=950,height=700,top=100,left=100,scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
	my_events = window.open( url, "MyEvents", settings);
	my_events.focus();
}
function saveProfile( f ) {
        if( f.dealer_fname.value.match(/^\s*$/) ||
            f.dealer_lname.value.match(/^\s*$/) ||
            f.dealer_addr1.value.match(/^\s*$/) ||
            f.dealer_city.value.match(/^\s*$/) ||
            f.dealer_state.selectedIndex == 0 ||
            f.dealer_zipcode.value.match(/^\s*$/) ||
            f.dealer_phone1.value.match(/^\s*$/) ||
            f.dealer_password.value.match(/^\s*$/) ||
            f.dealer_cpassword.value.match(/^\s*$/) )
        {
            alert( 'Please fill in ALL fields that has a RED * next to it!' );
            f.dealer_fname.focus();
            return false;
        }

        if( f.dealer_password.value.length < 6 ||
            f.dealer_password.value != f.dealer_cpassword.value )
        {
            alert( 'Password & Confirm Password must match and be at least 6 characters long!' );
            f.dealer_password.focus();
            return false;
        }

        if( game_list.length == 0  && ! f.no_exp.checked ) {
            alert( 'Please Enter Your Experience For At Least One Game\n or Check No Experience!' );
            f.games_dealt_1.focus();
            return false;
        }

        doActionLink( f, 'saveProfile' );
}
function cancelSignup( f, event_id ) {
        f.event_id.value = event_id;
        doActionLink( f, 'cancelSignup' );
}
