<!-- Begin
var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isOP5 = (navigator.userAgent.indexOf("Opera 5")!=-1) 
		||(navigator.userAgent.indexOf("Opera/5")!=-1) ? true : false;

// Array.indexOf( value, begin, strict ) - Return index of the first element that matches value
Array.prototype.indexOf = function( v, b, s ) {
 for( var i = +b || 0, l = this.length; i < l; i++ ) {
  if( this[i]===v || s && this[i]==v ) { return i; }
 }
 return -1;
};

function getRef(id) {
if (isDOM) return document.getElementById(id);
if (isIE4) return document.all[id];
if (isNS4) return document.layers[id];
}

function getSty(id) {
return (isNS4 ? getRef(id) : getRef(id).style);
} 

// Hide timeout.
var popTimer = 0;
// Array showing highlighted menu items.
var litNow = [];

function popOver(menuNum, itemNum) {
clearTimeout(popTimer);
hideAllBut(menuNum);
litNow = getTree(menuNum, itemNum);
changeCol(litNow, true);
targetNum = menu[menuNum][itemNum].target;
if (targetNum > 0) {
thisX = parseInt(menu[menuNum][0].ref.left) + parseInt(menu[menuNum][itemNum].ref.left);
thisY = parseInt(menu[menuNum][0].ref.top) + parseInt(menu[menuNum][itemNum].ref.top);
with (menu[targetNum][0].ref) {
left = parseInt(thisX + menu[targetNum][0].x);
top = parseInt(thisY + menu[targetNum][0].y);
visibility = 'visible';
      }
   }
}

function popOut(menuNum, itemNum) {
if ((menuNum == 0) && !menu[menuNum][itemNum].target)
hideAllBut(0)
else
popTimer = setTimeout('hideAllBut(0)', 500);
}

function getTree(menuNum, itemNum) {

// Array index is the menu number. The contents are null (if that menu is not a parent)
// or the item number in that menu that is an ancestor (to light it up).
itemArray = new Array(menu.length);

while(1) {
itemArray[menuNum] = itemNum;
// If we've reached the top of the hierarchy, return.
if (menuNum == 0) return itemArray;
itemNum = menu[menuNum][0].parentItem;
menuNum = menu[menuNum][0].parentMenu;
   }
}

// Pass an array and a boolean to specify colour change, true = over colour.
function changeCol(changeArray, isOver) {
for (menuCount = 0; menuCount < changeArray.length; menuCount++) {
if (changeArray[menuCount]) {

with (menu[menuCount][changeArray[menuCount]].ref) {

itemID1 = 'menu' + menuCount + 'item' + changeArray[menuCount];
itemRef1 = getRef(itemID1);
oldClass1 = itemRef1.className;
newClass1 = isOver ? "overStyle" + oldClass1.substring(9) : "normStyle" + oldClass1.substring(9)
itemRef1.className = newClass1;
//itemID2 = 'menu' + menuCount + 'item' + changeArray[menuCount] + 'p';
//if (getRef(itemID2)) {
//itemRef2 = getRef(itemID2);
//oldClass2 = itemRef2.className;
//newClass2 = isOver ? "overStyle" + oldClass2.substring(9) : "menuStyle" + oldClass2.substring(9)
//itemRef2.className = newClass2;
//            }


         }
      }
   }
}

function hideAllBut(menuNum) {
var keepMenus = getTree(menuNum, 1);
for (count = 0; count < menu.length; count++)
if (!keepMenus[count])
menu[count][0].ref.visibility = 'hidden';
changeCol(litNow, false);
}

// *** MENU CONSTRUCTION FUNCTIONS ***

function Menu(isVert, popInd, x, y, width, divClass, linkClass) {
// True or false - a vertical menu?
this.isVert = isVert;
// The popout indicator used (if any) for this menu.
this.popInd = popInd
// Position and size settings.
this.x = x;
this.y = y;
this.width = width;
// The stylesheet class used for item borders and the text within items.
this.divClass = divClass;
this.linkClass = linkClass;
// Parent menu and item numbers, indexed later.
this.parentMenu = null;
this.parentItem = null;
// Reference to the object's style properties (set later).
this.ref = null;
}

function Item(text, href, frame, length, spacing, target, price, defcolor) {
this.text = text;
this.href = href;
this.frame = frame;
this.length = length;
this.spacing = spacing;
this.target = target;
this.price = price;
this.defcolor = defcolor;
// Reference to the object's style properties (set later).
this.ref = null;
}

function writeMenus() {
if (!isDOM && !isIE4 && !isNS4) return;

for (currMenu = 0; currMenu < menu.length; currMenu++) with (menu[currMenu][0]) {
// Variable for holding HTML for items and positions of next item.
var str = '<center>', itemX = 0, itemY = 0;

// Remember, items start from 1 in the array (0 is menu object itself, above).
// Also use properties of each item nested in the other with() for construction.
for (currItem = 1; currItem < menu[currMenu].length; currItem++) with (menu[currMenu][currItem]) {
var itemID = 'menu' + currMenu + 'item' + currItem;
str += '<center>';

// The width and height of the menu item - dependent on orientation!
var w = (isVert ? width : length);
var h = (isVert ? length : width);

// Create a div or layer text string with appropriate styles/properties.
// Thanks to Paul Maden (www.paulmaden.com) for helping debug this in IE4, apparently
// the width must be a miniumum of 3 for it to work in that browser.
if (isDOM || isIE4) {
str += '<div id="' + itemID + '" style="';

if (currMenu==0) { str += 'border-top-width: 2px; border-bottom-width: 2px; '; }
else if (currItem==1) { str += 'border-top-width: 2px; border-bottom-width: 0px; ';  }
else if (currItem==menu[currMenu].length-1) { str += 'border-top-width: 0px; border-bottom-width: 2px; '; }
else { str += ' border-top-width: 0px; border-bottom-width: 0px; '; }

str += 'left: ' + itemX + '; top: ' + itemY + '; width: ' + w + '; height: ' + h + '; visibility: inherit; ';
str += '" ';
}
if (isNS4) {
str += '<layer id="' + itemID + '" left="' + itemX + '" top="' + itemY + '" width="' +  w + '" height="' + h + '" visibility="inherit" ';
}
if (divClass) str += 'class="' + divClass + '" ';

// Determine string to go in status window on mouseover.
var stat = '';
if (currMenu>1 && currMenu!=12) { stat += menu[menu[currMenu][0].parentMenu][menu[currMenu][0].parentItem].text + ':  '; }
if (currMenu==0 && currItem==6) { stat += 'View Cart'; }
else { stat += text; }

// Add mouseover handlers and finish div/layer.
str += 'onClick="location.href=\'' + href + '\'; ';
if(href.substring(0,11)=="merchandise" && location.href.indexOf("merchandise.html") != -1)
{
  str += 'location.reload(true); ';
}
str += 'return true" onMouseOver="window.status=\'' + stat + '\'; popOver(' + currMenu + ',' + currItem + ')" onMouseOut="window.status=\'\'; popOut(' + currMenu + ',' + currItem + ')">';

// Add contents of item (default: table with link inside).
// In IE/NS6+, add padding if there's a border to emulate NS4's layer padding.
// If a target frame is specified, also add that to the <a> tag.

str += '<table width="' + (w - 8) + '" cellspacing=0><tr><td id="' + itemID + 't" style="';

if (currMenu==0)
{
  str += ' padding-left: 0px; padding-right: 0px; text-align: center;';
}
else
{
  str += ' padding-left: 4px; padding-right: 0px; text-align: left;';
}

str += 'height="' + (h - 7) + '" class="menuTD">' + text + '</td>';
if (target > 0) {

// Set target's parents to this menu item.
menu[target][0].parentMenu = currMenu;
menu[target][0].parentItem = currItem;

// Add a popout indicator.
if (popInd) str += '<td id="' + itemID + 'p" height="' + (h - 7) + '" class="menuTD menuPop">' + popInd + '</td>';
}

str += '</tr></table></center>' + (isNS4 ? '</layer></center>' : '</div></center>');
if (isVert) itemY += length + spacing;
else itemX += length + spacing;
}
if (isDOM) {
var newDiv = document.createElement('div');
document.getElementsByTagName('body').item(0).appendChild(newDiv);
newDiv.innerHTML = str;
newDiv.className = 'menuDiv';
ref = newDiv.style;
ref.position = 'absolute';
ref.visibility = 'hidden';
}

// Insert a div tag to the end of the BODY with menu HTML in place for IE4.
if (isIE4) {
document.body.insertAdjacentHTML('beforeEnd', '<div class="menuDiv" id="menu' + currMenu + 'div" ' + 'style="position: absolute; visibility: hidden">' + str + '</div>');
ref = getSty('menu' + currMenu + 'div');
}

// In NS4, create a reference to a new layer and write the items to it.
if (isNS4) {
ref = new Layer(0);
ref.className = "menuDiv";
ref.document.write(str);
ref.document.close();
}

for (currItem = 1; currItem < menu[currMenu].length; currItem++) {
itemName = 'menu' + currMenu + 'item' + currItem;
if (isDOM || isIE4) menu[currMenu][currItem].ref = getSty(itemName);
if (isNS4) menu[currMenu][currItem].ref = ref.document[itemName];
   }

}
with(menu[0][0]) {
ref.left = x;
ref.top = y;
ref.visibility = 'visible';
   }

}

