function setupCheckout(el) {
	init();
	return;
}

function switchLocInfoBox(el) {
	$(".locationInfoBox").hide();
	$("#location-info-box-" + $(el).val()).show();
}

function init(){
	
	var $holder = $("#checkout-form-holder");
	
	// select all desired input fields and attach tooltips to them 
	$(":input", $holder).tooltip({ 
	
	    // place tooltip on the right edge 
	    position: ['bottom','center'], 
	 
	    // a little tweaking of the position 
	    //offset: [45, 255], 
	 
	    // use a simple show/hide effect 
	    effect: 'toggle', 
	     
	    // custom opacity setting 
	    opacity: 0.8,
		
		tip: ".tooltip"
	});
	
	$(".tooltip", $holder).hide();
	
	$(".infoBoxPopup", $holder).each(function() {
		
		$(this).attr("title", "");
		
		$(this).after($(this).find("span").clone().addClass("tooltipPopup"));
		
		$(this).tooltip({
		    position: ['top', 'center'], 
		 
		    // a little tweaking of the position 
		    offset: [5, 0], 
		 
		    // use a simple show/hide effect 
		    effect: 'slideup', 
		     
		    // custom opacity setting 
		    opacity: 0.8,
			
			tip: "span"
		});
	});
	
	$(".viewCart a", $holder).fancyZoom({directory: "images/design/fancyzoom"});
	
	$("#checkout-my-order").show();
}

/** steps code **/
function checkAddressChange(el) {
	var val = $(el).val();
	
	if (val == 'n/a') {
		$("#checkout-additional-directions").hide();
		$("#checkout-address-not-listed").show();
		$(el).addClass('addressSelectorSmall');
	} else {
		$(el).removeClass('addressSelectorSmall');
		$("#checkout-additional-directions").show();
		$("#checkout-address-not-listed").hide();
	}
}

function doAjaxOfferStatusUpdate(e, stepNo, refresh_id, ns) {
	e.form.submit();
	return false;
}
