function proc(x){return parseFloat(x.substring(1,x.length))}function c(cardValue,localRate,connFee,mainFee){return((cardValue*100)-connFee-mainFee)/localRate}function makeTime(availableMinutes){return Math.round(availableMinutes/60)+" hr "+Math.round(availableMinutes%60)+" min"}$(document).ready(function(){$(".form-repeated select").each(function(i){this.selectedIndex=(this.options.length>1)?this.options.length-2:0;var value;var x=proc(this.options[this.selectedIndex].text);var t=$(this).parent().parent();var y=parseFloat(t.children(".localRate").children(".real-value").text());var z=parseInt(t.children(".connectionFee").children(".real-value").text());var z1=parseInt(t.children(".maintenanceFee").children(".real-value").text());value=(y!=0)?makeTime(c(x,y,z,z1)):"";$(this).parent().children("span").html(value);$(this).bind("change",function(){var x=proc(this.options[this.selectedIndex].text);var t=$(this).parent().parent();var y=parseFloat(t.children(".localRate").children(".real-value").text());var z=parseInt(t.children(".connectionFee").children(".real-value").text());var z1=parseInt(t.children(".maintenanceFee").children(".real-value").text());value=(y!=0)?makeTime(c(x,y,z,z1)):"";$(this).parent().children("span").html(value)})});$.get("/calling-cards/from.htm",function(data){$(data).appendTo("#countryFrom")});$.get("/calling-cards/to.htm",function(data){$(data).appendTo("#countryTo")})});