// Syntaxes: *** START EDITING HERE, READ THIS SECTION CAREFULLY! ***
//
// menu[menuNumber][0] = new Menu(Vertical menu? (true/false), 'popout indicator', left, top,
// width, 'mouseover colour', 'background colour', 'border stylesheet', 'text stylesheet');
//
// Left and Top are measured on-the-fly relative to the top-left corner of its trigger, or
// for the root menu, the top-left corner of the page.
//
// menu[menuNumber][itemNumber] = new Item('Text', 'URL', 'target frame', length of menu item,
//  additional spacing to next menu item, number of target menu to popout, price when defined, def color when defined);
//
// If no target menu (popout) is desired, set it to 0. Likewise, if your site does not use
// frames, pass an empty string as a frame target.
//
// Something that needs explaining - the Vertical Menu setup. You can see most menus below
// are 'true', that is they are vertical, except for the first root menu. The 'length' and
// 'width' of an item depends on its orientation -- length is how long the item runs for in
// the direction of the menu, and width is the lateral dimension of the menu. Just look at
// the examples and tweak the numbers, they'll make sense eventually :).

var menu = [];

// Default 'length' of menu items - item height if menu is vertical, width if horizontal.
var defLength = 32;
var defLength2 = 250;
var defLength3 = 140;
var defLength4 = 220;
var defLength5 = 180;
if (isNS4) { defLength = defLength + 3; defLength2 = defLength2 + 3; defLength3 = defLength3 + 3; 
	defLength4 = defLength4 + 3; defLength5 = defLength5 + 3;}

m = 0; n = 1; s = '0' + m;
linkpage = "merchandise.html#"; // add value of 's' to this

// Menu 0 is the special, 'root' menu from which everything else arises.
menu[m] = [];
// A non-vertical menu with a few different colours and no popout indicator, as an example.
// *** MOVE ROOT MENU AROUND HERE ***  it's positioned at (5, 0) and is 17px high now.
menu[m][0] = new Menu(false, '', screen.width/2-428, 15, defLength,  'normStyle', '');
// Notice how the targets are all set to nonzero values...
// The 'length' of each of these items is 40, and there is spacing of 10 to the next item.
// Most of the links are set to '#' hashes, make sure you change them to actual files.
menu[m][1] = new Item('Home', 'index.html', '', 140, 3, 0);
menu[m][2] = new Item('Merchandise', linkpage+'0100', '', 140, 3, n); n = n + 1;
menu[m][3] = new Item('Patterns', linkpage+'0200', '', 140, 3, n); n = n + 1;
menu[m][4] = new Item('Events', 'events.html', '', 140, 3, 0);
menu[m][5] = new Item('Contact', 'contact.html', '', 140, 3, 0);
// Changing this text requires changing the line defining the "stat" string for window status.
menu[m][6] = new Item('<form name="viewcart" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_cart"><input type="hidden" name="business" value="lindastouchofglass@verizon.net">View Cart<input type="hidden" name="display" value="1"><input type="hidden" name="page_style" value="ATouchofGlass">', 'javascript:document.viewcart.submit()', '', 140, 1, 0);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Merchandise Menu (Parent = Root)
menu[m] = [];
menu[m][0] = new Menu(true, '>', 0, defLength-2, defLength2, 'normStyle', '');
menu[m][1] = new Item('Pitchers',linkpage+s+'01','', defLength, 0, n, 39.95); n = n + 1;
menu[m][2] = new Item('Glasses',linkpage+s+'02','', defLength, 0, n); n = n + 1;
menu[m][3] = new Item('Bottles',linkpage+s+'03','', defLength, 0, n); n = n + 1;
menu[m][4] = new Item('Butter Dishes',linkpage+s+'04','', defLength, 0, 0, 14.95);
//menu[m][5] = new Item('Creamers',linkpage+s+'05','', defLength, 0, 0, 16.95);
menu[m][5] = new Item('Salt & Pepper Shakers',linkpage+s+'06','', defLength, 0, n); n = n + 1;
//menu[m][7] = new Item('Sugar Bowls',linkpage+s+'07','', defLength, 0, 0, 16.95);
menu[m][6] = new Item('Cake Dishes',linkpage+s+'08','', defLength, 0, 0, 51.95);
//menu[m][9] = new Item('Cookie Jars',linkpage+s+'09','', defLength, 0, 0, 36.95);
//menu[m][10] = new Item('Ice Buckets',linkpage+s+'10','', defLength, 0, 0, 41.95);
menu[m][7] = new Item('Lamps',linkpage+s+'11','', defLength, 0, 0, 29.95);
m = m + 1; if (m<10) s = '0' + m; else s = '' + m;

