function calculateTotal()
{
	var main_price_input = jQuery(':input[rel=checkout_main]');
	var extra_price_inputs = jQuery(':input[rel=checkout_extra]:checked');
	var total_container = jQuery('#totalcont');
	var show_roomate = false;
	if(total_container.length > 0 && (main_price_input.length > 0 || extra_price_inputs.length > 0))
	{
		var price = (main_price_input.length > 0) ? parseFloat(mainpricing[main_price_input.val()]['value']) : 0;
		if(mainpricing[main_price_input.val()]['roomate'])
			show_roomate = true;
		
		if(extra_price_inputs.length > 0)
		{
			extra_price_inputs.each(
				function()
				{
					price += parseFloat(extrapricing[jQuery(this).val()]['value']);
					if(extrapricing[jQuery(this).val()]['roomate'])
						show_roomate = true;
				}
			);
		}
		jQuery('#totalcont').text('$'+price);
		show_roomate ? jQuery('.roomate_row').show() : jQuery('.roomate_row').hide();
	}
}
function roomatepref()
{
	var sel = jQuery('.roomate_row :input[type=radio]:checked').val();
	jQuery('.roomatenopref_row, .roomatename_row').hide();
	if(sel == 'yes')
		jQuery('.roomatename_row').show();
	else if(sel == 'no')
		jQuery('.roomatenopref_row').show();
}
function showPaymentBlock(obj)
{
	jQuery('[rel=paymentmethod]').hide();
	jQuery("#"+obj.value+"_block").show();
}
jQuery(document).ready(
	function()
	{
		calculateTotal();
		roomatepref();
	}
);