﻿function calcPoints(multiplier){
    var points = document.cart.points.value;
    var price = ToDollarsAndCents(points/multiplier);
    var amDiscount = document.cart.AnnualMembershipDiscount.value;
    
    if(document.cart.subscription[1].checked){//annual
        price = ToDollarsAndCents(price * amDiscount * 12);
        document.getElementById("priceMonthly").innerHTML = "($" + ToDollarsAndCents(price / 12) + "/mo.)";
    }
    else{
        document.getElementById("priceMonthly").innerHTML = "";
    }
    document.getElementById("priceText").innerHTML = "$" + price;
    document.cart.price.value = price;
}

function ToDollarsAndCents(n) 
{ 
   var s = "" + Math.round(n * 100) / 100 
   var i = s.indexOf('.') 
   if (i < 0) return s + ".00" 
   var t = s.substring(0, i + 1) + s.substring(i + 1, i + 3) 
   if (i + 2 == s.length) t += "0" 
   return t 
}

function copyToClipboard(frmEle) {
	cp = frmEle.createTextRange();
	frmEle.focus();
	frmEle.select();
	cp.execCommand("Copy");
}

function confirmLinkedIn(position) {
	if (document.networksForm.active[position].checked == 1) {
		var answer = confirm("By adding yourself to the Invite Me List for LinkedIn, you agree to NEVER mark a LinkedIn connection invitation as \"I Don't Know\" or \"Flag as Spam\" (if you do not wish to accept an invitation, please just simply click the \"Archive\" button instead).");
		if (answer) {//ok
		}
		else {//cancel
			document.networksForm.active[position].checked = false;
		}
	}
}