// Patterns Menu (Parent = Root)
menu[m] = [];
menu[m][0] = new Menu(true, '>', 0, defLength-2, defLength3,  'normStyle', '');
menu[m][1] = new Item('Flowers',linkpage+s+'01','', defLength, 0, n); n = n + 1;
menu[m][2] = new Item('Fruit',linkpage+s+'02','', defLength, 0, n); n = n + 1;
menu[m][3] = new Item('Varied',linkpage+s+'03','', defLength, 0, n); n = n + 1;
m = m + 1; if (m<10) s = '0' + m; else s = '' + m;

// Pitchers Menu (Parent = Merchandise)
menu[m] = [];
menu[m][0] = new Menu(true, '>', defLength2-2, 0, 170,  'normStyle', '');
menu[m][1] = new Item('Atlantis',linkpage+s+'01','', defLength, 0, 0);
menu[m][2] = new Item('Gallery Decanter',linkpage+s+'02','', defLength, 0, 0);
menu[m][3] = new Item('Vintage',linkpage+s+'03','', defLength, 0, 0);
//menu[m][2] = new Item('Carafe',linkpage+s+'02','', defLength, 0, 0);
//menu[m][3] = new Item('Decanter',linkpage+s+'03','', defLength, 0, 0);
//menu[m][5] = new Item('Impressions',linkpage+s+'05','', defLength, 0, 0);
//menu[m][6] = new Item('Mario',linkpage+s+'06','', defLength, 0, 0);
//menu[m][7] = new Item('Vibe',linkpage+s+'07','', defLength, 0, 0);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Glasses Menu (Parent = Mechandise)
menu[m] = [];
menu[m][0] = new Menu(true, '>', defLength2-2, 0, defLength4,  'normStyle', '');
menu[m][1] = new Item('Beverage Glasses',linkpage+s+'01','', defLength, 0, 0, 15.95);
//menu[m][2] = new Item('Champagne Glasses',linkpage+s+'02','', defLength, 0, n, 15.95); 
n = n + 1;
//menu[m][3] = new Item('Juice Glasses',linkpage+s+'03','', defLength, 0, 0, 13.95);
menu[m][2] = new Item('Margarita Glasses',linkpage+s+'04','', defLength, 0, n, 15.95); n = n + 1;
menu[m][3] = new Item('Martini Glasses',linkpage+s+'05','', defLength, 0, n, 15.95); n = n + 1;
menu[m][4] = new Item('Wine Glasses',linkpage+s+'06','', defLength, 0, n, 15.95); n = n + 1;
menu[m][5] = new Item('Cafe Mugs',linkpage+s+'07','', defLength, 0, 0, 15.95);
//menu[m][8] = new Item('Gourmet Mugs',linkpage+s+'08','', defLength, 0, 0, 15.95);
//menu[m][9] = new Item('Tea Mugs',linkpage+s+'09','', defLength, 0, 0, 15.95);
//menu[m][10] = new Item('Goblets',linkpage+s+'10','', defLength, 0, 0, 15.95);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Bottles Menu (Parent = Merchandise)
menu[m] = [];
menu[m][0] = new Menu(true, '>', defLength2-2, 0, defLength5,  'normStyle', '');
menu[m][1] = new Item('Pump Bottles',linkpage+s+'01','', defLength, 0, n, 19.95); n = n + 1;
//menu[m][2] = new Item('Amber (8 oz.)',linkpage+s+'02','', defLength, 0, 0, 17.95);
//menu[m][3] = new Item('Amber Drop (8 oz.)',linkpage+s+'03','', defLength, 0, 0, 17.95);
menu[m][2] = new Item('Vinegar (8 oz.)',linkpage+s+'04','', defLength, 0, 0, 17.95);
menu[m][3] = new Item('Oil (16 oz.)',linkpage+s+'05','', defLength, 0, 0, 19.95);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Salt & Pepper Shakers Menu (Parent = Merchandise)
menu[m] = [];
menu[m][0] = new Menu(true, '>', defLength2-2, 0, 100,  'normStyle', '');
menu[m][1] = new Item('Round',linkpage+s+'01','', defLength, 0, 0, 14.95);
menu[m][2] = new Item('Square',linkpage+s+'02','', defLength, 0, 0, 14.95);
menu[m][3] = new Item('Mini',linkpage+s+'03','', defLength, 0, 0, 12.95);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Flowers Menu (Parent = Patterns)
menu[m] = [];
menu[m][0] = new Menu(true, '>', defLength3-2, 0, 190,  'normStyle', '');
menu[m][1] = new Item('Bleeding Heart',linkpage+s+'01','', defLength, 0, 0);
menu[m][2] = new Item('Daisy',linkpage+s+'02','', defLength, 0, 0, '', 1);
menu[m][3] = new Item('Geranium',linkpage+s+'03','', defLength, 0, 0, '', 1);
menu[m][4] = new Item('Hydrangea',linkpage+s+'04','', defLength, 0, 0, '', 1);
menu[m][5] = new Item('Impatient',linkpage+s+'05','', defLength, 0, 0, '', 1);
menu[m][6] = new Item('Iris',linkpage+s+'06','', defLength, 0, 0, '', 1);
menu[m][7] = new Item('Pansy',linkpage+s+'07','', defLength, 0, 0, '', 1);
menu[m][8] = new Item('Rose',linkpage+s+'08','', defLength, 0, 0, '', 1);
//menu[m][9] = new Item('Rosebud',linkpage+s+'09','', defLength, 0, 0, '', 1);
//menu[m][10] = new Item('Rose Stripe',linkpage+s+'10','', defLength, 0, 0, '', 1);
menu[m][9] = new Item('Spring Wildflower',linkpage+s+'11','', defLength, 0, 0);
menu[m][10] = new Item('Sunflower',linkpage+s+'12','', defLength, 0, 0);
menu[m][11] = new Item('Violets',linkpage+s+'13','', defLength, 0, 0);
menu[m][12] = new Item('Wildflower',linkpage+s+'14','', defLength, 0, 0);
//menu[m][15] = new Item('Zinnia',linkpage+s+'15','', defLength, 0, 0, '', 1);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Fruit Menu (Parent = Patterns)
menu[m] = [];
menu[m][0] = new Menu(true, '>', defLength3-2, 0, 150,  'normStyle', '');
menu[m][1] = new Item('Apple',linkpage+s+'01','', defLength, 0, 0);
menu[m][2] = new Item('Blueberry',linkpage+s+'02','', defLength, 0, 0);
menu[m][3] = new Item('Cherry',linkpage+s+'03','', defLength, 0, 0);
menu[m][4] = new Item('Grape',linkpage+s+'04','', defLength, 0, 0);
menu[m][5] = new Item('Lemon',linkpage+s+'05','', defLength, 0, 0);
menu[m][6] = new Item('Raspberry',linkpage+s+'06','', defLength, 0, 0);
menu[m][7] = new Item('Strawberry',linkpage+s+'07','', defLength, 0, 0);
menu[m][8] = new Item('Tuscany Fruit',linkpage+s+'08','', defLength, 0, 0);
//menu[m][9] = new Item('Watermelon',linkpage+s+'09','', defLength, 0, 0);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Varied Menu (Parent = Patterns)
menu[m] = [];
menu[m][0] = new Menu(true, '>', defLength3-2, 0, 150,  'normStyle', '');
//menu[m][1] = new Item('Butterfly',linkpage+s+'01','', defLength, 0, 0);
menu[m][1] = new Item('Confetti',linkpage+s+'02','', defLength, 0, 0);
menu[m][2] = new Item('Dragonfly',linkpage+s+'03','', defLength, 0, 0);
//menu[m][4] = new Item('Pastel Garden',linkpage+s+'04','', defLength, 0, 0);
//menu[m][5] = new Item('Plaid',linkpage+s+'05','', defLength, 0, 0);
menu[m][3] = new Item('Retro',linkpage+s+'06','', defLength, 0, 0);
menu[m][4] = new Item('Rings',linkpage+s+'07','', defLength, 0, 0);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Champagne Glasses Menu (Parent = Glasses)
menu[m] = [];
menu[m][0] = new Menu(true, '>', defLength4-2, 0, 110,  'normStyle', '');
//menu[m][1] = new Item('Black',linkpage+s+'01','', defLength, 0, 0);
//menu[m][2] = new Item('Blue',linkpage+s+'02','', defLength, 0, 0);
//menu[m][3] = new Item('Classic',linkpage+s+'03','', defLength, 0, 0);
//menu[m][4] = new Item('Green',linkpage+s+'04','', defLength, 0, 0);
//menu[m][5] = new Item('Pops Flute',linkpage+s+'05','', defLength, 0, 0);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Margarita Glasses Menu (Parent = Glasses)
menu[m] = [];
menu[m][0] = new Menu(true, '>', defLength4-2, 0, 90,  'normStyle', '');
menu[m][1] = new Item('Blue',linkpage+s+'01','', defLength, 0, 0);
menu[m][2] = new Item('Classic',linkpage+s+'02','', defLength, 0, 0);
menu[m][3] = new Item('Green',linkpage+s+'03','', defLength, 0, 0);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Martini Glasses Menu (Parent = Glasses)
menu[m] = [];
menu[m][0] = new Menu(true, '>', defLength4-2, 0, 90,  'normStyle', '');
menu[m][1] = new Item('Blue',linkpage+s+'01','', defLength, 0, 0);
menu[m][2] = new Item('Classic',linkpage+s+'02','', defLength, 0, 0);
menu[m][3] = new Item('Green',linkpage+s+'03','', defLength, 0, 0);
menu[m][4] = new Item('Orange',linkpage+s+'04','', defLength, 0, 0);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Wine Glasses Menu (Parent = Glasses)
menu[m] = [];
menu[m][0] = new Menu(true, '>', defLength4-2, 0, 150,  'normStyle', '');
menu[m][1] = new Item('Black',linkpage+s+'01','', defLength, 0, 0);
menu[m][2] = new Item('Blue Balloon',linkpage+s+'02','', defLength, 0, 0);
menu[m][3] = new Item('Classic Red',linkpage+s+'03','', defLength, 0, 0);
menu[m][4] = new Item('Classic White',linkpage+s+'04','', defLength, 0, 0);
menu[m][5] = new Item('Green Balloon',linkpage+s+'05','', defLength, 0, 0);
menu[m][6] = new Item('Greta',linkpage+s+'06','', defLength, 0, 0);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Pump Bottles Menu (Parent = Bottles)
menu[m] = [];
menu[m][0] = new Menu(true, '>', defLength5-2, 0, 120,  'normStyle', '');
menu[m][1] = new Item('Apothecary',linkpage+s+'01','', defLength, 0, 0);
menu[m][2] = new Item('Biarritz',linkpage+s+'02','', defLength, 0, 0);
menu[m][3] = new Item('Cylinder',linkpage+s+'03','', defLength, 0, 0);
menu[m][4] = new Item('Genie',linkpage+s+'04','', defLength, 0, 0);
menu[m][5] = new Item('Matic',linkpage+s+'05','', defLength, 0, 0);
menu[m][6] = new Item('Pyramid',linkpage+s+'06','', defLength, 0, 0);
menu[m][7] = new Item('Round',linkpage+s+'07','', defLength, 0, 0);
menu[m][8] = new Item('Square',linkpage+s+'08','', defLength, 0, 0);
menu[m][9] = new Item('Triangle',linkpage+s+'09','', defLength, 0, 0);
m = m + 1; if (m<10) s = '0'+m; else s = ''+m;

