function getAmount(selAmount){
var amt;
amt = selAmount;
switch (amt.value) {
	case "25":
	document._xclick.years.value = "1"
	document._xclick.item_name.value = "1 Year Domain Name Purchase - Add Funds"
	break;
	case "40":
	document._xclick.years.value = "2"
	document._xclick.item_name.value = "2 Years Domain Name Purchase - Add Funds"
	break;
	case "55":
	document._xclick.years.value = "3"
	document._xclick.item_name.value = "3 Years Domain Name Purchase - Add Funds"
	break;
	case "70":
	document._xclick.years.value = "4"
	document._xclick.item_name.value = "4 Years Domain Name Purchase - Add Funds"
	break;
	case "80":
	document._xclick.years.value = "5"
	document._xclick.item_name.value = "5 Years Domain Name Purchase - Add Funds"
	break;
	}
//alert(amt.value);
//return value
}

function getYears(selYears){
var yrs;
yrs = selYears;
//alert(yrs.value);
switch (yrs.value) {
	case "1":
	document._xclick.amount.value = "25"
	document._xclick.item_name.value = "1 Year Domain Name Purchase - Add Funds"
	break;
	case "2":
	document._xclick.amount.value = "40"
	document._xclick.item_name.value = "2 Year Domain Name Purchase - Add Funds"
	break;
	case "3":
	document._xclick.amount.value = "55"
	document._xclick.item_name.value = "3 Year Domain Name Purchase - Add Funds"
	break;
	case "4":
	document._xclick.amount.value = "70"
	document._xclick.item_name.value = "4 Year Domain Name Purchase - Add Funds"
	break;
	case "5":
	document._xclick.amount.value = "80"
	document._xclick.item_name.value = "5 Year Domain Name Purchase - Add Funds"
	break;
	}
}

/* Support construction of dynamic PayPal args. */
var str1  = "https://www.paypal.com/cart/add=1";
var str2 = "&bn=wa_dw_2.0.0";
var strDisplay = "&display=1";
var strBus  = "&business=hcmeasel@msn.com";
var str3  = "&item_name=";
var strDesc = "";
var str5 = "&item_number=";
var str5b = "111";
var str6a = "&on0="; //option 
var str6b = "Box Contains"; //option description
var str6c = "&os0="; //option contents
var strBoxItem = ""; //string of contents
var str6e = "&on1="; //option
var str6f = "Additional Items"; //option description
var str6g = "&os1="; //option contents
var strDescOp = "";  //string of contents
var strOpt3 = "&on2="; //option
var strOpt3Label = "Shipping Info"; //option description
var strOpt3Equal = "&os2="; //option contents
var strOpt3Desc = "test";  //string of contents
var str6  = "&amount=";
var strAmt = "0.00";
var str7  = "&image_url=https://inachos.safe-order.net/agent-at-work/images/logo.gif";
var str8 = "&return=http://www.agent-at-work.com/html/thankyou.htm";
var str9 = "&cancel_return=http://www.agent-at-work.com/html/failed.htm";
var str10 = "&undefined_quantity=0";
var str11 = "&no_shipping=0";
var str12 = "&no_note=0";
var str13 = "&cn=Gift Card Message.";
var str14 = "&custom=";
var strCustNum = "";
//var str15 = "&shipping2=5";
var winpar = "width=800,height=400,scrollbars,location,resizable,status";
        
       
              //boxtype, turtle,bear, candy1,cdy1amt,candy2,cdy2amt,candy3,cdy3amt,candy4,cndyamt,candy5,cndyamt,$amount,turtleamt,bearamt,ship type,shipcost,arg
function AddInfo (strn1, strn2, strn3, strn4, strn4a, strn5, strn5a, strn6, strn6a, strn7, strn7a, strn8, strn8a, strn9, str10, str11, ship, shipCost, custNum, arg) {  // add to both fields
  AddDesc (strn1, strn2, strn3, "0");  // add to description (box type, turtles, bear claws)
  AddBoxItem (strn4, strn4a, strn5, strn5a, strn6, strn6a, strn7, strn7a, strn8, strn8a, "0"); //add to list of items in box (list of candy, candyayPal()
  AddExtraItemDesc (strn2, strn3, str10, str11, ship, shipCost, "0"); //add to options portion of paypal list (turtles, bear claws,count,count
  AddPrice (strn9, arg);  // add to price    (price, arg)
  AddCustNum (custNum);//add customer number
}

