function LIB_Commerce_copyPersonalToBilling() {
	document.getElementById('billingcountry').value				= document.getElementById('personalcountry').value;
		
	LIB_Commerce_onBillingCountryChange();
	
	document.getElementById('billingaddressline1').value 	= document.getElementById('personaladdressline1').value;
	document.getElementById('billingaddressline2').value 	= document.getElementById('personaladdressline2').value;
	document.getElementById('billingcity').value 					= document.getElementById('personalcity').value;
	document.getElementById('billingusstate').value 			= document.getElementById('personalusstate').value;
	document.getElementById('billingnotusstate').value 		= document.getElementById('personalnotusstate').value;
	document.getElementById('billingzip').value 					= document.getElementById('personalzip').value;		
}

function LIB_Commerce_onBillingCountryChange() {
	selectedCountry = document.getElementById('billingcountry').value;
	
	// if USA, show dropdown with USA states, else show text box
	if (selectedCountry == '1224') {
		document.getElementById('billingusstate').style.display = '';				
		document.getElementById('billingnotusstate').style.display = 'none';				
	}
	else {		
		document.getElementById('billingusstate').style.display = 'none';				
		document.getElementById('billingnotusstate').style.display = '';				
	}
}

function LIB_Commerce_onCreditCardTypeChange() {
	selectedCardType = document.getElementById('creditcardtype').value;
	
	document.getElementById('securitycodehint_1').style.display='none';
	document.getElementById('securitycodehint_2').style.display='none';
	document.getElementById('securitycodehint_3').style.display='none';
	document.getElementById('securitycodehint_4').style.display='none';
	document.getElementById('securitycodehint_5').style.display='none';
	document.getElementById('securitycodehint_6').style.display='none';
	
	if (selectedCardType) {
		document.getElementById('securitycodehint_'+selectedCardType).style.display='';
	}
}

function LIB_Commerce_onSubscriptionPlanChange(subscriptionPlanObject) {
	description = subscriptionPlanObject.options[subscriptionPlanObject.selectedIndex].getAttribute('description');
	
	if (description == null) {
		descriptionHtml = '&nbsp;';
	}
	else {
		descriptionHtml = '<br>' + description;
	}
	
	document.getElementById('subscriptiondescriptiondiv').innerHTML = descriptionHtml;	
}

function LIB_Commerce_showCreditCardFields() {
	document.getElementById('tr_creditcardtype').style.display='';
	document.getElementById('tr_cardmember').style.display='';
	document.getElementById('tr_creditcardexpdate').style.display='';
	document.getElementById('tr_billingaddresstitle').style.display='';
	document.getElementById('tr_billingcountry').style.display='';
	document.getElementById('tr_billingaddressline1').style.display='';
	document.getElementById('tr_billingaddressline2').style.display='';
	document.getElementById('tr_billingcity').style.display='';
	document.getElementById('tr_billingstate').style.display='';
	
	document.getElementById('span_modifysubscriptiontext1').style.display='none';
	document.getElementById('span_modifysubscriptiontext2').style.display='';

	document.getElementById('showallccinfo').value = 1;
}

function LIB_Commerce_showCreditCardFieldsOnLoad() {
	if (document.getElementById('showallccinfo')) {
		if (document.getElementById('showallccinfo').value == 1) {
			LIB_Commerce_showCreditCardFields();
		}
	}
}


