var blk1  = "https://www.paypal.com/cgi-bin/webscr?cmd=_cart";
var blk1a = "&add=1";
var blk1d = "&display=1";
var blk1u = "&upload=1";
var blk2  = "&business=";
var blk2a = "&quantity=";
var blk2q = 0;
var blk3  = "&item_name=";
var blk3n = "";
var bcode = "";
var blkcc = "";
var bmisc = "";  // stuff not supported anywhere else.
var blk4  = "&amount=";
var blk4a = "6.66";
var imgx  = "dummy.jpg";  // place for cart thumbnail image
var cart_winpar = "width=800,scrollbars,location,resizable,status,height=";
var detail_winpar = "width=650,height=450,scrollbars,location,resizable,status";
var paypal_winpar = "width=800,height=650,scrollbars,location,resizable,status";
var print_winpar = "width=800,height=550,scrollbars,location,resizable,status";
	      
var cmax  = 16;            // max items in cart
var cats  = 5;             // max number of categories allowed
var pcat  = 0;             // item product category
var ctot  = new Object (); // amt & qty totals by pcat
var ttax  = 0;
var hand = 0;           // cart totals
var ship;
var tpkg;           // total packages
var qtyd;
var tqty = 0;       // the total quantity of items ordered
var cook;           // place for item cookie object
var tprc = 0;       // total price of items in cart
var gtot;           // order grand total
var ship_tot;           // order grand total
 
var dqty = new Array ();  // item discount qty breakpoint
var damt = new Array ();  // percent discount
var dn   = 0;             // number of discount brkpts
var aqty = new Array ();  // item quantity amt breakpoint
var aamt = new Array ();  // price at breakpoint
var an   = 0;             // number of amt brkpts
var coupval = "";         // coupon value user entered
var coupons = new Array ("coup1", "coup2");
var coupond = new Array (10, 15);  // discount aray
var coup = -1;            // cart discount coupon not active
// stuff for shipping support...
var amt;        // priority shipping charge
// cart display options...
var on  = 1;       // on and off variables
var off = 0;

var discount_amount = 0;
var discount_cds = 0;
var total_book = 0;
var total_video = 0;
var total_audio = 0;
var total_sticker = 0;
var priority_shipping = "false";
var sales_tax = "false";
var sales_tax_amount = 0;

var regship = 0;
var intlship = 0;
var priship = 0;

function item_shipping_amount()
{
  var ret_amount = 0.0;

  if (root.stxt0 == "US" && root.priority_shipping == "true")
    {
      ret_amount += 1.0 * cook.qty * cook.priship;
    }

  if (root.stxt0 == "International") 
    {
      ret_amount += 1.0 * cook.qty * cook.intlship;
    }
  else
    {
      ret_amount += 1.0 * cook.qty * cook.regship;
    }

  return ret_amount;
}

function item_tax_amount()
{
  var ret_amount = 0.0;

  if (root.stxt0 == "US" && root.sales_tax == "true")
    {
      ret_amount += .082*(1.0*cook.prc*cook.qty + 1.0*item_shipping_amount());
    }

  return ret_amount;
}

function AddDesc (strn) {  // add to current description
var c = "";
  if (blk3n.length > 0) c = ", ";
  blk3n = blk3n + c + strn;
}

function AddMisc (strn) {  // add extra stuff to PayPal params
var s = "&";
  if (strn.substring(0,1) == "&") s = "";
  bmisc = bmisc + s + escape (strn);
}

function AddPrcnt (strn) {    // add a percent to the price
  SetPrice (blk4a * (1.0 + strn/100.0));  // add the percent
}

function AddPrice (strn) {  // add to current price
  blk4a = Dollar (blk4a*1.0 + strn*1.0);
}

function CallPrint()
{
  var cartwin;
  cartwin = window.open ("payprint.html", "", print_winpar);
}