// Get Menu ID's for Merchandise and Patterns.  Only goes 4 levels deep!
mlist = [];
plist = [];
alist = [];
aind2 = []; aind1 = [];
ia2 = []; ia3 = []; ia1 = []; addlist = [];

mlist = menulist(1);
plist = menulist(2);

// Generate and populate introtext array, picture existence matrix
introtextmat = new Array(mlist.length);
picmat = new Array(mlist.length, plist.length);

// *** OPTIONAL CODE FROM HERE DOWN ***

// These two lines handle the window resize bug in NS4. See <body onResize="...">.
// I recommend you leave this here as otherwise when you resize NS4's width menus are hidden.

var popOldWidth = window.innerWidth;
nsResizeHandler = new Function('if (popOldWidth != window.innerWidth) location.reload()');


// This is a quick snippet that captures all clicks on the document and hides the menus
// every time you click. Use if you want.

if (isNS4) document.captureEvents(Event.CLICK);
document.onclick = clickHandle;

function clickHandle(evt)
{
 if (isNS4) document.routeEvent(evt);
 hideAllBut(0);
}


// This is just the moving command for the example.

function moveRoot()
{
 with(menu[0][0].ref) left = ((parseInt(left) < 100) ? 100 : 5);
}

// Get element height and width for sizing/centering
function getElementHeight(Elem) {
	if (isNS4) {
		var elem = getObjNN4(document, Elem);
		return elem.clip.height;
	} else {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		if (isOP5) { 
			xPos = elem.style.pixelHeight;
		} else {
			xPos = elem.offsetHeight;
		}
		return xPos;
	} 
}

function getElementWidth(Elem) {
	if (isNS4) {
		var elem = getObjNN4(document, Elem);
		return elem.clip.width;
	} else {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		if (isOP5) {
			xPos = elem.style.pixelWidth;
		} else {
			xPos = elem.offsetWidth;
		}
		return xPos;
	}
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}



// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
// you may copy these functions but please keep the copyright notice as well
function pageWidth() 
{
  return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
} 

function pageHeight() 
{
  return window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null ? document.body.clientHeight : null;
}

function posLeft() 
{
  return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
} 

function posTop() 
{
  return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
} 

function posRight() 
{
 return posLeft()+pageWidth();
} 

function posBottom() 
{
  return posTop()+pageHeight();
}
                 
   
// Returns true if object is an array; false otherwise
function isArray(obj) 
{
  if (typeof arguments[0] == 'object') 
  {  
    var criterion = arguments[0].constructor.toString().match(/array/i); 
    return (criterion != null);
  }
return false;
}

