<!-- Original:  Simon Tneoh (tneohcb@pc.jaring.my) -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var Cards = new makeArray(8);
Cards[0] = new CardType("MasterCard", "51,52,53,54,55", "16");
var MasterCard = Cards[0];
Cards[1] = new CardType("Visa", "4", "13,16");
var Visa = Cards[1];
Cards[2] = new CardType("AmericanExpress", "34,37", "15");
var AmericanExpress = Cards[2];
Cards[3] = new CardType("DinersClubCard", "30,36,38", "14");
var DinersClubCard = Cards[3];
Cards[4] = new CardType("Discover", "6011", "16");
var Discover = Cards[4];
Cards[5] = new CardType("enRouteCard", "2014,2149", "15");
var enRouteCard = Cards[5];
Cards[6] = new CardType("JCBCard", "3088,3096,3112,3158,3337,3528", "16");
var JCBCard = Cards[6];
var LuhnCheckSum = Cards[7] = new CardType();

/*************************************************************************\
CheckCardNumber(form)
\*************************************************************************/
function CheckCardNumber(form) {
var tmpyear;
var tmpmonth;

if (checkForInput()) {

tmpmonth = form.jbExpirationMonth.value;

if (form.jcExpirationYear.value > 96)
tmpyear = "19" + form.jcExpirationYear.value;
else if (form.jcExpirationYear.value < 21)
tmpyear = "20" + form.jcExpirationYear.value;
else {
alert("The Expiration Year is not valid.");
return false;
}

if (!(new CardType()).isExpiryDate(tmpyear, tmpmonth)) {
alert("This card has already expired.");
return false;
}

card = form.iaCreditCardType.options[form.iaCreditCardType.selectedIndex].value;
var retval = eval(card + ".checkCardNumber(\"" + form.jaCreditCardNumber.value +
"\", " + tmpyear + ", " + tmpmonth + ");");

if (retval){
//// comment this out if used on an order form
//// alert("This card number appears to be valid.");
}
else {
alert("This card number is not valid.");
form.jaCreditCardNumber.focus();
return false;
}

return true;
 }
 else
 return false;
}

/*************************************************************************\
Object CardType([String cardtype, String rules, String len, int year,
                                        int month])
cardtype    : type of card, eg: MasterCard, Visa, etc.
rules       : rules of the cardnumber, eg: "4", "6011", "34,37".
len         : valid length of cardnumber, eg: "16,19", "13,16".
year        : year of expiry date.
month       : month of expiry date.
eg:
var Visa = new CardType("Visa", "4", "16");
var AmericanExpress = new CardType("AmEx", "34,37", "15");
\*************************************************************************/
function CardType() {
var n;
var argv = CardType.arguments;
var argc = CardType.arguments.length;

this.objname = "object CardType";

var tmpcardtype = (argc > 0) ? argv[0] : "CardObject";
var tmprules = (argc > 1) ? argv[1] : "0,1,2,3,4,5,6,7,8,9";
var tmplen = (argc > 2) ? argv[2] : "13,14,15,16,19";

this.setCardNumber = setCardNumber;  // set CardNumber method.
this.setCardType = setCardType;  // setCardType method.
this.setLen = setLen;  // setLen method.
this.setRules = setRules;  // setRules method.
this.setExpiryDate = setExpiryDate;  // setExpiryDate method.

this.setCardType(tmpcardtype);
this.setLen(tmplen);
this.setRules(tmprules);
if (argc > 4)
this.setExpiryDate(argv[3], argv[4]);

this.checkCardNumber = checkCardNumber;  // checkCardNumber method.
this.getExpiryDate = getExpiryDate;  // getExpiryDate method.
this.getCardType = getCardType;  // getCardType method.
this.isCardNumber = isCardNumber;  // isCardNumber method.
this.isExpiryDate = isExpiryDate;  // isExpiryDate method.
this.luhnCheck = luhnCheck;// luhnCheck method.
return this;
}

/*************************************************************************\
boolean checkCardNumber([String cardnumber, int year, int month])
return true if cardnumber pass the luhncheck and the expiry date is
valid, else return false.
\*************************************************************************/
function checkCardNumber() {
var argv = checkCardNumber.arguments;
var argc = checkCardNumber.arguments.length;
var cardnumber = (argc > 0) ? argv[0] : this.cardnumber;
var year = (argc > 1) ? argv[1] : this.year;
var month = (argc > 2) ? argv[2] : this.month;

this.setCardNumber(cardnumber);
this.setExpiryDate(year, month);

if (!this.isCardNumber())
return false;
if (!this.isExpiryDate())
return false;

return true;
}
/*************************************************************************\
String getCardType()
return the cardtype.
\*************************************************************************/
function getCardType() {
return this.cardtype;
}
/*************************************************************************\
String getExpiryDate()
return the expiry date.
\*************************************************************************/
function getExpiryDate() {
return this.month + "/" + this.year;
}
/*************************************************************************\
boolean isCardNumber([String cardnumber])
return true if cardnumber pass the luhncheck and the rules, else return
false.
\*************************************************************************/
function isCardNumber() {
var argv = isCardNumber.arguments;
var argc = isCardNumber.arguments.length;
var cardnumber = (argc > 0) ? argv[0] : this.cardnumber;
if (!this.luhnCheck())
return false;

for (var n = 0; n < this.len.size; n++)
if (cardnumber.toString().length == this.len[n]) {
for (var m = 0; m < this.rules.size; m++) {
var headdigit = cardnumber.substring(0, this.rules[m].toString().length);
if (headdigit == this.rules[m])
return true;
}
return false;
}
return false;
}

/*************************************************************************\
boolean isExpiryDate([int year, int month])
return true if the date is a valid expiry date,
else return false.
\*************************************************************************/
function isExpiryDate() {
var argv = isExpiryDate.arguments;
var argc = isExpiryDate.arguments.length;

year = argc > 0 ? argv[0] : this.year;
month = argc > 1 ? argv[1] : this.month;

if (!isNum(year+""))
return false;
if (!isNum(month+""))
return false;
today = new Date();
expiry = new Date(year, month);
if (today.getTime() > expiry.getTime())
return false;
else
return true;
}

/*************************************************************************\
boolean isNum(String argvalue)
return true if argvalue contains only numeric characters,
else return false.
\*************************************************************************/
function isNum(argvalue) {
argvalue = argvalue.toString();

if (argvalue.length == 0)
return false;

for (var n = 0; n < argvalue.length; n++)
if (argvalue.substring(n, n+1) < "0" || argvalue.substring(n, n+1) > "9")
return false;

return true;
}

/*************************************************************************\
boolean luhnCheck([String CardNumber])
return true if CardNumber pass the luhn check else return false.
Reference: http://www.ling.nwu.edu/~sburke/pub/luhn_lib.pl
\*************************************************************************/
function luhnCheck() {
var argv = luhnCheck.arguments;
var argc = luhnCheck.arguments.length;

var CardNumber = argc > 0 ? argv[0] : this.cardnumber;

if (! isNum(CardNumber)) {
return false;
  }

var no_digit = CardNumber.length;
var oddoeven = no_digit & 1;
var sum = 0;


for (var count = 0; count < no_digit; count++) {
var digit = parseInt(CardNumber.charAt(count));
if (!((count & 1) ^ oddoeven)) {
digit *= 2;
if (digit > 9)
digit -= 9;
}
sum += digit;
}
if (sum % 10 == 0)
return true;
else
return false;
}

/*************************************************************************\
ArrayObject makeArray(int size)
return the array object in the size specified.
\*************************************************************************/
function makeArray(size) {
this.size = size;
return this;
}

/*************************************************************************\
CardType setCardNumber(cardnumber)
return the CardType object.
\*************************************************************************/
function setCardNumber(cardnumber) {
this.cardnumber = cardnumber;
return this;
}

/*************************************************************************\
CardType setCardType(cardtype)
return the CardType object.
\*************************************************************************/
function setCardType(cardtype) {
this.cardtype = cardtype;
return this;
}

/*************************************************************************\
CardType setExpiryDate(year, month)
return the CardType object.
\*************************************************************************/
function setExpiryDate(year, month) {
this.year = year;
this.month = month;
return this;
}

/*************************************************************************\
CardType setLen(len)
return the CardType object.
\*************************************************************************/
function setLen(len) {
// Create the len array.
if (len.length == 0 || len == null)
len = "13,14,15,16,19";

var tmplen = len;
n = 1;
while (tmplen.indexOf(",") != -1) {
tmplen = tmplen.substring(tmplen.indexOf(",") + 1, tmplen.length);
n++;
}
this.len = new makeArray(n);
n = 0;
while (len.indexOf(",") != -1) {
var tmpstr = len.substring(0, len.indexOf(","));
this.len[n] = tmpstr;
len = len.substring(len.indexOf(",") + 1, len.length);
n++;
}
this.len[n] = len;
return this;
}