function CallPay () { // call the PayPal shopping cart
var strn,cartwin;
  blkcc = "";                  // check default settings
  if (root.xx_cur.length > 0)  // record currency entry 
    blkcc = blkcc + "&currency_code=" + root.xx_cur;
  if (root.xx_lc.length > 0)   // record user entry
    blkcc = blkcc + "&lc=" + root.xx_lc;
  if (root.xx_can.length > 0)  // set cancel return path
    blkcc = blkcc + "&cancel_return=" + root.xx_can;
  if (root.xx_ret.length > 0)  // set return path 
    blkcc = blkcc + "&return=" + root.xx_ret;
  if (root.xx_sty.length > 0)  // set display style
    blkcc = blkcc + "&page_style=" + root.xx_sty;

  strn = blk1 + blk1u + blk2 + root.xx_id + blkcc + bmisc + Xbild ();
  ClearAll ();
  cartwin = window.open (strn, "paypal", paypal_winpar);
  cartwin.focus ();
  //self.close ();
}

function call_detail_win(strn)
{
  var cartwin;
  cartwin = window.open (strn, "", detail_winpar);
  cartwin.focus ();
}

function CallView () 
{ 
  var cartwin;
  var i;
  var used = 0;

  for (i = 1; i < cmax; i++) 
    {  
      cook = new Cookie (document, "paycart" + i);
      cook.load();

      if (cook.qty > 0)
	{
	  used++;
	}
    }

  var cart_param_str = cart_winpar + (340 + used * 25);

  cartwin = window.open ("cart.html", "", cart_param_str);
  cartwin.focus ();
}

function ChkFlg (temp) 
{     // check for special flag char
var pos;
  pos  = temp.indexOf ("@"); // is there a initial value?  
  if (pos >= 0) SetPrice (temp.substring (pos + 1));
  pos  = temp.indexOf ("+"); // is there a price adjustment?  
  if (pos >= 0) AddPrice (temp.substring (pos + 1));
  pos  = temp.indexOf ("%"); // is there a percent adjustment?  
  if (pos >= 0) AddPrcnt (temp.substring (pos + 1));
}

function ChkOpts () 
{  
  if (tprc <= 0) 
    {  
      alert ("You have not yet met the minimum order requirements.");
      return false;
    }

  if (root.stxt0 == "Select Location") 
    {  
      alert ("Please select a shipping location.");
      return false;
    }

  return true;
}

function ClearAll () {  // wipe out the last entry
  blk2q = "";  // quantity
  blk3n = "";  // name
  blk4a = "0"; // price
  bcode = "";  // item number
  bmisc = "";  // extra data
  imgx  = "dummy.jpg";
  dn    = 0;
  an    = 0;
  pcat  = 0;
  regship = 0;
  intlship = 0;
  priship = 0;
}

function ClearCart () 
{     
  var i;
  for (i=1; i<cmax; i++) { ClearEntry (i); }
}

function ClearEntry (i) 
{  
  cook = new Cookie (document, "paycart" + i);
  InitData ();
}

function Cookie(document, name, hours, path, domain, secure) 
{
  this.$document = document;  // required
  this.$name = name;          // required

  if (hours) this.$expiration = new Date((new Date()).getTime() + hours * 3600000);
  else this.$expiration = null;

  this.$path = "/";  // force, for now

  if (domain) this.$domain = domain; else this.$domain = null;
  if (secure) this.$secure = true;   else this.$secure = false;
}

function _Cookie_store() 
{  
  var cookieval = "";  // clear actual cookie value

  for(var prop in this) 
    {  // Ignore "$" properties, and methods
      if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function')) 
        continue;
      if (cookieval != "") 
	cookieval += '&';

      cookieval += prop + ':' + escape(this[prop]);
    }

  var cookie = this.$name + '=' + cookieval;

  if (this.$expiration) cookie += '; expires=' + this.$expiration.toGMTString();
  if (this.$path) cookie += '; path=' + this.$path;
  if (this.$domain) cookie += '; domain=' + this.$domain;
  if (this.$secure) cookie += '; secure';
  if (root.xx_cdmp == on)           // cookie diagnostic dump
    alert(cookie.length + " chars - " + cookie);

  this.$document.cookie = cookie;  // store with magic property
}

function _Cookie_load() 
{  
  var i;
  var allcookies = this.$document.cookie;

  if (allcookies == "") return false;

  var start = allcookies.indexOf(this.$name + '=');

  if (start == -1) return false;   

  start += this.$name.length + 1;  
  var end = allcookies.indexOf(';', start);

  if (end == -1) end = allcookies.length;

  var cookieval = allcookies.substring(start, end);
  var a = cookieval.split('&');  // array of name/value pairs.

  for(i=0; i < a.length; i++)  // Break each pair into an array.
    a[i] = a[i].split(':');

  for(i=0; i<a.length; i++)
    this[a[i][0]] = unescape(a[i][1]);

  return true;
}

