
$(document).ready(function(){$('.buymore').click(function(e){var dwidth=$(document).width();var windowoffset=$(document).scrollTop();var windowheight=$(window).height();dwidth=(dwidth/2)-380;dtop=(windowoffset+40)
$("#buymore").css({'left':dwidth,'top':dtop});$("#buymore").show();return false;});$('.btn-nothanks').click(function(e){$('.overlay-bg-gray').hide();$(".upsell-container").hide();});var quantitySlct=$('select[name=numEmailboxes]')
var method="method-productTermPrice";quantitySlct.bind("change",function(e){e.preventDefault();var quantity=Number(quantitySlct.val());if(quantity>0&&quantity<100){var data=[{productCode:"E",term:"1",attrCode:"",attrValue:"",quantity:quantity}];var pObj={};pObj.productCodeObj=data;var dataObj={data:JSONstring.make(pObj)};$.getJSON('/jsonProductSlider.do?'+method,dataObj,function(data){updateTermPrice(data);});}});var updateTermPrice=function(data){if(data.productCodeObj){var d=data.productCodeObj;$(".fadeable").fadeOut("slow",function(){for(var i=0;i<d.length;i+=1){var productPrice=calculateProductPrice(d[i]);var productCode=d[i].productCode;var currencyCode=d[i].currencyCode;var totalSavings=d[i].savings?Number(d[i].savings).toFixed(2):0.00;if(productPrice.monthlyPrice=='NA'&&productPrice.annualPrice=='NA'){$("#"+productCode+"-monthly-price").html(currencyCode+productPrice.monthlyPrice);$("#"+productCode+"-annual-price").html(currencyCode+productPrice.annualPrice);$("#"+productCode+"-total-price").html(currencyCode+productPrice.totalPrice);$("#"+productCode+"-total-savings").html(currencyCode+totalSavings);}
else{$("#"+productCode+"-monthly-price").html(currencyCode+Number((productPrice.monthlyPrice)).toFixed(2));$("#"+productCode+"-annual-price").html(currencyCode+Number((productPrice.annualPrice)).toFixed(2));$("#"+productCode+"-total-price").html(currencyCode+Number((productPrice.totalPrice)).toFixed(2));$("#"+productCode+"-total-savings").html(currencyCode+totalSavings);}}
$(".fadeable").fadeIn("slow");});}};var calculateProductPrice=function(productObj){var monthlyPrice;var annualPrice;var totalPrice;var productTerm;if(productObj.term==111){productTerm=1;if(productObj.yearPrice!='NA'){totalPrice=(productObj.yearPrice);monthlyPrice=(productObj.yearPrice);annualPrice=(productObj.yearPrice)*12;}
else{monthlyPrice=annualPrice=productObj.yearPrice;}}else if(productObj.term==333){productTerm=1;if(productObj.yearPrice!='NA'){totalPrice=(productObj.yearPrice);monthlyPrice=(productObj.yearPrice);annualPrice=(productObj.yearPrice)*4;}
else{monthlyPrice=annualPrice=totalPrice=productObj.yearPrice;}}else{productTerm=productObj.term;if(productObj.yearPrice!='NA'){totalPrice=(productObj.yearPrice);monthlyPrice=(productObj.yearPrice/productTerm)/12;annualPrice=(productObj.yearPrice/productTerm);}
else{monthlyPrice=annualPrice=totalPrice=productObj.yearPrice;}}
return{monthlyPrice:monthlyPrice,annualPrice:annualPrice,totalPrice:totalPrice};};});