/*************************************************************************\
CardType setRules()
return the CardType object.
\*************************************************************************/
function setRules(rules) {
// Create the rules array.
if (rules.length == 0 || rules == null)
rules = "0,1,2,3,4,5,6,7,8,9";

var tmprules = rules;
n = 1;
while (tmprules.indexOf(",") != -1) {
tmprules = tmprules.substring(tmprules.indexOf(",") + 1, tmprules.length);
n++;
}
this.rules = new makeArray(n);
n = 0;
while (rules.indexOf(",") != -1) {
var tmpstr = rules.substring(0, rules.indexOf(","));
this.rules[n] = tmpstr;
rules = rules.substring(rules.indexOf(",") + 1, rules.length);
n++;
}
this.rules[n] = rules;
return this;
}


//********************************function*******************************
function init_values()
{
      document.ThisForm.elements["da75 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da150 Minute Qty"].selectedIndex = 0;
      document.ThisForm.elements["da225 Minute Qty"].selectedIndex = 0;
      document.ThisForm.elements["da500 Minute Qty"].selectedIndex = 0;
      document.ThisForm.elements["da750 Minute Qty"].selectedIndex = 0;
      document.ThisForm.elements["da1,000 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da3,000 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da5,000 Minute Qty"].selectedIndex = 0;
	  document.ThisForm.elements["da50 Minute Load Qty"].selectedIndex = 0;
      document.ThisForm.elements["da30 Day Extension Qty"].selectedIndex =0;
      document.ThisForm.elements["da6 Month Extension Qty"].selectedIndex =0;
      document.ThisForm.elements["da12 Month Extension Qty"].selectedIndex =0;
      document.ThisForm.elements["da200 Minute Alaska and Canada Qty"].selectedIndex = 0;
      document.ThisForm.elements["da300 Minute African Qty"].selectedIndex = 0;
      document.ThisForm.elements["da75 Minute Qty"].value =0;
      document.ThisForm.elements["da150 Minute Qty"].value = 0;
      document.ThisForm.elements["da225 Minute Qty"].value = 0;
      document.ThisForm.elements["da500 Minute Qty"].value = 0;
      document.ThisForm.elements["da750 Minute Qty"].value = 0;
      document.ThisForm.elements["da1,000 Minute Qty"].value =0;
      document.ThisForm.elements["da3,000 Minute Qty"].value =0;
      document.ThisForm.elements["da5,000 Minute Qty"].value = 0;
	  document.ThisForm.elements["da50 Minute Load Qty"].value = 0;
      document.ThisForm.elements["da30 Day Extension Qty"].value =0;
      document.ThisForm.elements["da6 Month Extension Qty"].value =0;
      document.ThisForm.elements["da12 Month Extension Qty"].value =0;
      document.ThisForm.elements["da200 Minute Alaska and Canada Qty"].value = 0;
      document.ThisForm.elements["da300 Minute African Qty"].value = 0;
  	  document.ThisForm.elements["da75 Minute Extended Cost"].value = roundOff(0.00,2);
  	  document.ThisForm.elements["da150 Minute Extended Cost"].value = roundOff(0.00,2);
  	  document.ThisForm.elements["da225 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da500 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da750 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da1,000 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da3,000 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da5,000 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da50 Minute Load Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da30 Day Extension Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da6 Month Extension Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da12 Month Extension Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da200 Minute Alaska and Canada Extended Cost"].value = roundOff(0.00,2);
      document.ThisForm.elements["da300 Minute African Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["dbMinutes Subtotal"].value = roundOff(0.00,2);
	  clearShippingAddress();
	  
	  
	return true;
}
//********************************function*******************************
function check_Canadian()
{
// 9-06-06 - plan now Alaska/Canada
// Canadian plan cannot have any of other minutes options included
	if ((document.ThisForm.elements["da200 Minute Alaska and Canada Qty"].selectedIndex > 0) &&
      ((document.ThisForm.elements["da75 Minute Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da150 Minute Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da225 Minute Qty"].selectedIndex > 0) ||	  
      (document.ThisForm.elements["da500 Minute Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da750 Minute Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da3,000 Minute Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da1,000 Minute Qty"].selectedIndex > 0) ||	  
      (document.ThisForm.elements["da5,000 Minute Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da50 Minute Load Qty"].selectedIndex > 0) ||	  
      (document.ThisForm.elements["da30 Day Extension Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da6 Month Extension Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da12 Month Extension Qty"].selectedIndex > 0) ||	  	  
      (document.ThisForm.elements["da300 Minute African Qty"].selectedIndex > 0)))  {
      alert("Alaska/Canadian minutes plan cannot have any other plans included on the same SIM card.");
      document.ThisForm.elements["da75 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da150 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da225 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da500 Minute Qty"].selectedIndex = 0;
      document.ThisForm.elements["da750 Minute Qty"].selectedIndex = 0;
      document.ThisForm.elements["da1,000 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da3,000 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da5,000 Minute Qty"].selectedIndex = 0;
      document.ThisForm.elements["da50 Minute Load Qty"].selectedIndex = 0;
      document.ThisForm.elements["da30 Day Extension Qty"].selectedIndex =0;
      document.ThisForm.elements["da6 Month Extension Qty"].selectedIndex =0;
      document.ThisForm.elements["da12 Month Extension Qty"].selectedIndex =0;
      document.ThisForm.elements["da300 Minute African Qty"].selectedIndex = 0;
  	  document.ThisForm.elements["da75 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da150 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da225 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da500 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da750 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da1,000 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da3,000 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da5,000 Minute Extended Cost"].value = roundOff(0.00,2);
      document.ThisForm.elements["da50 Minute Load Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da30 Day Extension Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da6 Month Extension Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da12 Month Extension Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da300 Minute African Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["dbMinutes Subtotal"].value = roundOff(0.00,2);

      document.ThisForm.elements["da200 Minute Alaska and Canada Qty"].focus();
      return false;
	}
	return true;
}
//********************************function*******************************
function check_African()
{
	// African plan cannot have any of other minutes options included
	if ((document.ThisForm.elements["da300 Minute African Qty"].selectedIndex > 0) &&
      ((document.ThisForm.elements["da75 Minute Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da150 Minute Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da225 Minute Qty"].selectedIndex > 0) ||	  
      (document.ThisForm.elements["da500 Minute Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da750 Minute Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da3,000 Minute Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da1,000 Minute Qty"].selectedIndex > 0) ||	  
      (document.ThisForm.elements["da5,000 Minute Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da50 Minute Load Qty"].selectedIndex > 0) ||	  
      (document.ThisForm.elements["da30 Day Extension Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da6 Month Extension Qty"].selectedIndex > 0) ||
      (document.ThisForm.elements["da12 Month Extension Qty"].selectedIndex > 0) ||	  	  
      (document.ThisForm.elements["da200 Minute Alaska and Canada Qty"].selectedIndex > 0)))  {
      alert("African minutes plan cannot have any other plans included on the same SIM card.");
      document.ThisForm.elements["da75 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da150 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da225 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da500 Minute Qty"].selectedIndex = 0;
      document.ThisForm.elements["da750 Minute Qty"].selectedIndex = 0;
      document.ThisForm.elements["da1,000 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da3,000 Minute Qty"].selectedIndex =0;
      document.ThisForm.elements["da5,000 Minute Qty"].selectedIndex = 0;
      document.ThisForm.elements["da50 Minute Load Qty"].selectedIndex = 0;
      document.ThisForm.elements["da30 Day Extension Qty"].selectedIndex =0;
      document.ThisForm.elements["da6 Month Extension Qty"].selectedIndex =0;
      document.ThisForm.elements["da12 Month Extension Qty"].selectedIndex =0;
      document.ThisForm.elements["da200 Minute Alaska and Canada Qty"].selectedIndex = 0;
  	  document.ThisForm.elements["da75 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da150 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da225 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da500 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da750 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da1,000 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da3,000 Minute Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da5,000 Minute Extended Cost"].value = roundOff(0.00,2);
      document.ThisForm.elements["da50 Minute Load Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da30 Day Extension Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da6 Month Extension Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da12 Month Extension Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["da200 Minute Alaska and Canada Extended Cost"].value = roundOff(0.00,2);
	  document.ThisForm.elements["dbMinutes Subtotal"].value = roundOff(0.00,2);
      document.ThisForm.elements["da300 Minute African Qty"].focus();
      return false;
}
	return true;
}

//********************************function*******************************

function calcExtendedCost(whichItem)
{
	for (var fieldNbr = 0; fieldNbr < 17; fieldNbr++)
	{
		switch (whichItem)
		{
		case 0:
			if (whichItem == fieldNbr)
			{
			  // Standard Monthly (Postpaid) Activation
			  if (document.ThisForm.elements["daIridium Std Monthly (Postpaid) Activation Fee Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["daIridium Std Monthly (Postpaid) Activation Fee Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["daIridium Std Monthly (Postpaid) Activation Fee Qty"].selectedIndex;
				  var extcost = qty * 50.00;
				  document.ThisForm.elements["daIridium Std Monthly (Postpaid) Activation Fee Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 0

			case 1:
			if (whichItem == fieldNbr)
			{
			  // 75 min. plan
			  if (document.ThisForm.elements["da75 Minute Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da75 Minute Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["da75 Minute Qty"].selectedIndex;
				  var extcost = qty * 155.80;
				  document.ThisForm.elements["da75 Minute Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 1
			case 2:
			if (whichItem == fieldNbr)
			{
			  // 500 min. plan
			  if (document.ThisForm.elements["da500 Minute Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da500 Minute Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["da500 Minute Qty"].selectedIndex;
				  var extcost = qty * 699.87;
				  document.ThisForm.elements["da500 Minute Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 2
			case 3:
			if (whichItem == fieldNbr)
			{
			  // 3000 min. plan
			  if (document.ThisForm.elements["da3,000 Minute Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da3,000 Minute Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["da3,000 Minute Qty"].selectedIndex;
				  var extcost = qty * 3096.14;
				  document.ThisForm.elements["da3,000 Minute Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 3
			case 4:
			if (whichItem == fieldNbr)
			{
			  // 5000 min. plan
			  if (document.ThisForm.elements["da5,000 Minute Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da5,000 Minute Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["da5,000 Minute Qty"].selectedIndex;
				  var extcost = qty * 4376.60;
				  document.ThisForm.elements["da5,000 Minute Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 4

			case 5:
			if (whichItem == fieldNbr)
			{
			  // 30 day extension plan
			  if (document.ThisForm.elements["da30 Day Extension Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da30 Day Extension Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty =
				  document.ThisForm.elements["da30 Day Extension Qty"].selectedIndex;
				  var extcost = qty * 41.21;
				  document.ThisForm.elements["da30 Day Extension Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 5
			case 6:
			if (whichItem == fieldNbr)
			{
			  //first check if any other plans have been selected and clear values if have
			  check_African();
			  // 300 min. African plan
			  if (document.ThisForm.elements["da300 Minute African Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da300 Minute African Extended Cost"].value = roundOff(0,2);
			  }
			  else
			  {
				  var qty =
				  document.ThisForm.elements["da300 Minute African Qty"].selectedIndex;
				  var extcost = qty * 262.09;
				  document.ThisForm.elements["da300 Minute African Extended Cost"].value = 	roundOff(extcost,2);
			   }
			} // end case 6

			case 7:
			if (whichItem == fieldNbr)
			{
			  //first check if any other plans have been selected and clear values if have
			  check_Canadian();
			  // 200 Alaska min. plan
			  if (document.ThisForm.elements["da200 Minute Alaska and Canada Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da200 Minute Alaska and Canada Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
  			      // 200 min. Alaska/Canadian plan
				  var qty =
				  document.ThisForm.elements["da200 Minute Alaska and Canada Qty"].selectedIndex;
				  var extcost = qty * 248.06;
				  document.ThisForm.elements["da200 Minute Alaska and Canada Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 7
		case 9:
			if (whichItem == fieldNbr)
			{  
			  // 150 min. plan
			  if (document.ThisForm.elements["da150 Minute Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da150 Minute Extended Cost"].value = 	
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["da150 Minute Qty"].selectedIndex;
				  var extcost = qty * 301.60;
				  document.ThisForm.elements["da150 Minute Extended Cost"].value = 	
					roundOff(extcost,2);
			   }
			} // end case 9
			
			case 10:
			if (whichItem == fieldNbr)
			{  
			  // 225 min. plan
			  if (document.ThisForm.elements["da225 Minute Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da225 Minute Extended Cost"].value = 	
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["da225 Minute Qty"].selectedIndex;
				  var extcost = qty * 442.40;
				  document.ThisForm.elements["da225 Minute Extended Cost"].value = 	
					roundOff(extcost,2);
			   }
			} // end case 10
			case 11:
			if (whichItem == fieldNbr)
			{  
			  // 1,000 min. plan
			  if (document.ThisForm.elements["da1,000 Minute Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da1,000 Minute Extended Cost"].value = 	
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["da1,000 Minute Qty"].selectedIndex;
				  var extcost = qty * 1354.99;
				  document.ThisForm.elements["da1,000 Minute Extended Cost"].value = 	
					roundOff(extcost,2);
			   }
			} // end case 11
			case 12:
			if (whichItem == fieldNbr)
			{  
			  // 6 month extension plan
			  if (document.ThisForm.elements["da6 Month Extension Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da6 Month Extension Extended Cost"].value = 	
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = 
				  document.ThisForm.elements["da6 Month Extension Qty"].selectedIndex;
				  var extcost = qty * 237.26;
				  document.ThisForm.elements["da6 Month Extension Extended Cost"].value = 	
					roundOff(extcost,2);
			   }
			} // end case 12
			
			case 13:
			if (whichItem == fieldNbr)
			{  
			  // 12 month extension plan
			  if (document.ThisForm.elements["da12 Month Extension Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da12 Month Extension Extended Cost"].value = 	
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = 
				  document.ThisForm.elements["da12 Month Extension Qty"].selectedIndex;
				  var extcost = qty * 459.53;
				  document.ThisForm.elements["da12 Month Extension Extended Cost"].value = 	
					roundOff(extcost,2);
			   }
			} // end case 13
			
			case 14:
			if (whichItem == fieldNbr)
			{  
			  // 50 min. reload
			  if (document.ThisForm.elements["da50 Minute Load Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da50 Minute Load Extended Cost"].value = 	
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["da50 Minute Load Qty"].selectedIndex;
				  var extcost = qty * 77.78;
				  document.ThisForm.elements["da50 Minute Load Extended Cost"].value = 	
					roundOff(extcost,2);
			   }
			} // end case 14

		case 15:
			if (whichItem == fieldNbr)
			{
			  // Emergency Monthly (Postpaid) Activation
			  if (document.ThisForm.elements["daIridium Emergency (Postpaid) Activation Fee Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["daIridium Emergency (Postpaid) Activation Fee Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["daIridium Emergency (Postpaid) Activation Fee Qty"].selectedIndex;
				  var extcost = qty * 50.00;
				  document.ThisForm.elements["daIridium Emergency (Postpaid) Activation Fee Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 15
			case 16:
			if (whichItem == fieldNbr)
			{
			  // 750 min. plan
			  if (document.ThisForm.elements["da750 Minute Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["da750 Minute Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["da750 Minute Qty"].selectedIndex;
				  var extcost = qty * 727.38;
				  document.ThisForm.elements["da750 Minute Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 16

			
			
		} // end switch
	}	// end for
  check_African();
  check_Canadian();
  doSubTotal();
  doTotal();
  return (true);

}

//********************************function*******************************
function calcExtendedCost2(whichItem)
{	//9505A accessories
	for (var fieldNbr = 1; fieldNbr < 15; fieldNbr++)
	{
		switch (whichItem)
		{

			case 1:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9505/9505A Replacement Antenna
			  if (document.ThisForm.elements["dcIridium 9505/9505A Replacement Antenna Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dcIridium 9505/9505A Replacement Antenna Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dcIridium 9505/9505A Replacement Antenna Qty"].selectedIndex;
				  var extcost = qty * 205;
				  document.ThisForm.elements["dcIridium 9505/9505A Replacement Antenna Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 1


			case 2:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9505A Battery
			  if (document.ThisForm.elements["dcIridium 9505A Battery Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dcIridium 9505A Battery Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dcIridium 9505A Battery Qty"].selectedIndex;
				  var extcost = qty * 99;
				  document.ThisForm.elements["dcIridium 9505A Battery Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 2
			case 3:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9505A AC Travel Charger
			  if (document.ThisForm.elements["dcIridium 9505A AC Travel Charger Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dcIridium 9505A AC Travel Charger Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dcIridium 9505A AC Travel Charger Qty"].selectedIndex;
				  var extcost = qty * 80;
				  document.ThisForm.elements["dcIridium 9505A AC Travel Charger Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 3
			case 4:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9505A AC Plug Adapters
			  if (document.ThisForm.elements["dcIridium 9505A AC Plug Adapters Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dcIridium 9505A AC Plug Adapters Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dcIridium 9505A AC Plug Adapters Qty"].selectedIndex;
				  var extcost = qty * 30;
				  document.ThisForm.elements["dcIridium 9505A AC Plug Adapters Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 4

			case 5:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9505A DC Vehicle Charger
			  if (document.ThisForm.elements["dcIridium 9505A DC Vehicle Charger Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dcIridium 9505A DC Vehicle Charger Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dcIridium 9505A DC Vehicle Charger Qty"].selectedIndex;
				  var extcost = qty * 60;
				  document.ThisForm.elements["dcIridium 9505A DC Vehicle Charger Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 5
			case 6:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9505A Data Kit
			  if (document.ThisForm.elements["dcIridium 9505A Data Kit Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dcIridium 9505A Data Kit Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dcIridium 9505A Data Kit Qty"].selectedIndex;
				  var extcost = qty * 125;
				  document.ThisForm.elements["dcIridium 9505A Data Kit Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 6
			case 7:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9505A Antenna Adapter
			  if (document.ThisForm.elements["dcIridium 9505A Antenna Adapter Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dcIridium 9505A Antenna Adapter Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dcIridium 9505A Antenna Adapter Qty"].selectedIndex;
				  var extcost = qty * 50;
				  document.ThisForm.elements["dcIridium 9505A Antenna Adapter Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 7
			case 8:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9505A Portable Aux Antenna
			  if (document.ThisForm.elements["dcIridium 9505A Portable Aux Antenna Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dcIridium 9505A Portable Aux Antenna Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dcIridium 9505A Portable Aux Antenna Qty"].selectedIndex;
				  var extcost = qty * 110;
				  document.ThisForm.elements["dcIridium 9505A Portable Aux Antenna Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 8
			case 9:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9505A Pelican Hard Case - 1200 case
			  if (document.ThisForm.elements["dcIridium 9505A Pelican 1200 Hard Case Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dcIridium 9505A Pelican 1200 Hard Case Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dcIridium 9505A Pelican 1200 Hard Case Qty"].selectedIndex;
				  var extcost = qty * 59;
				  document.ThisForm.elements["dcIridium 9505A Pelican 1200 Hard Case Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 9
			case 12:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9505A Pelican Hard Case - 1400 case
			  if (document.ThisForm.elements["dcIridium 9505A Pelican 1400 Hard Case Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dcIridium 9505A Pelican 1400 Hard Case Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dcIridium 9505A Pelican 1400 Hard Case Qty"].selectedIndex;
				  var extcost = qty * 109;
				  document.ThisForm.elements["dcIridium 9505A Pelican 1400 Hard Case Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 12

			case 13:
			if (whichItem == fieldNbr)
			{
			  // 6.5 Watt Solar Charger
			  if (document.ThisForm.elements["dc6.5 Watt Solar Charger Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dc6.5 Watt Solar Charger Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dc6.5 Watt Solar Charger Qty"].selectedIndex;
				  var extcost = qty * 99;
				  document.ThisForm.elements["dc6.5 Watt Solar Charger Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 13

			case 14:
			if (whichItem == fieldNbr)
			{
			  // 12 Watt Solar Charger
			  if (document.ThisForm.elements["dc12 Watt Solar Charger Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dc12 Watt Solar Charger Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dc12 Watt Solar Charger Qty"].selectedIndex;
				  var extcost = qty * 195;
				  document.ThisForm.elements["dc12 Watt Solar Charger Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 14


		} // end switch
	}	// end for
  doSubTotal2();
  doTotal();
  return (true);
}  // end function

//********************************function*******************************
function calcExtendedCost3(whichItem)
{ 	//9500/9505 accessories
	for (var fieldNbr = 1; fieldNbr < 11; fieldNbr++)
	{
		switch (whichItem)
		{
					case 1:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9500/9505 Battery
			  if (document.ThisForm.elements["deIridium 9500/9505 Battery Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["deIridium 9500/9505 Battery Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["deIridium 9500/9505 Battery Qty"].selectedIndex;
				  var extcost = qty * 99;
				  document.ThisForm.elements["deIridium 9500/9505 Battery Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 1

			case 2:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9500/9505 DC Vehicle Charger
			  if (document.ThisForm.elements["deIridium 9500/9505 DC Vehicle Charger Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["deIridium 9500/9505 DC Vehicle Charger Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["deIridium 9500/9505 DC Vehicle Charger Qty"].selectedIndex;
				  var extcost = qty * 50;
				  document.ThisForm.elements["deIridium 9500/9505 DC Vehicle Charger Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 2

			case 3:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9500/9505 Data Kit
			  if (document.ThisForm.elements["deIridium 9500/9505 Data Kit Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["deIridium 9500/9505 Data Kit Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["deIridium 9500/9505 Data Kit Qty"].selectedIndex;
				  var extcost = qty * 125;
				  document.ThisForm.elements["deIridium 9500/9505 Data Kit Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 3

			case 4:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9500/9505 Antenna Adapter
			  if (document.ThisForm.elements["deIridium 9500/9505 Antenna Adapter Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["deIridium 9500/9505 Antenna Adapter Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["deIridium 9500/9505 Antenna Adapter Qty"].selectedIndex;
				  var extcost = qty * 50;
				  document.ThisForm.elements["deIridium 9500/9505 Antenna Adapter Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 4

			case 5:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9500/9505 Portable Aux Antenna
			  if (document.ThisForm.elements["deIridium 9500/9505 Portable Aux Antenna Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["deIridium 9500/9505 Portable Aux Antenna Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["deIridium 9500/9505 Portable Aux Antenna Qty"].selectedIndex;
				  var extcost = qty * 110;
				  document.ThisForm.elements["deIridium 9500/9505 Portable Aux Antenna Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 5

			case 6:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9500/9505 Pelican 1200 Hard Case
			  if (document.ThisForm.elements["deIridium 9500/9505 Pelican 1200 Hard Case Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["deIridium 9500/9505 Pelican 1200 Hard Case Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["deIridium 9500/9505 Pelican 1200 Hard Case Qty"].selectedIndex;
				  var extcost = qty * 59;
				  document.ThisForm.elements["deIridium 9500/9505 Pelican 1200 Hard Case Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 6

			case 7:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9500/9505 Pelican 1400 Hard Case
			  if (document.ThisForm.elements["deIridium 9500/9505 Pelican 1400 Hard Case Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["deIridium 9500/9505 Pelican 1400 Hard Case Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["deIridium 9500/9505 Pelican 1400 Hard Case Qty"].selectedIndex;
				  var extcost = qty * 109;
				  document.ThisForm.elements["deIridium 9500/9505 Pelican 1400 Hard Case Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 7
			case 8:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9505/9505A Replacement Antenna
			  if (document.ThisForm.elements["deIridium 9505/9505A Replacement Antenna Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["deIridium 9505/9505A Replacement Antenna Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["deIridium 9505/9505A Replacement Antenna Qty"].selectedIndex;
				  var extcost = qty * 205;
				  document.ThisForm.elements["deIridium 9505/9505A Replacement Antenna Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 8


			case 9:
			if (whichItem == fieldNbr)
			{
			  // 6.5 Watt Solar Charger
			  if (document.ThisForm.elements["de6.5 Watt Solar Charger Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["de6.5 Watt Solar Charger Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["de6.5 Watt Solar Charger Qty"].selectedIndex;
				  var extcost = qty * 99;
				  document.ThisForm.elements["de6.5 Watt Solar Charger Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 9

			case 10:
			if (whichItem == fieldNbr)
			{
			  // 12 Watt Solar Charger
			  if (document.ThisForm.elements["de12 Watt Solar Charger Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["de12 Watt Solar Charger Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["de12 Watt Solar Charger Qty"].selectedIndex;
				  var extcost = qty * 195;
				  document.ThisForm.elements["de12 Watt Solar Charger Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 10

			
		} // end switch
	}	// end for
  doSubTotal3();
  doTotal();

  return (true);

}

//********************************function*******************************
function calcExtendedCost4(whichItem)
{
	for (var fieldNbr = 1; fieldNbr < 15; fieldNbr++)
	{
		switch (whichItem)
		{
			case 1:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9555 Phone
			  if (document.ThisForm.elements["dhIridium 9555 Phone Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dhIridium 9555 Phone Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dhIridium 9555 Phone Qty"].selectedIndex;
				  var extcost = qty * 1295;
				  document.ThisForm.elements["dhIridium 9555 Phone Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 1
			case 2:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9555 Battery
			  if (document.ThisForm.elements["diIridium 9555 Battery Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["diIridium 9555 Battery Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["diIridium 9555 Battery Qty"].selectedIndex;
				  var extcost = qty * 99;
				  document.ThisForm.elements["diIridium 9555 Battery Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 2
			case 3:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9555 AC Travel Charger
			  if (document.ThisForm.elements["diIridium 9555 AC Travel Charger Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["diIridium 9555 AC Travel Charger Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["diIridium 9555 AC Travel Charger Qty"].selectedIndex;
				  var extcost = qty * 80;
				  document.ThisForm.elements["diIridium 9555 AC Travel Charger Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 3
			case 4:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9555 AC Plug Adapters
			  if (document.ThisForm.elements["diIridium 9555 AC Plug Adapters Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["diIridium 9555 AC Plug Adapters Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["diIridium 9555 AC Plug Adapters Qty"].selectedIndex;
				  var extcost = qty * 30;
				  document.ThisForm.elements["diIridium 9555 AC Plug Adapters Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 4

			case 5:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9555 DC Vehicle Charger
			  if (document.ThisForm.elements["diIridium 9555 DC Vehicle Charger Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["diIridium 9555 DC Vehicle Charger Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["diIridium 9555 DC Vehicle Charger Qty"].selectedIndex;
				  var extcost = qty * 55;
				  document.ThisForm.elements["diIridium 9555 DC Vehicle Charger Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 5
			case 6:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9555 Antenna Adapter
			  if (document.ThisForm.elements["diIridium 9555 Antenna Adapter Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["diIridium 9555 Antenna Adapter Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["diIridium 9555 Antenna Adapter Qty"].selectedIndex;
				  var extcost = qty * 58;
				  document.ThisForm.elements["diIridium 9555 Antenna Adapter Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 6
			case 7:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9555 Portable Aux Antenna
			  if (document.ThisForm.elements["diIridium 9555 Data CD Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["diIridium 9555 Data CD Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["diIridium 9555 Data CD Qty"].selectedIndex;
				  var extcost = qty * 10;
				  document.ThisForm.elements["diIridium 9555 Data CD Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 7
			case 8:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9555 Leather Holster
			  if (document.ThisForm.elements["diIridium 9555 Leather Holster Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["diIridium 9555 Leather Holster Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["diIridium 9555 Leather Holster Qty"].selectedIndex;
				  var extcost = qty * 45;
				  document.ThisForm.elements["diIridium 9555 Leather Holster Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 8
			
			case 9:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9555 User Guide
			  if (document.ThisForm.elements["diIridium 9555 User Guide Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["diIridium 9555 User Guide Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["diIridium 9555 User Guide Qty"].selectedIndex;
				  var extcost = qty * 20;
				  document.ThisForm.elements["diIridium 9555 User Guide Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 9
			
			case 10:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9555 User Guide
			  if (document.ThisForm.elements["diIridium 9555 User Guide Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["diIridium 9555 User Guide Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["diIridium 9555 User Guide Qty"].selectedIndex;
				  var extcost = qty * 20;
				  document.ThisForm.elements["diIridium 9555 User Guide Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 10
	
				
			case 11:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9555 Mini USB Cable
			  if (document.ThisForm.elements["diIridium 9555 Mini USB Cable Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["diIridium 9555 Mini USB Cable Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["diIridium 9555 Mini USB Cable Qty"].selectedIndex;
				  var extcost = qty * 35;
				  document.ThisForm.elements["diIridium 9555 Mini USB Cable Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 11
			
			case 12:
			if (whichItem == fieldNbr)
			{
			  // Iridium 9555 To Go Kit
			  if (document.ThisForm.elements["dhIridium 9555 To Go Kit Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["dhIridium 9555 To Go Kit Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["dhIridium 9555 To Go Kit Qty"].selectedIndex;
				  var extcost = qty * 1345;
				  document.ThisForm.elements["dhIridium 9555 To Go Kit Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 12
			

			case 13:
			if (whichItem == fieldNbr)
			{
			  // 6.5 Watt Solar Charger
			  if (document.ThisForm.elements["di6.5 Watt Solar Charger Qty"].selectedIndex == 0)
			  {
				  document.ThisForm.elements["di6.5 Watt Solar Charger Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["di6.5 Watt Solar Charger Qty"].selectedIndex;
				  var extcost = qty * 99;
				  document.ThisForm.elements["di6.5 Watt Solar Charger Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 13

			case 14:
			if (whichItem == fieldNbr)
			{
			  // 12 Watt Solar Charger
			  if (document.ThisForm.elements["di12 Watt Solar Charger Qty"].selectedIndex == 0)
			  {
					document.ThisForm.elements["di12 Watt Solar Charger Extended Cost"].value =
					roundOff(0,2);
			  }
			  else
			  {
				  var qty = document.ThisForm.elements["di12 Watt Solar Charger Qty"].selectedIndex;
				  var extcost = qty * 195;
				  document.ThisForm.elements["di12 Watt Solar Charger Extended Cost"].value =
					roundOff(extcost,2);
			   }
			} // end case 14


			
		} // end switch
	}	// end for
  doSubTotal4();
  doTotal();
  return (true);
}  // end function

//********************************function*******************************
function checkForInput()
{

if (document.ThisForm.aaName.value.length == 0) {
  alert("Please enter your Name.");
  document.ThisForm.aaName.focus();
return false;
}

if (document.ThisForm.baEmail.value.length == 0) {
  alert("Please enter an Email Address.");
  document.ThisForm.baEmail.focus();
  return false;
}


if ((document.ThisForm.baEmail.value.indexOf('@',0)==-1) ||
   (document.ThisForm.baEmail.value.indexOf('.',0)==-1))  {
     alert('\nInvalid email address.')
     document.ThisForm.baEmail.focus();
	return false;
}


if (document.ThisForm.elements["abContact Phone Number"].value.length == 0) {
  alert("Please enter Phone Number.");
  document.ThisForm.elements["cbContact Phone Number"].focus();
  return false;
}

	// test if have selected either of 9555 phones, as well as either a prepaid or postpaid plan has been selected
	// allow to NOT order a phone/airtime, though

      if (((document.ThisForm.elements["dhIridium 9555 Phone Qty"].selectedIndex > 0) ||
		    (document.ThisForm.elements["dhIridium 9555 To Go Kit Qty"].selectedIndex > 0)) &&
      
      
      	  ((document.ThisForm.elements["da75 Minute Qty"].selectedIndex == 0) &&
       	   (document.ThisForm.elements["da150 Minute Qty"].selectedIndex == 0) &&
       	   (document.ThisForm.elements["da225 Minute Qty"].selectedIndex == 0) &&
       	   (document.ThisForm.elements["da500 Minute Qty"].selectedIndex == 0) &&
       	   (document.ThisForm.elements["da1,000 Minute Qty"].selectedIndex == 0) &&
       	   (document.ThisForm.elements["da3,000 Minute Qty"].selectedIndex == 0) &&
       	   (document.ThisForm.elements["da5,000 Minute Qty"].selectedIndex == 0) &&
       	   (document.ThisForm.elements["da300 Minute African Qty"].selectedIndex == 0) &&
       	   (document.ThisForm.elements["da200 Minute Alaska and Canada Qty"].selectedIndex == 0) &&

           (document.ThisForm.elements["daIridium Std Monthly (Postpaid) Activation Fee Qty"].selectedIndex == 0) &&
       	   (document.ThisForm.elements["daIridium Emergency (Postpaid) Activation Fee Qty"].selectedIndex == 0)))
           {
           
           alert("You have selected a phone, without selecting a service plan.  Please call for pricing if you wish to buy a phone without service.");
  		   document.ThisForm.elements["daIridium Std Monthly (Postpaid) Activation Fee Qty"].focus();
		   return false;
           
           }

if (document.ThisForm.elements["haCardholder Address Line1"].value.length == 0) {
  alert("Please enter Credit Cardholder's Street Address.");
  document.ThisForm.elements["haCardholder Address Line1"].focus();
  return false;
}

if (document.ThisForm.elements["hcCardholder Address City"].value.length == 0) {
  alert("Please enter Credit Cardholder's City.");
  document.ThisForm.elements["hcCardholder Address City"].focus();
  return false;
}

if (document.ThisForm.elements["hdCardholder Address State"].selectedIndex == 0) {
  alert("Please enter Credit Cardholder's State.");
  document.ThisForm.elements["hdCardholder Address State"].focus();
  return false;
}

if (document.ThisForm.elements["heCardholder Zip"].value.length == 0) {
  alert("Please enter Credit Cardholder's Zip Code.");
  document.ThisForm.elements["heCardholder Zip"].focus();
  return false;
}

//if (!isNum(document.ThisForm.elements["heCardholder Zip"].value)){
//	alert ("Zip Code must be a numeric value");
//	document.ThisForm.elements["heCardholder Zip"].focus();
//	return false;
//}

if (document.ThisForm.elements["iaCreditCardType"].selectedIndex == 0) {
    alert("Please select a Credit Card Type.");
    document.ThisForm.elements["iaCreditCardType"].focus();
    return false;
}

if (document.ThisForm.elements["jaCreditCardNumber"].value.length == 0) {
    alert("Please enter a Card Number.");
    document.ThisForm.elements["jaCreditCardNumber"].focus();
    return false;
}

if (!isNum(document.ThisForm.elements["jaCreditCardNumber"].value)){
	alert ("Credit Card number must be a numeric value");
	document.ThisForm.elements["jaCreditCardNumber"].focus();
	return false;
}

lastFourDigits();

if (document.ThisForm.elements["jbExpirationMonth"].selectedIndex == 0) {
    alert("Please enter the Expiration Month.");
    document.ThisForm.elements["jbExpirationMonth"].focus();
    return false;
}

if (document.ThisForm.elements["jcExpirationYear"].selectedIndex == 0) {
    alert("Please enter the Expiration Year.");
    document.ThisForm.elements["jcExpirationYear"].focus();
    return false;
}

if (document.ThisForm.elements["kaCard Verification Number"].value.length == 0) {
  alert("Please enter the Card Verification Number.");
  document.ThisForm.elements["kaCard Verification Number"].focus();
  return false;
}

if (!isNum(document.ThisForm.elements["kaCard Verification Number"].value)){
	alert ("Card Verification Number must be a numeric value");
  document.ThisForm.elements["kaCard Verification Number"].focus();
	return false;
}

if (document.ThisForm.elements["njTerms and Conditions"].checked == false) {
  alert("Please accept the Terms and Conditions.");
  document.ThisForm.elements["njTerms and Conditions"].focus();
  return false;
}

// if SIM shipping address checkbox is not checked AND are not picking item up, then they need to fill in shipping info
if ((!(document.ThisForm.elements["maShipping Address Equal Credit Address"].checked)) &&
    (!(document.ThisForm.elements["nhShipping Method"][4].checked)))
	{

		if (document.ThisForm.elements["naShipping Address Name"].value.length == 0) {
		  alert("Please enter Shipping Address Name");
		  document.ThisForm.elements["naShipping Address Name"].focus();
		  return false;
		}
		
		if (document.ThisForm.elements["nkShipping Phone Number"].value.length == 0) {
		  alert("Please enter Shipping Phone Number");
		  document.ThisForm.elements["nkShipping Phone Number"].focus();
		  return false;
		}
		
		if (document.ThisForm.elements["ncShipping Address Line 1"].value.length == 0) {
		  alert("Please enter a Shipping Address");
		  document.ThisForm.elements["ncShipping Address Line 1"].focus();
		  return false;
		}

		else if (document.ThisForm.elements["neShipping Address City"].value.length == 0) {
		  alert("Please enter a Shipping Address City");
		  document.ThisForm.elements["neShipping Address City"].focus();
		  return false;
		}

		else if (document.ThisForm.elements["nfShipping Address State"].selectedIndex == 0) {
		  alert("Please enter a Shipping Address State");
		  document.ThisForm.elements["nfShipping Address State"].focus();
		  return false;
		}

		else if (document.ThisForm.elements["ngShipping Address Zip Code"].value.length == 0) {
		  alert("Please enter a Shipping Address Zip Code");
		  document.ThisForm.elements["ngShipping Address Zip Code"].focus();
		  return false;
		}

//		else if (!isNum(document.ThisForm.elements["ngShipping Address Zip Code"].value)){
//			alert ("Shipping Address Zip Code must be a numeric value");
//			document.ThisForm.elements["ngShipping Address Zip Code"].focus();
//			return false;
//		}
} // box not checked

return (true);

}
//********************************function*******************************
function clearShippingAddress() {
if (document.ThisForm.elements["maShipping Address Equal Credit Address"].checked){
	document.ThisForm.elements["nbShipping Address Company"].value = "";
	document.ThisForm.elements["naShipping Address Name"].value = "";
	document.ThisForm.elements["nkShipping Phone Number"].value = "";
	document.ThisForm.elements["ncShipping Address Line 1"].value = "";
	document.ThisForm.elements["ndShipping Address Line 2"].value = "";
	document.ThisForm.elements["neShipping Address City"].value = "";
	document.ThisForm.elements["nfShipping Address State"].selectedIndex = 0;
	document.ThisForm.elements["ngShipping Address Zip Code"].value = "";
	
	document.ThisForm.elements["nbShipping Address Company"].disabled = true;
	document.ThisForm.elements["naShipping Address Name"].disabled = true;
	document.ThisForm.elements["nkShipping Phone Number"].disabled = true;
	document.ThisForm.elements["ncShipping Address Line 1"].disabled = true;
	document.ThisForm.elements["ndShipping Address Line 2"].disabled = true;
	document.ThisForm.elements["neShipping Address City"].disabled = true;
	document.ThisForm.elements["nfShipping Address State"].disabled = true;
	document.ThisForm.elements["ngShipping Address Zip Code"].disabled = true;
	
	document.ThisForm.elements["mbShipping Address Equal Credit Address"].value = "";
}
if (!(document.ThisForm.elements["maShipping Address Equal Credit Address"].checked)){
	document.ThisForm.elements["nbShipping Address Company"].disabled = false;
	document.ThisForm.elements["naShipping Address Name"].disabled = false;
	document.ThisForm.elements["nkShipping Phone Number"].disabled = false;
	document.ThisForm.elements["ncShipping Address Line 1"].disabled = false;
	document.ThisForm.elements["ndShipping Address Line 2"].disabled = false;
	document.ThisForm.elements["neShipping Address City"].disabled = false;
	document.ThisForm.elements["nfShipping Address State"].disabled = false;
	document.ThisForm.elements["ngShipping Address Zip Code"].disabled = false;
	
	document.ThisForm.elements["mbShipping Address Equal Credit Address"].value = "No";
}
}


function doSubTotal()
{
    var tempsubTotal = 0;
	var currentTotal = 0;

    currentTotal = parseFloat(document.ThisForm.elements["da75 Minute Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal = currentTotal;
		  currentTotal=0;
		  }
	
    currentTotal = parseFloat(document.ThisForm.elements["da150 Minute Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;
		  currentTotal=0;
		  }
		  
	
    currentTotal = parseFloat(document.ThisForm.elements["da225 Minute Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;
		  currentTotal=0;
		  }

    currentTotal = parseFloat(document.ThisForm.elements["da500 Minute Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;
		  currentTotal=0;
		  }

currentTotal = parseFloat(document.ThisForm.elements["da750 Minute Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;
		  currentTotal=0;
		  }
	
    currentTotal = parseFloat(document.ThisForm.elements["da1,000 Minute Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;
		  currentTotal=0;
		  }
    currentTotal = parseFloat(document.ThisForm.elements["da3,000 Minute Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;
		  currentTotal=0;
		  }

    currentTotal = parseFloat(document.ThisForm.elements["da5,000 Minute Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;
		  currentTotal=0;
		  }


    currentTotal = parseFloat(document.ThisForm.elements["da300 Minute African Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;
		  currentTotal=0;
		  }

    currentTotal = parseFloat(document.ThisForm.elements["da200 Minute Alaska and Canada Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;

		  currentTotal=0;
		  }

	
    currentTotal = parseFloat(document.ThisForm.elements["da50 Minute Load Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;
		  currentTotal=0;
		  }
	
    currentTotal = parseFloat(document.ThisForm.elements["da30 Day Extension Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;
		  currentTotal=0;
		  }
	
    currentTotal = parseFloat(document.ThisForm.elements["da6 Month Extension Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;
		  currentTotal=0;
		  }
	
    currentTotal = parseFloat(document.ThisForm.elements["da12 Month Extension Extended Cost"].value);
    if (!isNaN(currentTotal)){
	      tempsubTotal += currentTotal;
		  currentTotal=0;
		  }

document.ThisForm.elements["dbMinutes Subtotal"].value = roundOff(tempsubTotal,2);
    return (true);

}

//********************************function*******************************
function doSubTotal2()
{	//9505A accessories
    var tempsubTotal2 = 0;
	var currentTotal2 = 0;
    currentTotal2 = parseFloat(document.ThisForm.elements["dcIridium 9505A Battery Extended Cost"].value);
    if (!isNaN(currentTotal2)){
	      tempsubTotal2 += currentTotal2;
		  currentTotal2=0;
		  }
		  
    currentTotal2 = parseFloat(document.ThisForm.elements["dcIridium 9505A AC Travel Charger Extended Cost"].value);
    if (!isNaN(currentTotal2)){
	      tempsubTotal2 += currentTotal2;
		  currentTotal2=0;
		  }
		  
    currentTotal2 = parseFloat(document.ThisForm.elements["dcIridium 9505A AC Plug Adapters Extended Cost"].value);
    if (!isNaN(currentTotal2)){
	      tempsubTotal2 += currentTotal2;
		  currentTotal2=0;
		  }
		  
    currentTotal2 = parseFloat(document.ThisForm.elements["dcIridium 9505A DC Vehicle Charger Extended Cost"].value);
    if (!isNaN(currentTotal2)){
	      tempsubTotal2 += currentTotal2;
		  currentTotal2=0;
		  }
		  
    currentTotal2 = parseFloat(document.ThisForm.elements["dcIridium 9505A Data Kit Extended Cost"].value);
    if (!isNaN(currentTotal2)){
	      tempsubTotal2 += currentTotal2;
		  currentTotal2=0;
		  }
		  
    currentTotal2 = parseFloat(document.ThisForm.elements["dcIridium 9505A Antenna Adapter Extended Cost"].value);
    if (!isNaN(currentTotal2)){
	      tempsubTotal2 += currentTotal2;
		  currentTotal2=0;
		  }
		  
    currentTotal2 = parseFloat(document.ThisForm.elements["dcIridium 9505A Portable Aux Antenna Extended Cost"].value);
     if (!isNaN(currentTotal2)){
	      tempsubTotal2 += currentTotal2;
		  currentTotal2=0;
		  }

currentTotal2 = parseFloat(document.ThisForm.elements["dcIridium 9505/9505A Replacement Antenna Extended Cost"].value);
	
    if (!isNaN(currentTotal2)){
	      tempsubTotal2 += currentTotal2;
		  currentTotal2=0;
		  }

currentTotal2 = parseFloat(document.ThisForm.elements["dcIridium 9505A Pelican 1200 Hard Case Extended Cost"].value);
    if (!isNaN(currentTotal2)){
	      tempsubTotal2 += currentTotal2;
		  currentTotal2=0;
		  }

currentTotal2 = parseFloat(document.ThisForm.elements["dcIridium 9505A Pelican 1400 Hard Case Extended Cost"].value);
    if (!isNaN(currentTotal2)){
	      tempsubTotal2 += currentTotal2;
		  currentTotal2=0;
		  }

currentTotal2 = parseFloat(document.ThisForm.elements["dc6.5 Watt Solar Charger Extended Cost"].value);
    if (!isNaN(currentTotal2)){
	      tempsubTotal2 += currentTotal2;
		  currentTotal2=0;
		  }

currentTotal2 = parseFloat(document.ThisForm.elements["dc12 Watt Solar Charger Extended Cost"].value);
    if (!isNaN(currentTotal2)){
	      tempsubTotal2 += currentTotal2;
		  currentTotal2=0;
		  }


	document.ThisForm.elements["ddIridium 9505A Subtotal"].value = roundOff(tempsubTotal2,2);
    return (true);
}
//********************************function*******************************

function doSubTotal3()
{
	// 9500/9505A accessories
    var tempsubTotal3 = 0;
	var currentTotal3 = 0;

    currentTotal3 = parseFloat(document.ThisForm.elements["deIridium 9500/9505 Battery Extended Cost"].value);
    if (!isNaN(currentTotal3)){
	      tempsubTotal3 += currentTotal3;
		  currentTotal3=0;
		  }
		  
    currentTotal3 = parseFloat(document.ThisForm.elements["deIridium 9500/9505 DC Vehicle Charger Extended Cost"].value);
    if (!isNaN(currentTotal3)){
	      tempsubTotal3 += currentTotal3;
		  currentTotal3=0;
		  }
		  
    currentTotal3 = parseFloat(document.ThisForm.elements["deIridium 9500/9505 Data Kit Extended Cost"].value);
    if (!isNaN(currentTotal3)){
	      tempsubTotal3 += currentTotal3;
		  currentTotal3=0;
		  }
		  
    currentTotal3 = parseFloat(document.ThisForm.elements["deIridium 9500/9505 Antenna Adapter Extended Cost"].value);
    if (!isNaN(currentTotal3)){
	      tempsubTotal3 += currentTotal3;
		  currentTotal3=0;
		  }
		  
currentTotal3 = parseFloat(document.ThisForm.elements["deIridium 9505/9505A Replacement Antenna Extended Cost"].value);
    if (!isNaN(currentTotal3)){
	      tempsubTotal3 += currentTotal3;
		  currentTotal3=0;
		  }
  
    currentTotal3 = parseFloat(document.ThisForm.elements["deIridium 9500/9505 Portable Aux Antenna Extended Cost"].value);
    if (!isNaN(currentTotal3)){
	      tempsubTotal3 += currentTotal3;
		  currentTotal3=0;
		  }
    currentTotal3 = parseFloat(document.ThisForm.elements["deIridium 9500/9505 Pelican 1200 Hard Case Extended Cost"].value);
    if (!isNaN(currentTotal3)){
	      tempsubTotal3 += currentTotal3;
		  currentTotal3=0;
		  }
    currentTotal3 = parseFloat(document.ThisForm.elements["deIridium 9500/9505 Pelican 1400 Hard Case Extended Cost"].value);
    if (!isNaN(currentTotal3)){
	      tempsubTotal3 += currentTotal3;
		  currentTotal3=0;
		  }


currentTotal3 = parseFloat(document.ThisForm.elements["de6.5 Watt Solar Charger Extended Cost"].value);
    if (!isNaN(currentTotal3)){
	      tempsubTotal3 += currentTotal3;
		  currentTotal3=0;
		  }

currentTotal3 = parseFloat(document.ThisForm.elements["de12 Watt Solar Charger Extended Cost"].value);
    if (!isNaN(currentTotal3)){
	      tempsubTotal3 += currentTotal3;
		  currentTotal3=0;
		  }



document.ThisForm.elements["dfIridium 9500/9505 Subtotal"].value = roundOff(tempsubTotal3,2);
    return (true);

}
//********************************function*******************************
function doSubTotal4()
{
	// process Iriduim 9555 items
	
    var tempsubTotal4 = 0;
	var currentTotal4 = 0;
	currentTotal4 = parseFloat(document.ThisForm.elements["dhIridium 9555 Phone Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }

	currentTotal4 = parseFloat(document.ThisForm.elements["dhIridium 9555 To Go Kit Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }

    currentTotal4 = parseFloat(document.ThisForm.elements["diIridium 9555 Battery Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }
    currentTotal4 = parseFloat(document.ThisForm.elements["diIridium 9555 AC Travel Charger Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }
    currentTotal4 = parseFloat(document.ThisForm.elements["diIridium 9555 AC Plug Adapters Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }
    currentTotal4 = parseFloat(document.ThisForm.elements["diIridium 9555 DC Vehicle Charger Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }
    currentTotal4 = parseFloat(document.ThisForm.elements["diIridium 9555 Antenna Adapter Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }
    currentTotal4 = parseFloat(document.ThisForm.elements["diIridium 9555 Data CD Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }
		  
		  
    currentTotal4 = parseFloat(document.ThisForm.elements["diIridium 9555 Leather Holster Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }
    currentTotal4 = parseFloat(document.ThisForm.elements["diIridium 9555 User Guide Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }
		  
    currentTotal4 = parseFloat(document.ThisForm.elements["diIridium 9555 Mini USB Cable Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }


currentTotal4 = parseFloat(document.ThisForm.elements["di6.5 Watt Solar Charger Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }

currentTotal4 = parseFloat(document.ThisForm.elements["di12 Watt Solar Charger Extended Cost"].value);
    if (!isNaN(currentTotal4)){
	      tempsubTotal4 += currentTotal4;
		  currentTotal4=0;
		  }



    // all done adding components of subtotal in, now round off and place in subtotal
	document.ThisForm.elements["djIridium 9555 Subtotal"].value = roundOff(tempsubTotal4,2);
    return (true);
}
//********************************function*******************************

function doTotal()
{
	// var the variables
	var MinutesTotal = 0;
	var IrATotal = 0;
	var IrTotal = 0;
	var totalsubtotal = 0;
	var activationTotal = 0;

	var addTax = 0;

	var ExtraShipQty = 0;
	var ExtraShip = 0;
	var ShipCharge = 0;
    var ShipTotal = 0;
    var ShipDiscount = 0;

    var orderTotal = 0;
	

MinutesTotal = parseFloat(document.ThisForm.elements["dbMinutes Subtotal"].value);
IrATotal = parseFloat(document.ThisForm.elements["ddIridium 9505A Subtotal"].value);
IrBTotal = parseFloat(document.ThisForm.elements["djIridium 9555 Subtotal"].value);
IrTotal = parseFloat(document.ThisForm.elements["dfIridium 9500/9505 Subtotal"].value);

	activationTotal = 
	(parseFloat(document.ThisForm.elements["daIridium Std Monthly (Postpaid) Activation Fee Extended Cost"].value) + 
	parseFloat(document.ThisForm.elements["daIridium Emergency (Postpaid) Activation Fee Extended Cost"].value));
							   
	//create subtotal from the 4 sub-subtotal fields
	totalsubtotal = MinutesTotal + IrATotal + IrBTotal + IrTotal + activationTotal;  
	document.ThisForm.elements["oaSubtotal"].value=roundOff(totalsubtotal,2);
	//subtotal amount, not 'minutes' related, and therefore taxable
	totalsubtotalnominutes = IrATotal + IrTotal + IrBTotal;

	//calculate GA tax
	if(document.ThisForm.elements["hdCardholder Address State"].selectedIndex == 11)
	{
	addTax = totalsubtotalnominutes * .06;
	}

	//calculate shipping charge and add 5 dollars for each additional unit above one phone and pelican case
	if(
    	document.ThisForm.elements["dhIridium 9555 Phone Qty"].selectedIndex + 
    	document.ThisForm.elements["dhIridium 9555 To Go Kit Qty"].selectedIndex + 
    	document.ThisForm.elements["dcIridium 9505A Pelican 1200 Hard Case Qty"].selectedIndex + 
        document.ThisForm.elements["dcIridium 9505A Pelican 1400 Hard Case Qty"].selectedIndex + 
        document.ThisForm.elements["deIridium 9500/9505 Pelican 1200 Hard Case Qty"].selectedIndex + 
        document.ThisForm.elements["deIridium 9500/9505 Pelican 1400 Hard Case Qty"].selectedIndex > 1)
	{
		ExtraShipQty = 
    	document.ThisForm.elements["dhIridium 9555 Phone Qty"].selectedIndex + 
    	document.ThisForm.elements["dhIridium 9555 To Go Kit Qty"].selectedIndex + 
	    document.ThisForm.elements["dcIridium 9505A Pelican 1200 Hard Case Qty"].selectedIndex + 
	    document.ThisForm.elements["dcIridium 9505A Pelican 1400 Hard Case Qty"].selectedIndex + 
    	document.ThisForm.elements["deIridium 9500/9505 Pelican 1200 Hard Case Qty"].selectedIndex + 
	    document.ThisForm.elements["deIridium 9500/9505 Pelican 1400 Hard Case Qty"].selectedIndex;
		if (ExtraShipQty > 0) {
			ExtraShipQty--;
		}
		
	ExtraShip += 5 * ExtraShipQty;
	}  // end calc shipping charge
	
    if (document.ThisForm.elements["nhShipping Method"][0].checked) {
	 		ShipCharge=59+ExtraShip; }
	else if (document.ThisForm.elements["nhShipping Method"][1].checked) {
	 		ShipCharge=42+ExtraShip; }
	else if (document.ThisForm.elements["nhShipping Method"][2].checked) {
	 		ShipCharge=29+ExtraShip; }
	else if (document.ThisForm.elements["nhShipping Method"][3].checked){ 
	 		ShipCharge=20+ExtraShip; }
	else if (document.ThisForm.elements["nhShipping Method"][4].checked) {
	 		ShipCharge=0; }

	ShipTotal = parseFloat(ShipCharge);

  	if (isNaN(ShipTotal))
  		ShipTotal = 0;

	//SPECIAL -if buy a phone, and activate with prepaid or postpaid minutes, will get $29 discount on shipping.
	//if buy > 1, get discount of $29 + 5 for each additional phone *see notes in checkForDiscount function
	if (ShipTotal > 0)
		ShipDiscount = parseFloat(checkForDiscount());

  	if (isNaN(ShipDiscount))
  		ShipDiscount = 0;

	if (isNaN(totalsubtotal))
  		totalsubtotal = 0;
	
	//calculate order total
	orderTotal = ShipTotal + ShipDiscount + totalsubtotal + addTax;  
	document.ThisForm.elements["oaShipping"].value=roundOff(ShipTotal,2);
	document.ThisForm.elements["oaShipping Discount"].value=roundOff(ShipDiscount,2);
	document.ThisForm.elements["oaTax"].value=roundOff(addTax,2);
	document.ThisForm.elements["oaTotal"].value=roundOff(orderTotal,2);

return (true);

}

//********************************function*******************************
function lastFourDigits()
{
   // finds last 4 digits of credit card to print on receipt
   var startpoint = ((document.ThisForm.elements["jaCreditCardNumber"].value.length) - 4);
   var endpoint = (document.ThisForm.elements["jaCreditCardNumber"].value.length);
   var stringcardnumber = String(document.ThisForm.elements["jaCreditCardNumber"].value);
   document.ThisForm.elements[".zzCredit Card-Last Four Digits"].value = (stringcardnumber.substr(startpoint,endpoint));
   return (true);
}

//********************************function*******************************
function roundOff(value, precision)
{		// includes formatting feature as well as rounding

		var str = ("" + Math.round(eval(value) * Math.pow(10, precision)));
		// pad small value strings with zeros to the left of rounded #
		while (str.length <= precision)
		{
			str = "0" + str;
		}

		// establish location of decimal point
        var decpoint = str.length - precision;

		/* assemble final result from:
		a) the string up to the position of the decimal point
		b) the decimal point
		c) and the balance of the string */

		return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
}

//********************************function*******************************
function checkForDiscount()
{

var NbrPhones = 0;
var NbrPrepaidPlans = 0;
var PrepaidPlan = false;
var PostpaidPlan = false;	
var EarnedShippingDiscount = false;
var DiscountResult = 0;

// SPECIAL -if buy a phone, and activate with prepaid or postpaid minutes, will get $29 discount on shipping.
// *** Form only allows one prepaid to be purchased.  Since rarely sell > 1 phone on form, DB made decision to 
// handle these problems manually if order comes in.  Also, per DB, would never have occasion of user purchasing > 1 phone, // and then buying mix postpaid, prepaid
// Logic is written so that if buy > 1 phone, get $5 additional shipping discount on all phones over first one, as long as // buy either postpaid or prepaid minutes

NbrPhones = (parseInt((document.ThisForm.elements['dhIridium 9555 To Go Kit Qty'].value)) +
			 (parseInt(document.ThisForm.elements['dhIridium 9555 Phone Qty'].value)));

//need to calulate number of plans - both postpaid and prepaid
if ((parseInt(document.ThisForm.elements['daIridium Std Monthly (Postpaid) Activation Fee Qty'].value) > 0) ||
	(parseInt(document.ThisForm.elements["daIridium Emergency (Postpaid) Activation Fee Qty"].value) > 0))
	PostpaidPlan = true;

NbrPrepaidPlans = (
			(parseInt(document.ThisForm.elements['da75 Minute Qty'].value)) +
			(parseInt(document.ThisForm.elements['da150 Minute Qty'].value)) +
			(parseInt(document.ThisForm.elements['da225 Minute Qty'].value)) +
			(parseInt(document.ThisForm.elements['da500 Minute Qty'].value)) +
			(parseInt(document.ThisForm.elements['da1,000 Minute Qty'].value)) +
			(parseInt(document.ThisForm.elements['da3,000 Minute Qty'].value)) +
			(parseInt(document.ThisForm.elements['da5,000 Minute Qty'].value)) +
			(parseInt(document.ThisForm.elements['da300 Minute African Qty'].value)) +
			(parseInt(document.ThisForm.elements['da200 Minute Alaska and Canada Qty'].value)));

if (NbrPrepaidPlans > 0)			
	PrepaidPlan = true;

if ((PrepaidPlan || PostpaidPlan) && (NbrPhones > 0))
	EarnedShippingDiscount = true;

//handle shipping choices - other than 2 day special, that would be less that the 2 day shipping fee
// 3 day =free shipping
if ((document.ThisForm.elements['nhShipping Method'][3].checked) && EarnedShippingDiscount) {
	DiscountResult = (-1 * (((--NbrPhones) * 5) + 20));
	return DiscountResult;
}

//picking up from Satellite
if ((document.ThisForm.elements['nhShipping Method'][4].checked) && EarnedShippingDiscount)
	return 0;

if ((NbrPhones == 1) && EarnedShippingDiscount)
	return -29;
			
// $29 fee, plus $5 extra shipping fee for each additional phone
if ((NbrPhones > 1) && EarnedShippingDiscount) {
	DiscountResult = (-1 * (((--NbrPhones) * 5) + 29));
	return DiscountResult;
}
else
	return 0;	
	
} // end checkForDiscount