function _Cookie_remove() 
{  
  var cookie;
  cookie = this.$name + '=';

  if (this.$path) cookie += '; path=' + this.$path;
  if (this.$domain) cookie += '; domain=' + this.$domain;

  cookie += '; expires=Fri, 02-Jan-1970 00:00:00 GMT';

  this.$document.cookie = cookie;  // magic store
}

function Dollar (val) 
{  
  var str,pos,rnd=0;

  if (val == 0) return "0.00";

  if (val < .995) rnd = 1;

  str = escape (val*1.0 + 0.005001 + rnd);  // float, round, escape
  pos = str.indexOf (".");

  if (pos > 0) str = str.substring (rnd, pos + 3);

  return str;
}

function InitData () {  // zap a data cookie
  cook.pcat = 0;
  cook.qty  = 0;
  cook.cod  = "";
  cook.ihnd = 0;
  cook.des  = "";
  cook.prc  = 0;
  cook.regship  = 0;
  cook.intlship  = 0;
  cook.priship  = 0;
  cook.imgx = "dummy.jpg";
  cook.store();    // stash it off
}

function InitRoot () {  // Build the base root cookie
var i;
  root.coup  = coup;
  root.chkby = off;
  root.stxt0 = "Select Location";
  root.ptxt0 = "Paypal";
  root.discount_amount = 0;
  root.priority_shipping = false;
  root.sales_tax = false;
  root.sales_tax_amount = 0;
  root.discount_cds = 0;
  root.total_cds = 0;
  root.xx_can  = "www.whatifeverything.com/cart.html";
  root.xx_cdmp = off;
  root.xx_cper = 0;
  root.xx_cur  = "USD";
  root.xx_dadd = on;
  root.xx_lc   = "US";
  root.xx_mamt = 0;
  root.xx_mqty = 0;
  root.xx_prt  = on;
  root.xx_ret  = "";
  root.xx_sty  = "";

  for (i=0; i<cats; i++) {
    root["hn" + i]   = 0;             // number of handling brkpts
    root["qd" + i]   = 0;             // number of qty discount
    root["sn" + i]   = 0;             // number of shipping brkpts
    root["av" + i]   = 0;             // number of bkpts
    root["sv" + i]   = 0;             // number of bkpts
    root["wv" + i]   = 0;             // number of bkpts
    root["ct" + 1]   = 0;             // cart amount bkpts
  }
  root.store();
}

function PrintCart (remove) 
{  
  var i;
  var columns = 5;
  tprc = 0;                 // total price of cart
  gtot = 0;                 // Grand total
  ship_tot = 0;                 // Ship total
  sales_tax_amount = 0;

  document.writeln ('<tr align=right class=MAINSTYLE>\n');

  if (remove)
    {
      document.writeln ('<th align=middle>Remove</th>\n');
    }

  document.writeln ('<th align=middle>Amount</th>\n');
  document.writeln ('<th align=left>Description</th>\n');
  document.writeln ('<th>Each</th>\n');
  document.writeln ('<th>Shipping</th>\n');

  if (root.sales_tax == "true")
    {
      document.writeln ('<th>Sales Tax</th>\n');
      columns += 1;
    }

  document.writeln ('<th>Price</th>\n');
  document.writeln ('</tr>\n');

  for (i=1; i<cmax; i++) 
    {  
      cook = new Cookie (document, "paycart" + i);
      cook.load();

      if (cook.qty > 0) { PrintItem (i, remove); }
    }

  tprc = Dollar (tprc)*1.0;             // round, float

  gtot = Dollar (tprc + ship_tot - discount_amount + sales_tax_amount);
  root.store();

  if (!remove)
    {
      columns -= 1;
    }

  if (gtot > 0)
    {
      document.writeln ('<tr align=right>');
      document.writeln ('  <td colspan=', columns - ((root.sales_tax =="true")?2:1), '>');
      document.writeln ('<b>Subtotal</b></td>');
      document.writeln ('<td align = "right" class=MAINSTYLE>', Dollar (ship_tot), '</td>');

      if (root.sales_tax == "true")
	{
          document.writeln ('<td align = "right" class=MAINSTYLE>', Dollar (sales_tax_amount), '</td>');
	}

      document.writeln ('<td align = "right" class=MAINSTYLE>', Dollar (tprc), '</td>', '</tr>');
    }

  document.writeln ('<tr>');
  document.writeln ('<td colspan=', columns, ' align="right" class=MAINSTYLE>');
  document.writeln ('<b>Total</b>');
  document.writeln ('</td>');
  
  document.writeln ('<td align = "right" class=MAINSTYLE>', Dollar(gtot));
  document.writeln ('</td>');

  document.writeln ('</tr>');

  root.store();
}

