function product() {
   var i, fp=6; //fp = first price!
   this.reference = product.arguments[0];
   this.short_name = product.arguments[1];
   this.description = product.arguments[2];
   this.product_type = product.arguments[3];
   this.url = product.arguments[4];
   this.weight = product.arguments[5];
/*
   this.url = this.reference+".htm";
   if (this.product_type.charAt(2) == 'D') {
      this.url = this.reference.substr(0, 3)+"XX.htm";
   }
*/
   this.quantities = new Array();
   this.prices = new Array();
   for (i=fp; i<product.arguments.length; i+=2) {
      this.quantities[(i-fp)/2]=product.arguments[i];
	  this.prices[(i-fp)/2]=product.arguments[i+1];
   }
//   this.GetPrice = GetPrice;
}

var pkgWeight = 25;

var product_list = new Array();

product_list['CONXX'] = new product("CONXX", "pPlug", "DIY round plug for traditional Garmin GPS", "PXG", "#liste", 3.50, 0, 4.50, 3, 4.00, 10, 3.75, 25, 3.50, 50, 3.00, 100, 2.75);
product_list['CONBK'] = new product("CONBK", "pPlug", "pPlug DIY connector, black", "PXD", "../../pf/connect.htm#dyi", 3.50, 0, 4.50, 3, 4.00, 10, 3.75, 25, 3.50, 50, 3.00, 100, 2.75);
product_list['CONPU'] = new product("CONPU", "pPlug", "pPlug DIY connector, purple/blue (exact color may vary between batches)", "PXD", "../../pf/connect.htm#dyi", 3.50, 0, 4.50, 3, 4.00, 10, 3.75, 25, 3.50, 50, 3.00, 100, 2.75);
product_list['CONYL'] = new product("CONYL", "pPlug", "pPlug DIY connector, yellow", "PXD", "../../pf/connect.htm#dyi", 3.50, 0, 4.50, 3, 4.00, 10, 3.75, 25, 3.50, 50, 3.00, 100, 2.75);
product_list['COEBK'] = new product("COEBK", "ePlug", "DIY rectangular plug for eTrex/eMap", "EHX", "../../pf/connect.htm#dyi", 3.50, 0, 5.50, 3, 5.00, 10, 4.50, 25, 4.00, 50, 3.50, 100, 3.00);
product_list['COEPU'] = new product("COEPU", "ePlug II", "DIY thin plug for eTrex/eMap", "EHX", "http://pfranc.com/projects/e2Plug/index.htm", 3.50, 0, 5.50, 3, 5.00, 10, 4.50, 25, 4.00, 50, 3.50, 100, 3.00);
product_list['CORBK'] = new product("CORBK", "rPlug", "DIY plug for Rino", "RHX", "http://pfranc.com/projects/rPlug/index.htm", 3.50, 0, 4.50, 3, 4.00, 10, 3.75, 25, 3.50, 50, 3.00, 100, 2.75);
//product_list['PDA04'] = new product("PDA04", "BA-i38", "Adapter for iPaq 22xx, 38xx, 39xx, 41xx, 54xx, 55xx Pocket PCs (works with eCombo and pCombo)", "AXX", "http://pfranc.com/cgi-bin/P/BA_i38", 25, 0, 12);
//product_list['ASED1'] = new product("ASED1", "eD1", "PowerReady data cable for eTrex/eMap", "EHX", "http://pfranc.com/cgi-bin/P/eD1", 47, 0, 17);
product_list['ASEP3'] = new product("ASEP3", "eP3", "3V Power cable (straight) for eTrex/eMap", "EHX", "http://pfranc.com/cgi-bin/P/eP3", 74, 0, 19);
product_list['ASEP6'] = new product("ASEP6", "ePC6", "3V Power cable (coiled) for eTrex/eMap", "EHX", "http://pfranc.com/cgi-bin/P/ePC6", 82, 0, 20);
product_list['ASECB'] = new product("ASECB", "eCombo", "Combo power and data cable for eTrex/eMap", "EHX", "http://pfranc.com/cgi-bin/P/eCombo", 87, 0, 29);
//product_list['SEI38'] = new product("SEI38", "eCombo-PDA", "Combines an eCombo cable and a BA-i38 adapter (data transfer + power to both devices)", "EHX", "#liste", 112, 0, 38);
product_list['ASP3M'] = new product("ASP3M", "p3M6F", "Power inserter for eD1/pD32 with simultaneous data capability", "XHX", "http://pfranc.com/cgi-bin/P/P3M6F", 87, 0, 20);
//product_list['SEMAX'] = new product("SEMAX", "eMax", "Set of power and data cables for eTrex/eMap", "EHX", "http://pfranc.com/cgi-bin/P/eMax", 134, 0, 34);
//product_list['ASP32'] = new product("ASP32", "pD32", "PowerReady data cable for traditional Garmin GPS", "PHX", "http://pfranc.com/cgi-bin/P/pD32", 47, 0, 17);
product_list['ASP12'] = new product("ASP12", "P12M", "Power inserter for pD32 (no data capability)", "PHX", "http://pfranc.com/cgi-bin/P/P12M", 33, 0, 7);
product_list['ASPC3'] = new product("ASPC3", "pCombo32", "Combo power and data cable for traditional Garmin GPS", "PHX", "http://pfranc.com/cgi-bin/P/pCombo32", 104, 0, 29);
//product_list['SPI38'] = new product("SPI38", "pCombo-PDA", "Combines a pCombo cable and a BA-i38 adapter (data transfer + power to both devices)", "PHX", "#liste", 129, 0, 38);
//product_list['SPMAX'] = new product("SPMAX", "pMax", "Set of power and data cables for traditional Garmin GPS (simultaneous)", "PHX", "http://pfranc.com/cgi-bin/P/pMax", 134, 0, 34);
//product_list['ASP08'] = new product("ASP08", "pD8", "PowerReady data cable for GPS 12, 38, 40", "PLX", "http://pfranc.com/cgi-bin/P/pD8", 47, 0, 17);
product_list['AP812'] = new product("AP812", "P8-12M", "8V Power inserter for pD8 above (no data capability)", "PLX", "http://www.pfranc.com/cgi-bin/P/P812M", 43, 0, 10);
//product_list['ASPC8'] = new product("ASPC8", "pCombo8", "Combo power and data cable for GPS 12, 38, 40", "PLX", "http://pfranc.com/cgi-bin/P/pCombo8", 107, 0, 29);
product_list['DB9ME'] = new product("DB9ME", "DB9F", "DB9F RS232 Plug, with metal body", "AXX", "../../pf/connect.htm#DB9", 51, 0, 5);
//product_list['AUSB4'] = new product("AUSB4", "USB-G4", "USB-to-serial converter, with drivers mini-CD (Win, Mac)", "AXX", "http://pfranc.com/cgi-bin/P/USB_G4", 49, 0, 34);
//product_list['ASEBT'] = new product("ASEBT", "ePBT", "<em>Bluetooth</em><sup>&reg;</sup> data + power cable for Garmin 'e' models", "EHX", "http://pfranc.com/cgi-bin/P/ePBT", 140, 0, 79);
//product_list['ASPBT'] = new product("ASPBT", "pPBT", "<em>Bluetooth</em><sup>&reg;</sup> data + power cable for Garmin 'p' models", "PHX", "http://pfranc.com/cgi-bin/P/pPBT", 140, 0, 79);
product_list['CABSW'] = new product("CABSW", "SCable", "4-core cable, white", "AXX", "../../pf/connect.htm#sCable", 21, 0, 0.5);
//product_list['CABTH'] = new product("CABTH", "TCable", "Thin, 4-core cable, black (recommended for ePlug II)", "AXX", "#liste", 11, 0, 1.2);


function check_pt(p, features) {
   var i, a, b, isOK;

   isOK = true;
   
   for (i=0; i < features.length; i++) {
      a = p.product_type.charAt(i);
	  b = features.charAt(i);
      isOK = isOK && ((a == 'X') || (b == 'X') || (a == b));
   }
   return(isOK);  
}

function GetPrice(p, q) {
   var i;
   
   i = p.quantities.length-1;
   while (q < p.quantities[i]) {
      i--;
   }
   return(p.prices[i]);
}
