$(document).ready(function(){
	var wizard = $("#wizard").accordion({
		header: '.title',
		autoHeight: false,
		icons: {
 			header: "ui-icon-circle-arrow-e",
   			headerSelected: "ui-icon-circle-arrow-s"
		}
	});
	
	var wizardButtons = $([])
	$("div.title", wizard).each(function(index) {
		wizardButtons = wizardButtons.add($(this)
		.next()
		.children(":button")
		.filter(".next, .previous")
		.click(function() {
			wizard.accordion("activate", index + ($(this).is(".next") ? 1 : -1))
		}));
	});	
	
	var validatePersonalInfo = $("#orderForm").validate({
		errorLabelContainer: "#orderForm div.error",
		rules: {
			name: {
				required: true,
				minlength: 2
			},
			email: {
				required: true,
				email: true
			}
		},
		messages: {
			firstname: ERROR_Firstname + "<br />",
			email: ERROR_Email + "<br />"
		}
	});
});


