<!--
function jsCheckPayMethod()
{

	if ( document.ins.paymethod.options[document.ins.paymethod.selectedIndex].text == "PayPal (Credit Cards, eCheck)" || document.ins.paymethod.options[document.ins.paymethod.selectedIndex].text == "PayPal Subcription (Credit Cards, eCheck)" ) {
		document.ins.currency_code.disabled=false;
	} else {
		document.ins.currency_code.selectedIndex = 0;
		document.ins.currency_code.disabled=true;
	}	

}

function jsSetFields()
{

	var one = eval(document.ins.item_number.options[document.ins.item_number.selectedIndex].value);
	var two = eval(document.ins.type.options[document.ins.type.selectedIndex].value);

	if(eval(document.ins.currency_code.selectedIndex) == 0)
		var three = 1.00;
	if(eval(document.ins.currency_code.selectedIndex) == 1)
		var three = 0.63;
	if(eval(document.ins.currency_code.selectedIndex) == 2)
		var three = 0.91;

	var temp =  (one * two * three) - .05;
	document.ins.amount.value = formatCurrency(temp);
	document.ins.a3.value = formatCurrency(temp);


	if ( document.ins.type.options[document.ins.type.selectedIndex].text == "Bulk Untargeted Visitors" || document.ins.type.options[document.ins.type.selectedIndex].text == "Premium US Targeted Visitors" ) {
		document.ins.item_name.value = document.ins.item_number.options[document.ins.item_number.selectedIndex].text + " " + document.ins.type.options[document.ins.type.selectedIndex].text + ": " + document.ins.bcet_category[document.ins.bcet_category.selectedIndex].text;
                document.ins.bcet_category.disabled=false;
                }
	else {
		document.ins.item_name.value = document.ins.item_number.options[document.ins.item_number.selectedIndex].text + " " + document.ins.type.options[document.ins.type.selectedIndex].text;		
                document.ins.bcet_category.disabled=true;
             }
}

function AddIt()
{
	jsCheckPayMethod();
	jsSetFields();
}

function jsPayMethod()
{
	if ( document.ins.paymethod.value == "paypal" ) {
		document.ins.cmd.value = "_xclick";
		document.ins.action = "https://www.paypal.com/cgi-bin/webscr";
	} 
	else if ( document.ins.paymethod.value == "paypalsub" ) {
		document.ins.cmd.value = "_xclick-subscriptions";
		document.ins.action = "https://www.paypal.com/cgi-bin/webscr";
	} 
	
}

function formatCurrency(num) 
{
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
		cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));

	cursymbol = document.ins.currency_code.options[document.ins.currency_code.selectedIndex].text;

	return (((sign)?'':'-') + cursymbol + num + '.' + cents);
}


//-->