// Function for generating thumbnail gallery
function dyngallery()
{
  var picId='bigDynPic';
  var dd=document.getElementsByTagName('div');
  if(!dd){return;}
  for(var j=0;j<dd.length;j++)
  {
    if(dd[j].className=='thumbs')
    {
      d = dd[j];
      d.style.borderWidth = 10;
      var piclinks=d.getElementsByTagName('a');
      for(var i=0;i<piclinks.length;i++)
      {
	if(piclinks[i].src != "000000.gif")
        {
          piclinks[i].onclick=function()
          {
            var oldp = getRef(picId);
            if(oldp)
            {
              oldp.parentNode.removeChild(oldp);
            }
            var nc=document.createElement('div');
            nc.style.display='none';
            nc.id=picId;
            nc.style.top = 10 + posTop();
    	    if(nc.style.top.substring(0,nc.style.top.length-2)<60) { nc.style.top = 60; }
            d.parentNode.insertBefore(nc,d);
            var newpic=document.createElement('img');
            var newsrc=this.getElementsByTagName('img')[0].src;
            newpic.src=newsrc.substring(0,newsrc.length-13)+'1'+newsrc.substring(newsrc.length-12);
            newpic.title=this.getElementsByTagName('img')[0].title;
            newpic.alt=this.getElementsByTagName('img')[0].alt;
            newpic.style.width = '400px';
            newpic.style.height = 'auto';
            nc.appendChild(newpic);
            var nh=document.createElement('h3');
	    nh.className = "small";
            nc.appendChild(nh);
            var ns=document.createElement('span');
            ns.appendChild(document.createTextNode('Close'));
            ns.className = "norm";
            ns.onmouseover=function()
            {
              this.className = "over";
  	      window.status = "Close Window";
  	      return true;
            }
            ns.onmouseout=function()
            {
              this.className = "norm";
	      window.status = "";
	      return true;
            }
            ns.onclick=function()
            {
              this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode);
            }
            nh.appendChild(ns);
            nc.style.display='block';
  	    nc.style.marginLeft = pageWidth()/2-getElementWidth(picId)/2;
            return false;
          }
        }
      }
    }
  }    
}

function findtoploc(topID)
{
  while(topmenu[targetind] != topID)  // Continue until item in top menu (topID) is found
  {
    targetind++;
    topitem[targetind] = menu[topmenu[targetind-1]][0].parentItem;
    topmenu[targetind] = menu[topmenu[targetind-1]][0].parentMenu;
  }
  getRef("title1").appendChild(document.createTextNode(menu[topmenu[targetind]][topitem[targetind]].text));
  if(menu[topmenu[targetind]][topitem[targetind]].price)
  {
    getRef("price1").appendChild(document.createTextNode('$' + menu[topmenu[targetind]][topitem[targetind]].price));
  }
}

function pagegen()
{

// Pull Location Tags, Removing Leading Zeroes
  loc = location.href;
  if(parseInt(loc.substring(loc.length-4,loc.length-3)) == 0)
  {
    locmenu = parseInt(loc.substring(loc.length-3,loc.length-2));
  }
  else
  {
    locmenu = parseInt(loc.substring(loc.length-4,loc.length-2));
  }
  if(parseInt(loc.substring(loc.length-2,loc.length-1)) == 0)
  {
    locitem = parseInt(loc.substring(loc.length-1));
  }
  else
  {
    locitem = parseInt(loc.substring(loc.length-2));
  }
  // Hack to fix menu items not matching the URLs anymore
  checkhref = loc.substring(loc.length-21);
  fixind1 = 1;
  for(fixind1 = 1; fixind1 < menu[locmenu].length; fixind1++)
  {
    if(menu[locmenu][fixind1].href==checkhref)
    {
      hrefitem = locitem;
      locitem = fixind1;
      fixind1 = menu[locmenu].length;
    }
  }
// If Menu Loc = 1 and Item Loc = 0 then top-level merch page clicked/displayed
  if(locmenu == 1 && locitem == 0)
  {
    mlength1 = menu[1].length - 1;
    getRef("title1").appendChild(document.createTextNode('Merchandise'));
    str1 = 'There are ' + mlength1;
    str1 = str1 + ' different categories of items currently available.  Please select your category ';
    str1 = str1 + 'in order to view different items.';
    getRef("intro1").appendChild(document.createTextNode(str1));
    getRef("intro1").style.textAlign = "center";
    for(im1 = 1; im1 <= mlength1; im1++)
    {
      getRef("title2").parentNode.style.marginBottom = "20px";
      newtitle1 = document.createElement('H2');
      newtitle1.className = 'tablenorm';
      newtext1 = document.createElement('span');
      newtext1.appendChild(document.createTextNode(menu[1][im1].text));
      newtext1.text = menu[1][im1].text;
      newtext1.href = menu[1][im1].href;
      newtext1.onmouseover=function()
      {
        this.className = "tableover";
	window.status = this.text;
      }
      newtext1.onmouseout=function()
      {
        this.className = "tablenorm";
	window.status = "";
      }
      newtext1.onclick=function()
      {
        location.href = this.href;
        location.reload(true);
      }
      newtitle1.appendChild(newtext1);
      getRef("title2").parentNode.insertBefore(newtitle1,getRef("title2"));
    }
    getRef("footer").style.display = 'none';
  }
// If Menu Loc = 2 and Item Loc = 0 then top-level pat page clicked/displayed
  else if(locmenu == 2 && locitem == 0)
  {
    mlength2 = menu[2].length - 1;
    getRef("title1").appendChild(document.createTextNode('Patterns'));
    str2 = 'There are ' + mlength2;
    str2 = str2 + ' different categories of patterns.  Please select your category ';
    str2 = str2 + 'in order to view different patterns.';
    getRef("intro1").appendChild(document.createTextNode(str2));
    getRef("intro1").style.textAlign = "center";
    for(im2 = 1; im2 <= mlength2; im2++)
    {
      getRef("title2").parentNode.style.marginBottom = "20px";
      newtitle2 = document.createElement('H2');
      newtitle2.className = 'tablenorm';
      if(mlength2 == 3)
      {
        newtitle2.style.width = "33%";
      }
      newtext2 = document.createElement('span');
      newtext2.appendChild(document.createTextNode(menu[2][im2].text));
      newtext2.text = menu[2][im2].text;
      newtext2.href = menu[2][im2].href;
      newtext2.onmouseover=function()
      {
        this.className = "tableover";
	window.status = this.text;
      }
      newtext2.onmouseout=function()
      {
        this.className = "tablenorm";
	window.status = "";
      }
      newtext2.onclick = function()
      {
        location.href = this.href;
        location.reload(true);
      }
      newtitle2.appendChild(newtext2);
      getRef("title2").parentNode.insertBefore(newtitle2,getRef("title2"));
    }
    getRef("footer").style.display = 'none';
  }
// If Menu Loc is in mlist, generate merchandise page and bottom merch link
  else if(mlist.indexOf(locmenu) != -1)
  {
    footlink1 = document.createElement("a");
    footlink1.href = "#";
    footlink1.onmouseover = function()
    {
      window.status = "Merchandise Listing";
      return true;
    }
    footlink1.onmouseover = function()
    {
      window.status = "";
      return true;
    }
    footlink1.onclick = function()
    {
      location.href = "merchandise.html#0100";
      location.reload(true);
    }
    footlink1.appendChild(document.createTextNode("Merchandise"));
    getRef("link2").parentNode.insertBefore(footlink1,getRef("link2"));
    topmenu = []; topitem = []; targetind = 0;
    topmenu[targetind] = locmenu; topitem[targetind] = locitem;
    findtoploc(mlist[0]);
    it2 = []; menutarget = []; dspmenu = []; dspitem = [];
    menutarget[targetind] = menu[locmenu][locitem].target; 
    dspmenu[targetind] = locmenu; dspitem[targetind] = locitem;
    titlegen(1);
  }
// If Menu Loc is in plist, generate patterns page and bottom patts link
  else if(plist.indexOf(locmenu) != -1)
  {
    footlink1 = document.createElement("a");
    footlink1.href = "#";
    footlink1.onmouseover = function()
    {
      window.status = "Patterns Listing";
      return true;
    }
    footlink1.onmouseover = function()
    {
      window.status = "";
      return true;
    }
    footlink1.onclick = function()
    {
      location.href = "merchandise.html#0200";
      location.reload(true);
    }
    footlink1.appendChild(document.createTextNode("Patterns"));
    getRef("link2").parentNode.insertBefore(footlink1,getRef("link2"));
    introtext1 = "Select your desired item and color below. ";
    introtext1 += "If a sample picture is available, click on it to view a larger version. ";
    introtext1 += "Remember to visit the ";
    getRef("intro1").appendChild(document.createTextNode(introtext1));
    introlink = document.createElement("a");
    introlink.href = "special01.html";
    introlink.onmouseover=function()
    {
      window.status = "Special Offer!";
      return true;
    }
    introlink.onmouseout=function()
    {
      window.status = "";
      return true;
    }
    introlink.appendChild(document.createTextNode("Special Offer"));
    getRef("intro1").appendChild(introlink);
    introtext2 = " page to purchase sets of items at a reduced price.";
    getRef("intro1").appendChild(document.createTextNode(introtext2));
    topmenu = []; topitem = []; targetind = 0;
    topmenu[targetind] = locmenu; topitem[targetind] = locitem;
    findtoploc(plist[0]);
    it2 = []; menutarget = []; dspmenu = []; dspitem = [];
    menutarget[targetind] = menu[locmenu][locitem].target; 
    dspmenu[targetind] = locmenu; dspitem[targetind] = locitem;
    titlegen(0);
  }
// Otherwise, generate top-level merchandise page
  else
  {
    location.href="merchandise.html#0100";
    location.reload(true);
  }
  dyngallery();
}