function PrintItem (i, remove) 
{  
  var tm,t1,t2, ship_amount, tmp, tax_amount;
  document.writeln ('<tr valign = "top" align = "right">');


  if (remove)
    {
      document.writeln ('  <td width=75 align="center">');
      document.writeln ('    <input type  = "checkbox" ');
      document.writeln ('           value = "BOX1"');
      document.writeln ('           onclick = "ClearEntry (', i, ');');
      document.writeln ('                      location.reload ();">');
      document.writeln ('  </td>');

      tmp = "ui_qty" + i;

      document.writeln ('  <td width=75 class=MAINSTYLE align = "center"><input TYPE="text" onchange=qty_change(this) SIZE=1 NAME=', tmp, ' VALUE=', cook.qty, '></td>');
    }
  else
    {
      document.writeln ('  <td width=75 class=MAINSTYLE align = "center">', cook.qty,'</td>');
    }

  document.writeln ('  <td class=MAINSTYLE align = "left">', cook.des,'</td>');

  tm = Dollar (cook.prc);
  t1 = cook.qty*1.0;
  t2 = cook.pcat;
  document.writeln ('  <td width=75 class=MAINSTYLE>', tm,'</td>');

  ship_amount = item_shipping_amount();

  tm = Dollar (ship_amount);
  ship_tot += ship_amount;
  document.writeln ('  <td width=75 class=MAINSTYLE>', tm,'</td>');

  if (root.sales_tax == "true")
    {
      tax_amount = item_tax_amount();

      tm = Dollar (tax_amount);
      sales_tax_amount += tax_amount;
      document.writeln ('  <td width=75 class=MAINSTYLE>', tm,'</td>');
    }

  tm = Dollar (t1*cook.prc);
  tprc = tprc*1.0 + tm*1.0;
  document.writeln ('  <td width=75 class=MAINSTYLE>', tm,'</td>');

  document.writeln ('</tr>');
}

function qty_change(obj)
{
  var i = obj.name.substring(6);
  cook = new Cookie(document, "paycart" + i);
  cook.load();

  if (obj.value <= 0)
    {
      ClearEntry (i);
    }
  else
    {
      cook.qty = obj.value;
      cook.store();
    }
    
  document.location.reload ();
}

function ReadForm (obj1) { //get form data for PayPal
var i,j,obj,temp,pos,val,nam3,nam4;
var qty  = 0;              // default value
var dis  = 0;              // quantity discount
  for (i=0; i<obj1.length; i++) {     // run whole form
    obj = obj1.elements[i];           // ref particular element
    nam3 = obj.name.substring (0, 3); // 3-char name (maybe)
    nam4 = obj.name.substring (3, 4); // where to store it

    if (obj.type == "select-one") {   // dropdowns
      pos = obj.selectedIndex;        // which option selected
      val = obj.options[pos].value;   // get selection
      ChkFlg (val);                   // check for flag char
      if (nam3 == "opt") {            // user says where to store
        Where (val, nam4);            // stash it
      } else {
        AddDesc (val);                // add to data
      }
    } else

    if (obj.type == "select-multiple") {     // one or more
      for (j=0; j<obj.options.length; j++) { // run all options
        if (obj.options[j].selected) {
          val = obj.options[j].value;
          ChkFlg (val);                   // flag chars?
          if (nam3 == "opt") {            // user says where to store
            Where (val, nam4);            // stash it
          } else {
            AddDesc (val);                // add to data
          }
        }
      }
    } else

    if (obj.type == "checkbox" ||    // boxes
        obj.type == "radio") {
      if (obj.checked) {             // was selected
        val = obj.value;
        ChkFlg (val);                // flag chars?
        if (nam3 == "opt") {         // user says where to store
          Where (val, nam4);         // stash it
        } else {
          AddDesc (val);             // add to data
        }
      }
    } else

    if (obj.type == "text") {  // user input fields
      val = obj.value;         // get input
      if (qty == 0) {          // this is 1st time
        qty = val;             // get user input
        if (qty == "" || qty < 1 || isNaN (qty)) {  // test
          alert ("Enter a valid integer quantity!");
          return false;
        }
      } else {
        if (nam3 == "opt") { // user says where to store
          Where (val, nam4); // stash it
        } else {
          AddDesc (val);     // add to data
        }
      }
    }
  }
  if (qty == 0) qty = 1;     // make sure we have something
  blk2q = qty;               // record for posterity

  for (i=an-1; i>=0; i--) {  // qty amount?
    if (qty >= aqty[i]) {    // qty brkpt
      SetPrice (aamt[i]);    // force it
      AddDesc ("AMT");
      break;                 // get out, now
    }
  }

  StoreCart ();
  if (root.xx_dadd == off) return false;  // hide cart display
  return true;
}

