Step.shipping = function() {
	//	try {
	var valid = LiveValidation.massValidate( CheckoutValidations.billing_validations );

	if (! Element.hasClassName($('to_shipping'), 'logged_in')) {
		valid = LiveValidation.massValidate([CheckoutValidations.privacy]) && valid;
	}

	if (Element.visible($('billing_d_field'))) {
		valid = CheckoutValidations.billing_state_district[0].validate() && valid;
	}
	if (CheckoutValidations.checkBillingData()) {
		valid = LiveValidation.massValidate( CheckoutValidations.billing_company_validations ) && valid;
	}
	else {
		CheckoutValidations.billing_company_validations.each(function(f) {
			f.removeMessageAndFieldClass();
		})
	}

	if (!(Element.hasClassName($('to_shipping'), 'logged_in')) && $('user_password').value != "") {
		//			try {
		CheckoutValidations.email.forceRemoveMessage();
		valid = LiveValidation.massValidate( CheckoutValidations.billing_user_registration_validations ) && valid;
		new Ajax.Request("/checkout/uniqueness_of_email?email=" + encodeURIComponent($('user_email').value) + "&valid=" + valid, {
			method: 'get'
		});
		return true;
	//			}
	//			catch(e) {
	//				exceptionNotify(e);
	//				return false;
	//			}
	}
	else {
		if (valid) {
			//				try {
			accordion.activate('shipping');
			Fillers.fillBillingPreview();
			Fillers.fillShippingForm();
			stateOrDistrict();
			return true;
		//				}
		//				catch(e) {
		//					exceptionNotify(e);
		//					return false;
		//				}
		}
		return false;
	}
//	}
//	catch(err) {
//		exceptionNotify(err);
//		return false;
//	}
}

Step.payment_method = function() {
	//	try {
//	var shipping_type = Form.getInputs(
//		'order_form',
//		'radio',
//		'order[shipping_type_id]').find(function(radio) {
//		return radio.checked;
//	});

	var valid = LiveValidation.massValidate( CheckoutValidations.shipping_validations );

	if (Element.visible($('shipping_d_field'))) {
		valid = CheckoutValidations.shipping_state_district[0].validate() && valid;
	}

	if (valid) {
//		if (shipping_type) {
			accordion.activate('payment');
			Fillers.fillShippingPreview();
//			Fillers.fillShippingMethod(shipping_type.next().innerHTML);
			Fillers.fillShippingMethod("Pony Express: &euro; 15.00");
			reloadCart();
			return true;
//		}
//		else {
//			alert("Selezionare un metodo di spedizione.");
//			return false;
//		}
	}
	else {
		return false;
	}

//	}
//	catch(err) {
//		exceptionNotify(err);
//		return false;
//	}
}

Step.review = function() {
	//	try {
	if (accordion.currentStep == "payment") {
		var payment_type = Form.getInputs('order_form',
			'radio',
			'order[payment_type_id]').find(function(radio) {
			return radio.checked;
		});
		if (payment_type) {
			Fillers.fillPaymentMethod(payment_type.next().innerHTML);
			return true;
		}
		else {
			alert("Selezionare un metodo di pagamento.");
			return false;
		}
	}
	return false;
//	}
//	catch(err) {
//		exceptionNotify(err);
//		return false;
//	}
}

Step.onlyBack = function(element) {
	//	try {
	var key = element.readAttribute('name');
	if (accordion.steps.get(key).count < accordion.steps.get(accordion.currentStep).count) {

		//		start = this.currentAccordion.previous(0).readAttribute('name')
		//		end = button.readAttribute('name')
		//		for (i=steps[start];i >= steps[end];i = i-1) {
		//			headers[i].removeClassName(this.options.classNames.visited);
		//		}
		//		this.currentAccordion = $(button).next();


		accordion.activate(key);
		return true;
	}
	else {
		return false;
	}
//	}
//	catch(err) {
//		exceptionNotify(err);
//		return false;
//	}
}