// Append titles/prices for items
function titlegen(ism)
{
  // If menu has subitems, generate full list
  if(menutarget[targetind] != 0)
  {
    for(it2[targetind] = 1; it2[targetind] < menu[menutarget[targetind]].length; it2[targetind] = it2[targetind] + 1)
    {
        targetind++;
        dspmenu[targetind] = menutarget[targetind-1];
        dspitem[targetind] = it2[targetind-1];
        menutarget[targetind] = menu[dspmenu[targetind]][dspitem[targetind]].target;
        titlegen(ism);
        targetind--;
    }
  }
  // If menu has no subitems, print title/price/div
  else 
  {
    // If lone item is in topmenu, skip title
    if(topmenu[topmenu.length-1] != dspmenu[targetind])
    {
      title2text = ''; title2price = '';
      // If 2+ levels deep, print preface text in title
      if(targetind > 1)
      {
        for(it4 = topmenu.length - 2; it4 > 0; it4--)
        {
          title2text += menu[topmenu[it4]][topitem[it4]].text + ':  ';
          if(menu[topmenu[it4]][topitem[it4]].price)
          {
            title2price = '$' + menu[topmenu[it4]][topitem[it4]].price;
          }
        }
        // Get parent menus and put text into title, pull price if exists
        it3start = (topmenu.length > 1) ? topmenu.length - 1 : 1;
        for(it3 = it3start; it3 < targetind; it3++)
        {
          title2text += menu[dspmenu[it3]][dspitem[it3]].text + ':  ';
          if(menu[dspmenu[it3]][dspitem[it3]].price)
          {
            title2price = '$' + menu[dspmenu[it3]][dspitem[it3]].price;
          }
        }
      }
      title2text += menu[dspmenu[targetind]][dspitem[targetind]].text;
      newtitle2 = document.createElement('H2');
      newtitle2.className = "nospace";
      newtitle2.appendChild(document.createTextNode(title2text));
      if(menu[dspmenu[targetind]][dspitem[targetind]].price)
      {
        title2price = '$' + menu[dspmenu[targetind]][dspitem[targetind]].price;
      }
      newprice2 = document.createElement('H3');
      newprice2.className = "nospace";
      newprice2.appendChild(document.createTextNode(title2price));
      newdiv2 = document.createElement('div');
      newdiv2.className = "header";
      newdiv2.appendChild(newprice2);
      newdiv2.insertBefore(newtitle2,newprice2);
      getRef("title2").parentNode.parentNode.insertBefore(newdiv2, getRef("title2").parentNode);
    }
    thumbsgen(dspmenu[targetind], dspitem[targetind], ism);
  }
}

