function ChangeShipping(obj) { old_total = jQuery(".total_val").html(); currencysymbol = old_total.substr(0,1); old_total = (old_total.substring(1) * 1); sub_total = old_total - (jQuery(".shipping_val").html().substring(1) * 1); // new_total = sub_total + shipping[obj.value]; new_total = sub_total + shipping[jQuery(obj).attr("value")]; if (jQuery("#shipping_0_postal").val().substr(0,1) == "1") { taxrate = tax / (old_total - tax); change = new_total - old_total; tax_change = taxrate * change; new_total = new_total + tax_change; tax = tax + tax_change; jQuery(".tax_val").html(currencysymbol + (tax_change+(jQuery(".tax_val").html().substring(1) * 1)).toFixed(2)); } var SubTotal=(jQuery("#OrderSubtotal").html().substring(1) * 1); var OrderTax=(jQuery("#OrderTax").html().substring(1) * 1); var OrderShipping=shipping[jQuery(obj).attr("value")]; var OrderDiscount=(jQuery("#OrderDiscount").html().substring(1) * 1); var totalwithtax=((SubTotal+OrderShipping+OrderTax)+OrderDiscount);//parseFloat(new_total)+parseFloat(tax); //jQuery(".total_val").html(currencysymbol + new_total.toFixed(2)); jQuery(".total_val").html(currencysymbol + totalwithtax.toFixed(2)); // jQuery(".shipping_val").html(currencysymbol + shipping[obj.value].toFixed(2)); jQuery(".shipping_val").html(currencysymbol + shipping[jQuery(obj).attr("value")].toFixed(2)); //alert("id: "+jQuery(obj).attr('value')+"Value: "+jQuery(".shipping_val").html()) jQuery('#shipMethod').val(jQuery(obj).attr("value")); } function SetDefault(obj) { old_total = jQuery(".total_val").html(); currencysymbol = old_total.substr(0,1); old_total = (old_total.substring(1) * 1); sub_total = old_total - (jQuery(".shipping_val").html().substring(1) * 1); // new_total = sub_total + shipping[obj.value]; new_total = sub_total + shipping[jQuery(obj).attr("value")]; if (jQuery("#shipping_0_postal").val().substr(0,1) == "1") { //change =new_total - old_total; tax_change = tax;// * change; //new_total = new_total + tax_change; jQuery(".tax_val").html(currencysymbol + tax_change); } var SubTotal=(jQuery("#OrderSubtotal").html().substring(1) * 1); var OrderTax=(jQuery("#OrderTax").html().substring(1) * 1); var OrderShipping=shipping[jQuery(obj).attr("value")]; var OrderDiscount=(jQuery("#OrderDiscount").html().substring(1) * 1); var totalwithtax=((SubTotal+OrderShipping+OrderTax)+OrderDiscount);//parseFloat(new_total)+parseFloat(tax); //jQuery(".total_val").html(currencysymbol + new_total.toFixed(2)); jQuery(".total_val").html(currencysymbol + totalwithtax.toFixed(2)); // jQuery(".shipping_val").html(currencysymbol + shipping[obj.value].toFixed(2)); jQuery(".shipping_val").html(currencysymbol + shipping[jQuery(obj).attr("value")].toFixed(2)); //alert("id: "+jQuery(obj).attr('value')+"Value: "+jQuery(".shipping_val").html()) jQuery('#shipMethod').val(jQuery(obj).attr("value")); }