// clears the mm/yy fields onClick
function clearExpiryMonth(theField){
	clearField(theField, "mm")
}

function clearExpiryYear(theField){
	clearField(theField, "yy")
}

function showDefaultExpiryMonth(theField){
	showDefaultField(theField, "mm")
}

function showDefaultExpiryYear(theField){
	showDefaultField(theField, "yy")
}

function clearField(theField, itsDefaultValue){
	if ((theField.value == itsDefaultValue)) {
		theField.value = "";
		theField.style['color'] = '#000';  //YAHOO.util.Dom.setStyle(theField, 'color', '#000');
	}
}

function showDefaultField(theField, itsDefaultValue){
	if ((theField.value == "")) {
		theField.value = itsDefaultValue;
		theField.style['color'] = '#aaa';  //YAHOO.util.Dom.setStyle(theField, 'color', '#000');
	}
}

/* ------------------------------------------------------------------------------- 
		Function for preventing multiple submit.
		It both submits the form and ensures the form can not be submit again
		by reassigning the funciton to a function that does nothing.
		It also disables the buttons (this part only works in IE).
		aForm - the form the buttons are in
------------------------------------------------------------------------------- */
function safeSubmit(aForm) {
	disableSubmitButtons(aForm);
	aForm.submit();
	safeSubmit = blockIt;
	return false;
}

/* ------------------------------------------------------------------------------- 
		Disable all submit buttons in a form.
		aForm - the form the buttons are in
------------------------------------------------------------------------------- */
function disableSubmitButtons(aForm) {
	for (i = 1; i < aForm.elements.length; ++i) {
		if (aForm.elements[i].type == 'submit') {
			aForm.elements[i].disabled = true;
		}
	}
}

/* ------------------------------------------------------------------------------- 
		Dummy function that is used in conjunciton with safeSubmit(f) to prevent 
		multiple submits.
------------------------------------------------------------------------------- */
function blockIt(aForm) {
	return false;
}	


function submitCountryChange(selectControl)
{
	// set the value hidden field "apply_coutry" to "true" and submit
	var applyCoutryHiddenField = document.getElementById("apply_coutry")
	applyCoutryHiddenField.value = "true";
	selectControl.form.submit();
	return true;
}

