function setPaymentInfo(isChecked)
{
	with (window.document.frmCheckout) {
		if (isChecked) {
			txtShippingFirstName.value  = txtPaymentFirstName.value;
			txtShippingLastName.value   = txtPaymentLastName.value;			
			txtShippingAddress1.value   = txtPaymentAddress1.value;				
			txtShippingState.value      = txtPaymentState.value;
			//txtShippingStateOther.value = txtPaymentStateOther.value;
			txtShippingCity.value       = txtPaymentCity.value;
			txtShippingPostalCode.value = txtPaymentPostalCode.value;
			//txtShippingCountry.value    = txtPaymentCountry.value;			
			
			txtShippingFirstName.readOnly  = true;
			txtShippingLastName.readOnly   = true;			
			txtShippingAddress1.readOnly   = true;			
			txtShippingState.readOnly      = true;			
			txtShippingCity.readOnly       = true;
			txtShippingPostalCode.readOnly = true;			
		} else {			
			txtShippingFirstName.value  = "";
			txtShippingLastName.value   = "";			
			txtShippingAddress1.value   = "";		
			txtShippingState.selectedIndex = 0;			
			txtShippingCity.value       = "";
			txtShippingPostalCode.value = "";		
			
			txtShippingFirstName.readOnly  = false;
			txtShippingLastName.readOnly   = false;		
			txtShippingAddress1.readOnly   = false;			
			txtShippingState.readOnly      = false;			
			txtShippingCity.readOnly       = false;
			txtShippingPostalCode.readOnly = false;			
		}
	}
}


function checkShippingAndPaymentInfo()
{
	with (window.document.frmCheckout) {
      var doc = txtShippingAddress1; 
      var valstreet_address = new RegExp("[pP]{1}[.]*[oO]{1}[.]*[ ]*[bB]{1}[oO]{1}[xX]{1}"); 

		if (isEmpty(txtPaymentFirstName, 'Please Enter Payment first name')) {
			return false;
		} else if (isEmpty(txtPaymentLastName, 'Please Enter Payment last name')) {
			return false;
		} else if (isEmpty(txtPaymentAddress1, 'Please Enter Payment address')) {
			return false;
		//} else if (isEmpty(txtPaymentPhone, 'Please Enter phone number')) {
		//	return false;
		} else if (isEmpty(txtPaymentState, 'Please Enter Payment address state')) {
			return false;
		} else if (isEmpty(txtPaymentCity, 'Please Enter Payment address city')) {
			return false;
		} else if (isEmpty(txtPaymentPostalCode, 'Please Enter the Payment address postal/zip code')) {
			return false;
		} else if (isEmpty(txtPaymentEmail, 'Please enter an email address')){
      return false;
		} else if (isEmpty(txtShippingFirstName, 'Please Enter shipping first name')) {
			return false;
		} else if (isEmpty(txtShippingLastName, 'Please Enter shipping last name')) {
			return false;
		} else if (isEmpty(txtShippingAddress1, 'Please Enter shipping address')) {
			return false;
		//} else if (isEmpty(txtShippingPhone, 'Please Enter phone number')) {
		//	return false;
		} else if (isEmpty(txtShippingState, 'Please Enter shipping address state')) {
			return false;
		} else if (isEmpty(txtShippingCity, 'Please Enter shipping address city')) {
			return false;
		} else if (isEmpty(txtShippingPostalCode, 'Please Enter the shipping address postal/zip code')) {
			return false;
		} else if(doc.value.match(valstreet_address)     != null){
      alert("We cannot ship to PO Boxes. Please change the shipping address."); 
      doc.focus();
      return false;
		}
		//else if (isEmpty(txtPaymentMethod, 'Enter the Payment Method')) {
			//return false;	
		//} 
		else {
			return true;
		}
	}
}


function checkPaymentInfo()
{
	with (window.document.frmCheckout) {
		//if (isEmpty(ShippingMethod, 'Select a Shipping Method')) {			
		//	return false;
		//} else 
		if(PaymentMethod.selectedIndex == 0){
			alert('Please Enter an Card Type');
			PaymentMethod.focus();
			return false;
		}else if(isEmpty(CC, 'Please Enter a Credit Card Number')) {
			return false;
		}else if(isEmpty(CCV, 'Please Enter a Security Code')){
			return false;
		}else if(isEmpty(CC_name, 'Please Enter the name as it appears on the credit card.')){
			return false;
		}else if (expire_month.selectedIndex == 0) {
			alert('Please Enter an Expiration Date');
			formElement.focus();
			return false;
		} else if (expire_year.selectedIndex == 0) {
			alert('Please Enter an Expiration Year');
			expire_year.focus();
			return false;
		} else if (CCLen(CC,'The Credit Card Number is too short')){ 			
			return false;		
		} else if (CC.value != "" && !IsNumeric(CC.value)){ alert('The Credit Card Number contains invalid characters');		
			return false;	
		} else if (CCV.value != "" && !IsNumeric(CC.value)){ alert('The Security Code Number contains invalid characters');		
			return false;	
		} else {
			return true;
		}
	}
}