function SetCode (cd) { // set product code
  bcode = cd;
}

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

function SetID (strn) {  // set the PayPal ID of this user
  blk2b = strn;
}

function SetImg (strn) {  // set the image for the cart
  imgx = strn;
}

function SetPcat (val) {
  if (val >= cats) {
    alert ("Only " + cats + " product categories allowed!\n\n" +
           "Correct your HTML!");
    return;
  }
  pcat = val;
}

function SetPrice (strn) 
{  
  blk4a = 0;
  AddPrice (strn);
}

function SetRegShip (strn) 
{
  regship = 0;
  regship = Dollar (strn*1.0);
}

function SetIntlShip (strn) 
{
  intlship = 0;
  intlship = Dollar (strn*1.0);
}

function SetPriShip (strn) 
{  
  priship = 0;
  priship = Dollar (strn*1.0);
}

function StoreCart () 
{  
  var i;

  for (i=1; i<cmax; i++) 
    {
      cook = new Cookie(document, "paycart" + i);
      cook.load();

      if (cook.qty*1.0 > 0) 
	{
          if (cook.cod == bcode &&
            cook.des == blk3n &&
            cook.prc*1.0 == blk4a*1.0 &&
            cook.regship*1.0 == regship*1.0 &&
            cook.intlship*1.0 == intlship*1.0 &&
            cook.priship*1.0 == priship*1.0)
	    {
              cook.qty = cook.qty*1.0 + blk2q*1.0;  // combine
              cook.store();
              ClearAll ();
              return;
            }
        }
    }

  for (i=1; i<cmax; i++) 
    {
      cook = new Cookie(document, "paycart" + i);
      cook.load();

      if (cook.qty*1.0 == 0 || isNaN (cook.qty)) 
        {
          cook.pcat = pcat
          cook.qty  = blk2q;
          cook.cod  = bcode;
          cook.des  = blk3n;
          cook.prc  = blk4a;
          cook.imgx = imgx;
          cook.regship = regship;
          cook.priship = priship;
          cook.intlship = intlship;
          cook.store();
          ClearAll ();
          if (i == cmax - 1)
            alert ("Warning - that was your last cookie!");
          return;      
        }
    }

  alert ("Error 1 - out of cookies!");
}

function Where (val, loc) {  // store val at opt[loc]
  if (loc == 1) AddOpt1 (val);
  else          AddOpt2 (val);
}

function Xbild () 
{
  var i,j,k;
  var str  = "";              // string to PayPal
  var tmps = root.stxt0;
  
  j = 0; 

  if (root.stxt0 == "US" && root.priority_shipping == "true")
    {
      tmps += " Priority Shipping";
    }

  for (i=1; i<cmax; i++) 
    {  
      cook = new Cookie (document, "paycart" + i);
      cook.load();

      if (cook.qty > 0) 
        {  
          j++;
          str = str + "&quantity_"    + j + "=" + cook.qty;
          str += "&item_name_"   + j + "=" + escape (cook.des);
          str += "&amount_"      + j + "=" + Dollar (cook.prc*1.0);
	  str += "&shipping_"  + j + "=" + Dollar (item_shipping_amount());

	  str += "&on0_"       + j + "=Shipping";
	  str += "&os0_"       + j + "=" + escape (tmps);
	  str += "&handling_" + j + "=" + escape (Dollar(item_tax_amount()));
        }    
    }

  return str;
}

