<!--
// each page has a number (passed as pageNum and used in pageData)
// ===============================================================
// 0 = Home (Index)      5 = Body                10 = Lips
// 1 = Bath              6 = Face                11 = Hair
// 2 = Bath Accessories  7 = Hands & Feet        12 = Gift Baskets
// 3 = Soap              8 = Perfume             13 = Etcetera
// 4 = Brochure (PDF)    9 = Fragrance/Scent


// number of pages accessed in the navTable (total entries may be higher)
// also used as page number (pageNum used for navTable highlight)
  var numPages = 14;

// number of elements per page:
// 0. navTable cell colour (highlight = lilac, others = pale yellow)
// 1. link text in navTable
// 2. html filename
// 3. cell (column) width
// 4. page title in header
  var numEls = 5;

// first dimension of array (ie: one row per page)
  var pageData = new Array(numPages);
  
// second array dimension (ie: one column per page element)
  for(i=0; i<numPages; i++)
    pageData[i] = new Array(numEls);

// build one data record in the array
var pageCount = 0;
function addData(){
  pageData[pageCount][0] = "#FEFEF4";  // all cell backgrounds pale yellow  
  for(var i=1; i<numEls; i++)
    pageData[pageCount][i] = arguments[i-1];
  pageCount = pageCount + 1;
}

// build the Header and navTable
function majaHeader(pageNum){
// Populate array with data for navTable
  addData("Home","index.html","90","Welcome");
  addData("Bath","bath.html","90","<br>Bath<br>Products");
  addData("Bath Accessories","bathacc.html","180","<br>Bath<br>Accessories");
  addData("Soap","soap.html","100","Soap");
  addData("Brochure (pdf)","'CM_Brochure.pdf' target='brochure'","180","Brochure");
  addData("Body","body.html","90","<br>Body<br>Products");
  addData("Face","face.html","90","<br>Facial Care<br>Products");
  addData("Hands &amp; Feet","handsfeet.html","180","Hands &amp; Feet");
  addData("Perfume","perfume.html","100","Perfume");
  addData("Fragrance List","scent.html","180","<br>Fragrance<br>Selection");
  addData("Lips","lips.html","90","Lip Balm");
  addData("Hair","hair.html","90","<br>Hair Care<br>Products");
  addData("Gift Baskets","basket.html","180","<br>Gift<br>Baskets");
  addData("Etcetera","etcetera.html","100","Etcetera");

// build the Header
  document.write('<body background="../Thumbnail/bubbles2.jpg" topmargin=0 leftmargin=0 rightmargin=0>');
  document.write('<center><table width=640><tr><td><table align="center" border=0 cellspacing=0 cellpadding=0>');
  document.write('<tr><td height=200 rowspan=3 valign="center">');
  document.write('<img width=260 height=156 src="../Thumbnail/creationsmaja.gif"></td>');
  document.write('<td colspan=2 height=30></td></tr>');
  document.write('<tr><td align="center" valign="center" width=200 height=120>');
  document.write('<p class="cmHeader"><b>' + pageData[pageNum][4] + '</b></td>');
  document.write('<td width=200><p class="cmRegular"><b>Les Cr&eacute;ations Maja</b><br>');
  document.write('<font class="cmSmall">4583 Beaconsfield Avenue<br>Montreal, QC &nbsp; &nbsp; H4A 2H8<br>(514) 756-1967<br>');
  document.write('<a href="mailto:info@creationsmaja.com?Subject=Regarding%20your%20website...">info@creationsmaja.com</a>');
  document.write('</font></td></tr><tr><td align="center" height=60><img src=../Thumbnail/canadamade.gif></td>');
  document.write('<td><p class="cmSmlBold">All prices are in<br>Canadian dollars.</td></tr></table>');

// lilac background in navTable cell for current page
  pageData[pageNum][0] = "#FEE4F4";

// Build the navTable
  document.write('<p><table class="cmRegBold" border=1><tr>');
  for(i=0; i<numPages; i++){
    document.write('<td align="center" bgcolor=' +pageData[i][0]+ ' width='+pageData[i][3]);
    document.write('><a href=' +pageData[i][2]+ '>' +pageData[i][1]+ '</a></td>');
    if(i == 4 || i == 9){document.write('</tr><tr>')}
  }
  document.write('<td align="center" bgcolor="#FEFEF4">');
  document.write('<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">');
  document.write('<input type="hidden" name="cmd" value="_cart">');
  document.write('<input type="hidden" name="business" value="creationsmaja@vdn.ca">');
  document.write('<input type="image" src="../Thumbnail/vCart.gif" name="submit" alt="PayPal - fast, free and secure!">');
  document.write('<input type="hidden" name="display" value="1"></td></form></tr></table>');
}

