/*
	UniteU Checkout Progress Indicator
	MSR 2/11/08
*/

function DrawCheckoutProgressIndicator(CurrentStep){
	
	// Start feature comment
	var UU_Output = '<!-- FEATURE BEGIN CheckoutProgressIndicator -->';
	
	// Configure image path
	var ImagePath = 'assets/images/CheckoutSteps/';
	
	// Setup steps array
	var Steps = new Array();
	
	// Configure steps
	// Format: CheckoutStep(RegularImage,OnImage,LinkURL)
	Steps[0] =  new CheckoutStep('checkout_step0.gif', 'checkout_step0_on.gif', 'basket.asp');
	if (user_firstname != "") {
		Steps[1] =  new CheckoutStep('checkout_step1.gif', 'checkout_step1_on.gif', 'shopper_update.asp');
	} else {
		Steps[1] =  new CheckoutStep('checkout_step1.gif', 'checkout_step1_on.gif', 'shopper_lookup.asp');
	}
	Steps[2] =  new CheckoutStep('checkout_step2.gif', 'checkout_step2_on.gif', 'shipping.asp');
	Steps[3] =  new CheckoutStep('checkout_step3.gif', 'checkout_step3_on.gif', 'payment.asp');
	
	// Start the div
	UU_Output += '<div class="CheckoutProgressIndicator">';
	
	// For each image...
	for(i=0; i < Steps.length; i++){
		
		// If we're on the specified step...
		//if(i+1 == CurrentStep){
		if(i == CurrentStep){
			// Show the on image
			UU_ImagePath = ImagePath + Steps[i].OnImage;
		} else {
			// Show the regular image
			UU_ImagePath = ImagePath + Steps[i].RegularImage;
		}
		
		// Build the <a> (if link is defined) and <img> tags
		if(Steps[i].LinkURL){
			UU_Output += '<a href="' + Steps[i].LinkURL + '" onClick="return(visitargs(\'' + Steps[i].LinkURL + '\', \'\', \'URL\'));">';
		}
		UU_Output += '<img src="' + UU_ImagePath + '">';
		if(Steps[i].LinkURL){
			UU_Output += '</a>';
		}
	}

	// End the div
	UU_Output += '</div>';

	// Start feature comment
	UU_Output += '<!-- FEATURE END CheckoutProgressIndicator -->';

	// Show output
	document.write(UU_Output);
}

function CheckoutStep(RegularImage,OnImage,LinkURL){
	// Constructor
	this.RegularImage = RegularImage;
	this.OnImage = OnImage;
	this.LinkURL = LinkURL;
}