// Support construction of dynamic PayPal args.
var blk1  = "https://www.paypal.com/cart/";
var blk1a = "add=1";
var blk1d = "display=1";
var blk2  = "&business=mauirockstars%40earthlink.net";
var blk3  = "&item_name=";
var blk3n = "Test";
var blk4  = "&amount=";
var blk4a = "0";
// var blk5  = "&image_url=http%3a//" + "members.aol.com/paypalhelp/mylogo.jpg"
var winpar = "width=600,height=400,scrollbars," +
             "location," +  // some users delete this
             "resizable,status";

function AddBoth (strn1, strn2, arg) {  // add to both fields
  AddStyle (strn1, "0");  // add to description
  AddPrice (strn2, arg);  // add to price
}

function AddPrice (strn, arg) {  // add to current price
var r1,r2,pos;
  blk4a=0;
  r1 = blk4a * 1.0 + 0.005; // float 'em
  r2 = strn * 1.0;
  strn = escape (r1 + r2);  // add and put back to string
  pos = strn.indexOf ("."); // find decimal point
  blk4a = strn.substring (0, pos + 3);  // lop off extra
  if (arg != "0") CallPay ();
}

function AddStyle (strn, arg) {  // add to current description
  blk3n = blk3n + "%2C%20" + escape (strn);
  if (arg != "0") CallPay ();
}

function CallPay (obj1,indx) { // call the PayPal shopping cart
var obj,pick,valu,pos;
    obj = obj1.elements[indx];     // The form element object
    pick = obj.selectedIndex;   // which option selected
    valu = obj.options[pick].value;  // isolate it
  if (valu != "unselected") {
     pos  = valu.indexOf ("+$"); // is there an adjustment?  
     if (pos > 0) {AddPrice (valu.substring (pos + 2), "0");}
     blk3n = design + "%2C%20" + valu;
     window.open (blk1 + blk1a + // open the cart window
               //blk2 + blk3 + blk3n + blk4 + blk4a + blk5,
               blk2 + blk3 + blk3n + blk4 + blk4a,
               "cartwin",
               winpar);
  } else {
     alert ('Please make a selection before adding to cart.');
  }
}

function CallView () { // call the PayPal shopping cart view
  window.open (blk1 + blk1d +  // open the PayPal cart window
               blk2,
               "cartwin",
               winpar);
}

function MakeBuy (obj1,indx) {  //get form data for PayPal
var i,j,obj,price,valu,pick,pos;
SetBoth(design,"0","0");
var aray = new Array ();
    obj = obj1.elements[indx];     // The form element object
    pick = obj.selectedIndex;   // which option selected
    valu = obj.options[pick].value;  // isolate it

    pos  = valu.indexOf ("+$"); // is there an adjustment?  
    if (pos > 0) {AddPrice (valu.substring (pos + 2), "0");}
    blk3n = design + "%2C%20" + valu;

  // plug in the price...
  //obj1.elements[0].value = "$" + blk4a;

  //AddStyle (valu.join (", "), "0");  // build desc
}

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

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

function SetPrice (strn) {  // set the current price
  blk4a = "0.00";
  AddPrice (strn, "0");
}

function PopDetail(url) 
	
	{
	window.open(url,"","width=370,height=460,scrollbars=yes");
	}

function PopLarge(url) 
	
	{
	window.open(url,"","width=720,height=640,scrollbars=yes");
	}