// build one data record in the Product Table array
var x = 0;
function fillArray(){
  prodData[x] = new Array(numChars);
  for(var y=0; y<numChars; y++)
    prodData[x][y] = arguments[y];
  x = x + 1;
}

// build the Product Table
function buildProdTable(){
  document.write('<form name="maja">');
  document.write('<p><table width=640 cellpadding=5 border=1 bgcolor="#FEFEF4">');
  for(i=0; i<numProds; i++){
    var pickSz = i+"pick";
    document.write('<tr class="cmRegBold"><td width=500 valign=top>' +prodData[i][0]);
    document.write('<br><font class="cmSmall">' +prodData[i][1]+ '</font></td>');
    document.write('<td width=140 class="cmSmall" align="left" valign="top">');
    var jcount = prodData[i][2] * 2;
    for(j=0; j<jcount; j+=2){
      document.write('<input type="radio" name="pickSize" onClick="loadSize()">');
      document.write(prodData[i][j+3]+ ' ... $' +prodData[i][j+4]);
      if(j<jcount){
        document.write('<br>');
      }
    }
    document.write('</td></tr>');
  }
  document.write('</table></form>');
}

// radio button selects product size (and price)
function loadSize(){
  var sPick, prodName, prodSize, prodPrice, sizeid, priceid;
  var prodid = 0;
  var subcount = 0;
  var maxcount = 0;

  // maxcount = total items on page (all products, all sizes)
  for (cprod = 0; cprod < numProds; cprod++){
    maxcount += prodData[cprod][2];
  }

  // begin radio search
  for (pcount=0; pcount < maxcount; pcount++){
    if (document.maja.pickSize[pcount].checked == true){
      sPick = pcount;
    }
  }

  // create variables used in product identification from radio button selection
  maxcount = 0;
  for (cprod = 0; cprod < numProds; cprod++){
    maxcount += prodData[cprod][2];
    if (maxcount <= sPick){
      subcount = maxcount;
      prodid = cprod + 1;
    }
  }
  sizenum = sPick - subcount;
  sizeid = (sizenum * 2) + 3;
  priceid = (sizenum * 2) + 4;  

  prodName = prodData[prodid][0];
  prodSize = prodData[prodid][sizeid];
  prodPrice = prodData[prodid][priceid];

  pageString = "paypal.html?&#33;="+prodName+"&#38;&#35;="+prodSize+"&#38;&#36;="+prodPrice;
    // +"&#38;&#42;="+cfSelect;
    newWindow(pageString);
}

// popup order selection window
function newWindow(mypage){
  if(screen.width){
    var winl = (screen.width-640)/2;
    var wint = (screen.height-220)/2;
  }
  else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + 220 + ',';
  settings += 'width=' + 640 + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += 'screenX=' + wint + ',';
  settings += 'screenY=' + winl + ',';
  win = window.open(mypage,'ordwin',settings,'copyhistory=no');
  win.window.focus();
}

// copyright
function majaFooter(){
  document.write('<p align="center"><img src="../Thumbnail/eyeline2.gif">');
  document.write('<p><table border=0 class="cmSmall"><tr height=30><td width=100></td>');
  document.write('<td width=440 align="center" valign="top">&copy; 2009, Les Cr&eacute;ations Maja</td>');
  document.write('<td width=100></a></td></tr></table></td></tr></table><br></center></body></html>');
}
//-->