function AddPrice (strn, arg) {  // add to current price
var pos;
  pos = strn.indexOf ("."); // find decimal point
  strAmt = strn.substring (0, pos + 3);  // take off extra
  if (arg != "0") CallPay ();
}

function AddBoxItem (strn, strnA, strn2, strn2b, strn3, strn3b, strn4, strn4b, strn5, strn5b, arg) {  // add to current description
  if (strBoxItem != ""){
  strBoxItem = strBoxItem + "%2C%20" + escape (strn);}
  else
  strBoxItem = escape (strn) + "-Qty=" + strnA;
  if (strn2 != "none"){
  strBoxItem = strBoxItem + "%2C%20" + escape (strn2) + "-Qty=" + strn2b;}
  if (strn3 != "none"){
  strBoxItem = strBoxItem + "%2C%20" + escape (strn3) + "-Qty=" + strn3b;}
  if (strn4 != "none"){
  strBoxItem = strBoxItem + "%2C%20" + escape (strn4) + "-Qty=" + strn4b;}
  if (strn5 != "none"){
  strBoxItem = strBoxItem + "%2C%20" + escape (strn5) + "-Qty=" + strn5b;}
  if (arg != "0") CallPay ();
}

function AddCustNum (strn) {
strCustNum = escape (strn);
}

function AddDesc (strn, strn2, strn3, arg) {  // add to current description
  if (strDesc != ""){
  strDesc = strDesc + "%2C%20" + escape (strn);}
  else
  strDesc = escape (strn);
  if (strn2 != "none"){
  strDesc = strDesc + "%2C%20" + escape (strn2);}
  if (strn3 != "none"){
  strDesc = strDesc + "%2C%20" + escape (strn3);}
  if (arg != "0") CallPay ();
}

function AddExtraItemDesc (strn, strn2, str10, str11, ship, shipCost, arg) {  // add to options descriptions
  if (strDescOp != ""){
  strDescOp = strDescOp + "%2C%20" + escape (strn);}
  //strDescOp = strDescOp + "%2C%20" + escape (strn);}
  else
  strDescOp = escape (strn) + "-Qty=" + str10;
  if (strn2 != "none"){ 
  	if (str11 != "none"){
	strDescOp = strDescOp + "%2C%20" + escape (strn2) + "-Qty=" + str11;}
 	else
  	strDescOp = strDescOp + "%2C%20" + escape (strn2);}
  strDescOp = strDescOp + "%2C%20" + "Ship Method: " + escape (ship);
  strDescOp = strDescOp + "%2C%20" + "Ship Cost: " + escape (shipCost);
  if (arg != "0") CallPay ();
}

function CallPay () { // call the PayPal shopping cart
  document.btnAdd.visable = false;
  window.open (str1 + str2 + // open the PayPal cart window
               strBus + str3 + strDesc + str6 + strAmt + str6a + str6b  + str6c + strBoxItem + str6e + str6f + str6g + strDescOp + strOpt3 + strOpt3Label + strOpt3Equal + strOpt3Desc + str7 + str8 + str9 + str10 + str11 + str12 + str13 + str14 + strCustNum,
               "cartwin",winpar);
}

function CallView () { // call the PayPal shopping cart view
  window.open (str11 + strDisplay +  // open the PayPal cart window
               strBus,
               "cartwin",
               winpar);
}

function SetBoth (strn1, strn2, arg) {  // set desc and value
  SetDesc  (strn1);
  SetPrice (strn2);
  if (arg != "0") CallPay ();
}

function SetDesc (strn) {  // set the desc field
  strDesc = escape (strn);
}

function SetPrice (strn) {  // set the current price
  strAmt = '0.0';
  AddPrice (strn, '0');
}

function goTo(page) {
parent.location.href = page; 
}