function thumbsgen(menuID, itemID, isM)
{
  // Hack to fix menu items not matching the URLs anymore
  arrayitemID = itemID;
  checkhref2 = menu[menuID][itemID].href;
  checkhref2 = parseInt(checkhref2.substring(checkhref2.length-2));
  itemID = checkhref2;
  menustr = '';
  if(menuID < 10)
  {
    menustr += '0' + menuID;
  }
  else
  {
    menustr += '' + menuID;
  }
  itemstr = '';
  if(itemID < 10)
  {
    itemstr += '0' + itemID;
  }
  else
  {
    itemstr += '' + itemID;
  }
  if(isM) // Merchandise page, display patterns thumbs div
  {
    newthumbs = document.createElement('div');
    newthumbs.className = 'thumbs';
    newdivider = document.createElement('div');
    newthumbs.appendChild(newdivider);
    // For loop for each sub-div-image
    for(ith1 = 0; ith1 < plist.length; ith1++)
    {
      for(ith2 = 1; ith2 < menu[plist[ith1]].length; ith2++)
      {
        if(menu[plist[ith1]][ith2].target == 0) // end-item; display image if it exists
        {
          newdivimg = document.createElement('div');
	  newdivimg.className = "thumbnail";
          newdivpar1 = document.createElement('p');
          newdivpar1.className = "nospace";
          newdivlink = document.createElement('a');
          newdivlink.src = "#";
          newdivlink.onmouseover = function()
          {
            window.status = this.firstChild.title;
            return true;
          }
          newdivlink.onmouseout = function()
          {
            window.status = "";
            return true;
          }
	  imgstr = '0' + menustr + itemstr;
	  patstr = ''
	  if(plist[ith1] < 10)
	  {
	    patstr += '0' + plist[ith1];
	  }
	  else
	  {
	    patstr += '' + plist[ith1];
	  }
	  if(ith2 < 10)
	  {
	    patstr += '0' + ith2;
	  }
	  else
	  {
	    patstr += '' + ith2;
	  }
          imgstr += patstr + '.gif';
          newimg = document.createElement('img');
          newimg.onerror = function()  // Show X mark, move image to end
          {
            this.src = "000000.gif";
	    var thumbref = this.parentNode.parentNode.parentNode;
	    // Remove thumbnail zoom-in link
	    var thisref = this.cloneNode(true);
	    this.parentNode.parentNode.appendChild(thisref);
	    this.parentNode.parentNode.removeChild(this.parentNode);
	    // Put thumbnail at end of list
	    var thumbref2 = thumbref.cloneNode(true);
	    thumbref.parentNode.appendChild(thumbref2);
	    thumbref.parentNode.removeChild(thumbref);
          }
          newimg.src = imgstr;
	  newimg.title = menu[plist[ith1]][ith2].text;
	  newimg.alt = menu[plist[ith1]][ith2].text;
          newdivpar2 = document.createElement('h3');
          newdivpar2.className = "small";
          newdivpar2.appendChild(document.createTextNode(menu[plist[ith1]][ith2].text));
	  newdivlink.appendChild(newimg);
	  newdivpar1.appendChild(newdivlink);
	  // Insert cart form and color box and cart button
	  newform = document.createElement('div');
	  newform.className = "thumbsform";
	  formstr = '<form name="cart' + patstr + '" target="paypal" ';
 	  formstr += 'action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	  formstr += '<input type="hidden" name="add" value="1">';
	  formstr += '<input type="hidden" name="cmd" value="_cart">';
	  formstr += '<input type="hidden" name="business" value="lindastouchofglass@verizon.net">';
	  formstr += '<input type="hidden" name="os0" value="' + menu[plist[ith1]][ith2].text + '">';
	  formstr += '<input type="hidden" name="page_style" value="ATouchofGlass">';
	  formstr += '<input type="hidden" name="currency_code" value="USD">';
	  formstr += '<input type="hidden" name="lc" value="US">';
	  // Populate price
	  if(getRef("price1").firstChild)
	  {
	    pricetag = getRef("price1").firstChild.nodeValue;
	  }
	  else
	  {
	    pricetag = getRef("title2").parentNode.previousSibling.childNodes[1].firstChild.nodeValue;
	  }
	  pricetag = pricetag.substring(1);
	  formstr += '<input type="hidden" name="amount" value="' + pricetag + '">';
	  formstr += '<input type="hidden" name="item_number" value="' + menustr + itemstr + patstr + '">';
	  itemname = getRef("title1").firstChild.nodeValue;
	  // If item is not on the top menu or has subitems, add subtitle(s) to item name
	  if(topmenu[topmenu.length-1] != menuID)
	  {
	    itemname += ":  " + getRef("title2").parentNode.previousSibling.firstChild.firstChild.nodeValue;
	  }
	  formstr += '<input type="hidden" name="item_name" value="' + itemname + '">';
	  formstr += '<input type="hidden" name="on0" value="Pattern">';
	  formstr += '<input type="hidden" name="on1" value="Color">';
	  formstr += '<table class="inthumbs"><tr><td>Color: </td>';
	  // Enable color input and populate with default color if defined
	  if(menu[plist[ith1]][ith2].defcolor)
	  {
	    formstr += '<td><input type="text" class="coloredbox" name="os1" value="';
//	    formstr += menu[plist[ith1]][ith2].defcolor;
	    formstr += 'Choose Color';
	  }
	  else
	  {
	    formstr += '<td><input type="text" disabled class="coloredbox" name="os1" value="';
	    formstr += menu[plist[ith1]][ith2].text;
	  }
	  formstr += '" size=15 maxlength=100></td></tr></table>';
	  formstr += '<h3 class="smaller">';
	  formstr += '<span class="norm" ';
	  formstr += 'onmouseover="this.className=\'over\'; window.status=\'Add to Cart\'; return true;" ';
	  formstr += 'onmouseout="this.className=\'norm\'; window.status=\'\'; return true;" ';
	  formstr += 'onclick="this.parentNode.parentNode.submit();">Add to Cart</span></h3>';
	  formstr += '</form>';
	  newform.innerHTML = formstr;
	  newdivimg.appendChild(newform);
	  newdivimg.insertBefore(newdivpar2, newform);
	  newdivimg.insertBefore(newdivpar1, newdivpar2);
	  newthumbs.insertBefore(newdivimg,newdivider);
        }
      }
    }
    getRef("title2").parentNode.parentNode.insertBefore(newthumbs, getRef("title2").parentNode);
    newdivclr = document.createElement('div');
    newdivclr.className = "clearer";
    newdivclr.appendChild(document.createTextNode(""));
    getRef("title2").parentNode.parentNode.insertBefore(newdivclr, getRef("title2").parentNode);
    newimghr = document.createElement('img');
    newimghr.src = "rainbowbar.jpg";
    newimghr.className = "hr";
    getRef("title2").parentNode.parentNode.insertBefore(newimghr, getRef("title2").parentNode);
  }
  else    // Patterns page, display merchandise thumbs div
  {
    newthumbs = document.createElement('div');
    newthumbs.className = 'thumbs';
    newdivider = document.createElement('div');
    newthumbs.appendChild(newdivider);
    // For loop for each sub-div-image
    for(ith1 = 0; ith1 < mlist.length; ith1++)
    {
      for(ith2 = 1; ith2 < menu[mlist[ith1]].length; ith2++)
      {
        if(menu[mlist[ith1]][ith2].target == 0) // end-item; display image if it exists
        {
	  // Generate caption for image (item name with higher level categories)
	  itemname = menu[mlist[ith1]][ith2].text;
	  if(ith1 != 0)
	  {
	    itemname = menu[menu[mlist[ith1]][0].parentMenu][menu[mlist[ith1]][0].parentItem].text + ':  ' + itemname;
	  }
	  // Populate price
	  pricetag = findprice(mlist[ith1],ith2);
          newdivimg = document.createElement('div');
	  newdivimg.className = "thumbnail";
          newdivpar1 = document.createElement('p');
          newdivpar1.className = "nospace";
          newdivlink = document.createElement('a');
          newdivlink.src = "#";
          newdivlink.onmouseover = function()
          {
            window.status = this.firstChild.title;
            return true;
          }
          newdivlink.onmouseout = function()
          {
            window.status = "";
            return true;
          }
	  imgstr = '0';
	  patstr = ''
	  if(mlist[ith1] < 10)
	  {
	    patstr += '0' + mlist[ith1];
	  }
	  else
	  {
	    patstr += '' + mlist[ith1];
	  }
	  if(ith2 < 10)
	  {
	    patstr += '0' + ith2;
	  }
	  else
	  {
	    patstr += '' + ith2;
	  }
          imgstr += patstr + menustr + itemstr + '.gif';
          newimg = document.createElement('img');
          newimg.onerror = function()  // Show X mark, move image to end
          {
            this.src = "000000.gif";
	    var thumbref = this.parentNode.parentNode.parentNode;
	    // Remove thumbnail zoom-in link
	    var thisref = this.cloneNode(true);
	    this.parentNode.parentNode.appendChild(thisref);
	    this.parentNode.parentNode.removeChild(this.parentNode);
	    // Put thumbnail at end of list
	    var thumbref2 = thumbref.cloneNode(true);
	    thumbref.parentNode.appendChild(thumbref2);
	    thumbref.parentNode.removeChild(thumbref);
          }
          newimg.src = imgstr;
	  newimg.title = menu[mlist[ith1]][ith2].text;
	  newimg.alt = menu[mlist[ith1]][ith2].text;
          newdivpar2 = document.createElement('h3');
          newdivpar2.className = "small";
	  newdivpar2.style.whiteSpace = "nowrap";
          newdivpar2.appendChild(document.createTextNode(itemname));
          newdivpar3 = document.createElement('h3');
          newdivpar3.className = "smaller";
          newdivpar3.appendChild(document.createTextNode('$' + pricetag));
	  newdivlink.appendChild(newimg);
	  newdivpar1.appendChild(newdivlink);
	  // Insert cart form and color box and cart button
	  newform = document.createElement('div');
	  newform.className = "thumbsform";
	  formstr = '<form name="cart' + patstr + '" target="paypal" ';
 	  formstr += 'action="https://www.paypal.com/cgi-bin/webscr" method="post">';
	  formstr += '<input type="hidden" name="add" value="1">';
	  formstr += '<input type="hidden" name="cmd" value="_cart">';
	  formstr += '<input type="hidden" name="business" value="lindastouchofglass@verizon.net">';
	  formstr += '<input type="hidden" name="os0" value="' + menu[menuID][arrayitemID].text + '">';
	  formstr += '<input type="hidden" name="page_style" value="ATouchofGlass">';
	  formstr += '<input type="hidden" name="currency_code" value="USD">';
	  formstr += '<input type="hidden" name="lc" value="US">';
	  formstr += '<input type="hidden" name="amount" value="' + pricetag + '">';
	  formstr += '<input type="hidden" name="item_number" value="' + patstr + menustr + itemstr + '">';
	  formstr += '<input type="hidden" name="item_name" value="' + itemname + '">';
	  formstr += '<input type="hidden" name="on0" value="Pattern">';
	  formstr += '<input type="hidden" name="on1" value="Color">';
	  formstr += '<table class="inthumbs"><tr><td>Color: </td>';
	  // Enable color input and populate with default color if defined
	  if(menu[menuID][arrayitemID].defcolor)
	  {
	    formstr += '<td><input type="text" class="coloredbox" name="os1" value="';
//	    formstr += menu[menuID][arrayitemID].defcolor;
	    formstr += 'Choose Color';
	  }
	  else
	  {
	    formstr += '<td><input type="text" disabled class="coloredbox" name="os1" value="';
	    formstr += menu[menuID][arrayitemID].text;
	  }
	  formstr += '" size=15 maxlength=100></td></tr></table>';
	  formstr += '<h3 class="smaller">';
	  formstr += '<span class="norm" ';
	  formstr += 'onmouseover="this.className=\'over\'; window.status=\'Add to Cart\'; return true;" ';
	  formstr += 'onmouseout="this.className=\'norm\'; window.status=\'\'; return true;" ';
	  formstr += 'onclick="this.parentNode.parentNode.submit();">Add to Cart</span></h3>';
	  formstr += '</form>';
	  newform.innerHTML = formstr;
	  newdivimg.appendChild(newform);
	  newdivimg.insertBefore(newdivpar3, newform);
	  newdivimg.insertBefore(newdivpar2, newdivpar3);
	  newdivimg.insertBefore(newdivpar1, newdivpar2);
	  newthumbs.insertBefore(newdivimg,newdivider);
        }
      }
    }
    getRef("title2").parentNode.parentNode.insertBefore(newthumbs, getRef("title2").parentNode);
    newdivclr = document.createElement('div');
    newdivclr.className = "clearer";
    newdivclr.appendChild(document.createTextNode(""));
    getRef("title2").parentNode.parentNode.insertBefore(newdivclr, getRef("title2").parentNode);
    newimghr = document.createElement('img');
    newimghr.src = "rainbowbar.jpg";
    newimghr.className = "hr";
    getRef("title2").parentNode.parentNode.insertBefore(newimghr, getRef("title2").parentNode);
  }
}