function check_out()
{
  if (ChkOpts ()) 
    {
      if (root.ptxt0 == "Paypal")
	{
          CallPay();
	}
      else
	{
	  CallPrint();
	}
    }
}

function payment_method(obj) 
  {  
    var pos;

    pos = obj.selectedIndex;  // which option selected
  
    root.ptxt0 = obj.options[pos].text;
    root.store();
  }

function ship_location(obj) 
  {  
    var pos;

    pos = obj.selectedIndex;  // which option selected
  
    root.stxt0 = obj.options[pos].text;
    root.store();
    document.location.reload ();  // show the latest info...
  }

function priority_ship(obj)
  {
    var value;

    value = obj.checked;  // which option selected
    root.priority_shipping = value;
    root.store();
    document.location.reload ();  // show the latest info...
  }

function set_sales_tax(obj)
  {
    var value;

    value = obj.checked;  // which option selected
    root.sales_tax = value;
    root.store();
    document.location.reload ();  // show the latest info...
  }

function LoadIt () 
{
  Cookie.prototype.store  = _Cookie_store;   
  Cookie.prototype.load   = _Cookie_load;
  Cookie.prototype.remove = _Cookie_remove;

  root = new Cookie (document, "paycart0");  // special root cookie

  if (!root.load () || !root.coup) 
    {
      InitRoot ();                  // gotta create it
    } 
  else 
    {                        // load up globals
      coup  = root.coup;
    }
  for (var i=1; i<cmax; i++) 
    {  
      cook = new Cookie (document, "paycart" + i);

      if (!cook.load () || !cook.des) 
        {
          InitData ();              
        }
    }
}

function shipping_options()
{
  document.writeln ('<table><tr><td class=MAINSTYLE><table><tr><td class=MAINSTYLE>');
  document.writeln ('Shipping Location</td><td class=MAINSTYLE><select onchange = "ship_location (this);">');

  if (root.stxt0 == "Select Location") 
    {
      document.writeln ('<option selected>Select Location</option>');
    }
  else
    {
      document.writeln ('<option>Select Location</option>');
    }

  if (root.stxt0 == "US") 
    {
      document.writeln ('<option selected>US</option>');
    }
  else
    {
      document.writeln ('<option>US</option>');
    }

  if (root.stxt0 == "International") 
    {
      document.writeln ('<option selected>International</option>');
    }
  else
    {
      document.writeln ('<option>International</option>');
    }

  document.writeln ('</select></td></tr><tr><td class=MAINSTYLE>');

  if (root.stxt0 == "US") {

///FRANK: 9/22/2006 - Remove the priority shipping option.      
///FRANK:      document.writeln ('Priority Shipping</td><td class=MAINSTYLE>');
      document.writeln ('</td><td class=MAINSTYLE>');
    
      if (root.priority_shipping == "false") {
///FRANK:          document.writeln ('<input type=checkbox value=off onclick="priority_ship(this);">');
      } else {
///FRANK:          document.writeln ('<input type=checkbox checked=true onclick="priority_ship(this);">');
        }

      document.writeln ('</td></tr><tr><td class=MAINSTYLE>California Resident (8.20% Sales Tax)</td><td class=MAINSTYLE>');

      if (root.sales_tax == "false")
        {
          document.writeln ('<input type=checkbox value=off onclick="set_sales_tax(this);">');
        }
      else
        {
          document.writeln ('<input type=checkbox checked=true onclick="set_sales_tax(this);">');
        }
    }
  else
    {
      document.writeln ('<br>');
    }

  document.writeln ('</td></tr></table></td><td class=MAINSTYLE valign=top>');
  document.writeln ('&nbsp;&nbsp;&nbsp;&nbsp;Payment Method <select onchange = "payment_method (this);">');

  if (root.ptxt0 == "Paypal") 
    {
      document.writeln ('<option selected>Paypal</option>');
    }
  else
    {
      document.writeln ('<option>Paypal</option>');
    }

  if (root.ptxt0 == "Check/Cash/MO")
    {
      document.writeln ('<option selected>Check/Cash/MO</option>');
    }
  else
    {
      document.writeln ('<option>Check/Cash/MO</option>');
    }

  document.writeln ('</select></td></tr></table>');
}
