function quickLink(url) {
	document.location.href = url;
	return true;
}

function fieldClear(el, defaultValue) {
	if (el.value == defaultValue) {
		el.value = '';
	}
}

function fieldDefault(el, defaultValue) {
	if (el.value == '') {
		el.value = defaultValue;
	}
}


$(function(){
	
	// create a popup window for any links with class="popup"
	$('a.popup').click(
		function(){
			var url = $(this).attr('href');
			window.open(url, '_blank', 'top=0, left=0, scrollbars=yes, menubar=yes, toolbar=yes, location=yes');
			return false;
		}
	);
	
	// disable the submit button once clicked
  $('form').submit(function() {
    
    // if we're on the payment page
    if($(this).attr('id') == 'paymentForm') {
      // Make sure the t&c have been accepted before continuing
      if(!$('#tAndCAccepted').is(':checked')) {
        // show popup warning
        $('#warnTandC').dialog({modal: true, autoOpen: false});
        $('#warnTandC').dialog('open');
        // simulate a normal form error
        $('#error_for_tAndCAccepted').html('&darr;&nbsp;Please accept the terms &amp; conditions &nbsp;&darr;').removeAttr('style');
        
        return false; // don't submit, but don't lock the button either
      }
    }
    
    // allow time for all params to be submitted
    // (disabling immediately will prevent submit button param from being sent)
    setTimeout(function() {
      $('input[type=submit]', this).attr('disabled', 'disabled');
    }, 50);
  });
  
});
