function getStep()
{
	var step = 0;
	jQuery('#stepheaderrow3').children().each(function(i){
		var attclass = jQuery(this).attr('class');
		if(attclass.replace(/\s/g,"") != "") { step = i; }
	});	
	
	return(step);
}

function adjustCartPage()
{
	jQuery('#viewtype_bas').parent().addClass('simpleview-container');
	jQuery('#viewtype_det').parent().addClass('detailview-container');
	jQuery('input.cart3').parent().addClass('updatecart-container');
	jQuery('input.cart4').parent().addClass('checkout-container');
	jQuery('.cart_recip').parent().parent().addClass('recipient-container');
}

function globalModifications()
{
	jQuery('#cv_bas').attr('cellspacing','0');
}

function adjustStep3()
{
	jQuery('#c3_billaddr tbody tr:first-child th').addClass('checkout-colhead');
	jQuery('#order_dtl .subhead th').addClass('checkout-colhead');
	jQuery('#registerupselllink').parent().addClass('registerupselllink-container');
}

function initCheckoutAddClasses()
{
	var step = getStep();
	if(step > 0) 
	{ 
		jQuery('#maincontent').addClass('checkoutpage'); 
		jQuery('#cartform > table:first-child').attr('id','topcontrols');
	}
	
	globalModifications();
	
	
	switch(step)
	{
		case 0:
			adjustCartPage();
			break;
		case 1:
			break;
		case 2:
			break;
		case 3:
			adjustStep3();
		default:
			
	}
}

jQuery(function(){
	initCheckoutAddClasses();	
});