// Finds price for each menu item in pattern page item thumbs generation; see thumbsgen()
function findprice(pricemenu, priceitem)
{
  if(menu[pricemenu][priceitem].price)
  {
    return menu[pricemenu][priceitem].price;
  }
  else
  {
    return findprice(menu[pricemenu][0].parentMenu, menu[pricemenu][0].parentItem);
  }
}

// Function to generate form for menu list
function menulist(ind)
{
  alist[ind] = [];
  alist[ind][0] = ind;
  aind2[ind] = 1;
  for(ia2[ind] = 1; ia2[ind] < menu[ind].length; ia2[ind] = ia2[ind] + 1)
  {
    if(menu[ind][ia2[ind]].target != 0)
    {
      alist[ind][aind2[ind]] = menu[ind][ia2[ind]].target;
      aind2[ind] = aind2[ind] + 1;
      addlist[ind] = menulist(menu[ind][ia2[ind]].target);
      for(ia3[ind] = 1; ia3[ind] < addlist[ind].length; ia3[ind] = ia3[ind] + 1)
      {
        alist[ind][aind2[ind]] = addlist[ind][ia3[ind]];
        aind2[ind] = aind2[ind] + 1;
      }
    }
  }
  return alist[ind];
}


function repospop()
{
  var picId='bigDynPic';
  var picDiv = getRef(picId);
  if(picDiv)
  {
    picDiv.style.marginLeft = pageWidth()/2-getElementWidth(picId)/2;
//    picDiv.style.display='block';
  }
}

// Set document title for every page

document.title = "A Touch of Glass - Hand-Painted Glassware - Pitchers Glasses Bottles and More!";

// Write gallery once page has loaded
window.onload=function()
{
  // Load the Menus
//  setTimeout('writeMenus()',1);
  writeMenus();
  if(document.getElementById && document.createTextNode)
  {
    if(location.href.indexOf('merchandise.html')!=-1)
    {
      pagegen();  
    }
    else if(location.href.indexOf('special02.html')!=-1)
    {
      dyngallery();
    }
  }
  document.getElementsByTagName('body')[0].onmouseover = function()
  {
    repospop();
  }
}
window.onresize = function()
{
    nsResizeHandler();
}


//  End -->
