function aw_select(group,attribute, currency)
{
	document.getElementById('group_'+group).value = attribute;
	findCombination();
	var name = document.aw_wizard;
	var default_impact = parseFloat($("#pi_default_"+group).val());
	var current_impact = parseFloat($("#pi_"+group+"_"+attribute).val());
	$("#pi_default_"+group).val(current_impact);
	var selected = document.getElementById("aw_group_"+group)?document.getElementById("aw_group_"+group).selectedIndex:0;
	for(i=0; i<name.elements.length; i++)
		if (name.elements[i].type == "hidden")
		{
			var split = name.elements[i].name.split("_");
			if (split[1] == group)
			{
				var html = "";
				var itr_impact = name.elements[i].value;
				if (current_impact < itr_impact)
					html = " ["+aw_add+" "+ currencySign + (Math.round(Math.abs(current_impact - itr_impact)) == Math.abs(current_impact - itr_impact)?Math.abs(current_impact - itr_impact)+".00":Math.abs(current_impact - itr_impact))+"]";
				else if (current_impact > itr_impact)
					html = " ["+aw_sub+" "+ currencySign + (Math.round(Math.abs(itr_impact - current_impact)) == Math.abs(itr_impact - current_impact)?Math.abs(itr_impact - current_impact)+".00":Math.abs(itr_impact - current_impact))+"]";
				if (document.getElementById("price_change_"+split[2]))
					$("#price_change_"+split[2]).html(html);
				else
				{
					var current = document.getElementById("aw_group_"+split[1]).options[split[3]].text;
					if (current.indexOf("[") > 0)
						current = current.substring(0,current.indexOf("["));
					document.getElementById("aw_group_"+split[1]).options[split[3]]=new Option(current+html, split[2])
					//alert (current);
					//alert("Select box " + split[3] + " -- " + html);
				}
			}
		}
	if (document.getElementById("aw_group_"+group))
		document.getElementById("aw_group_"+group).selectedIndex = selected;
	if (document.getElementById('aw_price'))
		$("#aw_price").html($("#our_price_display").html())
}

function aw_add_to_cart()
{
   	$("html").animate({ scrollTop: 0 }, "slow");
	ajaxCart.add( $('#product_page_product_id').val(), $('#idCombination').val(), true, null, $('#quantity_wanted').val(), null);
	return false;
}

$( document ).ready( function () {
	if ((aw_add_to_cart_display == "both" || aw_add_to_cart_display == "bottom") && document.getElementById('aw_price'))
		$("#aw_price").html($("#our_price_display").html())
	if (aw_add_to_cart_display == "both" || aw_add_to_cart_display == "scroll")
	{
		$('#buy_block').css('position','relative');
    	$( '#buy_block' ).scrollFollow( {
     	speed: 1000,
     	offset: 5,
     	container: 'aw_container'
    	});
    }
});
	

$(window).load(function(){
    $('body#product p#add_to_cart input').click(function(){
	   	$("html").animate({ scrollTop: 0 }, "slow");
    });
});