/*
**
**  Copyright (c) 1997-2005 by Sniglets, Inc., all rights reserved.
**
**  Usage, duplication, and/or modification of this program, its
**  representation, or its results without written permission from
**  Sniglets, Inc. is expressly prohibited.
**
**  $Id: sniglets-blinds.js,v 1.33 2005/05/15 01:13:17 john Exp $
**
*/

if (navigator.appVersion.substring(0, 1) < 4)
  alert("\n\nPlease note that you are using a version 3.0 browser." +
    "While we made every effort to make this page compatible with " +
    "version 3.0 browsers, it does make extensive use of JavaScript, " +
    "which probably won't work correctly in version 3.0 browsers.  For " +
    "this reason, we encourage you to upgrade your browser as soon as " +
    "possible.\n\nNetscape upgrades can be downloaded for free at " +
    "www.netscape.com/download.\nMicrosoft Internet Explorer upgrades " +
    "can be downloaded for free from www.microsoft.com/ie/.\n\nIf you " +
    "experience troubles with this form due to using a version 3.0 " +
    "browser, please call us toll-free at 1-XXX-XXX-XXXX and we will " +
    "help you with your order via telephone. We apologize for any " +
    "inconvenience this may cause!");

function sniglets_blinds_to_hex(s)
{
  var hexes, o, i;

  hexes = '0123456789abcdef';
  o = '';
  for (i = 0; i < s.length; i++)
    o += hexes.charAt((s.charCodeAt(i) >> 4) & 0x0F) +
      hexes.charAt(s.charCodeAt(i) & 0x0F);
  return o;
}

function sniglets_blinds_go()
{
  var f, e, v, si, i_option, i_product, i_color, price, description, s, v,
    product_width, product_length;

  f = document.forms['order_form'];
  i_product = parseInt(f.elements['form_type'].value);
  if (i_product < 0)
  {
    alert('Please select pattern group.');
    return;
  }
  sb_product = sb_products[i_product];

  i_color = Math.floor(f.elements['form_color'].value);
  if (i_color < 0)
  {
    alert('Please select a product color.');
    return;
  }

  price = sniglets_blinds_calculate();
  if (price <= 0)
  {
    alert('Please enter your dimensions.');
    return;
  }

  product_width = parseInt(f.elements['form_width_int'].value);
  e = f.elements['form_width_frac'];
  if (e.value != 'even')
    product_width += eval(e.value);
  product_length = parseInt(f.elements['form_length_int'].value);
  e = f.elements['form_length_frac'];
  if (e.value != 'even')
    product_length += eval(e.value);

  description = '';
  description += sb_product['name'];
  description += ', ' + f.elements['form_color'].value + ' color';
  description += ', ' + product_width + ' inches wide by ' +
    product_length + ' inches in length';

  for (var i_option = 0; i_option < sb_options.length; i_option++)
  {
    sb_option = sb_options[i_option];
    e = f.elements['form_' + sb_option['label']];
    if (sb_option['type'] == 'select')
    {
      v = e.value;
      si = e.selectedIndex;
    }
    else if (sb_option['type'] == 'radio')
    {
      v = '';
      for (si = 0; si < e.length; si++)
        if (e[si].checked)
	{
	  v = e[si].value;
	  break;
	}
      if (si >= e.length)
        si = -1;
    }
    else if (sb_option['type'] == 'checkbox')
    {
      v = (e.checked) ? 'yes' : 'no';
      si = (e.checked) ? 1 : 0;
    }
    else if (sb_option['type'] == 'text')
    {
      v = e.value;
      si = (v) ? 1 : 0;
    }
    else if (sb_option['type'] == 'internal')
    {
      continue;
    }
    s = '';
    eval(sb_option['script_check']);
    if (s)
    {
      alert(s);
      return;
    }
    eval(sb_option['script_string']);
    if (s == 'error')
      return;
    description += s;
  }

  s = '';
  eval(sb_config['script_check']);
  if (s)
  {
    alert(s);
    return;
  }

  description += '.';
  v = f.elements['form_comments'].value;
  if (v.length > 0)
    description += '  Comments: ' + v;

  document.forms['store_form'].elements['eidp'].value =
    sniglets_blinds_to_hex("new\t" + description + "\t" + (price / 100.0));
  document.forms['store_form'].elements['quantity'].value =
    f.elements['form_quantity'].value;
  document.forms['store_form'].submit();
//  alert(description);

  return true;
}

function sniglets_blinds_go_product()
{
  var i_product;

  i_product = parseInt(document.forms['order_form'].elements['form_type'].value);
  if (i_product < 0)
    return;
  if (window.location != top.location)
    window.location = sb_products[i_product]['url'];
  else
    top.location = sb_products[i_product]['url'];
}

function sniglets_blinds_zero()
{
  var f, ec;
  f = document.forms['order_form'];
  f.elements['form_price'].value = '$0.00';
  f.elements['form_total'].value = '$0.00';
  for (var i_option = 0; i_option < sb_options.length; i_option++)
  {
    sb_option = sb_options[i_option];
    if (sb_option['script_price'])
    {
      ec = f.elements['form_' + sb_option['label'] + '_charge'];
      if (ec)
        ec.value = 'N/A';
    }
  }
  return 0.0;
}

function sniglets_blinds_dollar_format(x)
{
  var o, d, c;

  if ((x == '') || (x <= 0))
    return '$0.00';
  d = Math.floor(x / 100.0);
  c = x % 100;
  o = '$' + d + '.';
  return o + ((c < 10) ? '0' : '') + c;
}

function sniglets_blinds_calculate()
{
  var e, el, ec, f, v, si, p, i_product, a_prices, product_length, product_width,
    quantity, i_w, i_l, i, total, price, upcharge, e_l, e_w;

  f = document.forms['order_form'];
  i_product = parseInt(f.elements['form_type'].value);
  if (i_product < 0)
    return sniglets_blinds_zero();
  sb_product = sb_products[i_product];

  e = f.elements['form_width_int'];
  el = f.elements['form_length_int'];
  if ((e.value == '') || (el.value == ''))
    return sniglets_blinds_zero();
  product_width = parseInt(e.value);
  product_length = parseInt(el.value);
  if (isNaN(product_width) || (product_width < 1))
  {
    alert('The width must be a valid whole number.');
    e.value = 0;
    f.elements['form_width_frac'].selectedIndex = 0;
    return sniglets_blinds_zero();
  }
  e = f.elements['form_width_frac'];
  if (e.value != 'even')
    product_width += eval(e.value);
  if (product_width < sb_product['width_minimum'])
  {
    f.elements['form_width_int'].value = sb_product['width_minimum'];
    e.selectedIndex = 0;
    alert('The product is not available for widths under ' +
      sb_product['width_minimum'] + ' inches!');
    return sniglets_blinds_zero();
  }

if (product_width > sb_product['width_single'])
  {
    f.elements['form_width_int'].value = sb_product['width_single'];
    e.selectedIndex = 0;
    alert('You are receiving this message because the width you just entered exceeds the manufacturer\'s recommendation for a single blind. As a result, the manufacturer recommends that you split the total width into 2 or 3 separate blinds all sharing a common valance.\n\nFirst, measure the total width - the individual width of each blind when added together, should equal the total width.\n\nAssuming you have multiple windows in a single large opening that are separated by a mullion or wood partition/divider - start left and measure to the center of the first mullion for the width of your first blind. Then, measure from the center of this mullion to the center of the second mullion if you have 3 windows or the right wall if you have only 2 blinds.\n\nWhen you place your order you will specify the width of the common valance in the note\'s section of each blind to be covered by the valance and request that the slats be aligned (i.e. common valance for lines 1, 2 & 3 at 84 inches wide/align slats).\n\nNOTE: common valances over 90\" wide may be spliced. Spliced valances are two pieces that are both cut at a 45-degree angle on one end so they can be joined together upon installation.\n\nMaximum Single Blind Width: ' + sb_product['width_single'] + '\"');
    return sniglets_blinds_zero();
  }

e_l = f.elements['form_length_frac'];
  if (e_l.value != 'even')
    product_length += eval(e_l.value);
e_w = f.elements['form_width_frac'];
  if (e_w.value != 'even')
    product_width += eval(e_w.value);

if ((product_length > sb_product['length_single_2']) && (product_width > sb_product['width_single_1']))
  {
    f.elements['form_width_int'].value = sb_product['width_single_1'];
    f.elements['form_length_int'].value = sb_product['length_single_2'];
    e_l.selectedIndex = 0;
    e_w.selectedIndex = 0;
    el.selectedIndex = 0;
    e.selectedIndex = 0;
    alert('You are receiving this message because the dimensions you just entered exceeds the manufacturer\'s recommendation for a single blind. As a result, the manufacturer recommends that you split the total width into 2 or 3 separate blinds all sharing a common valance.\n\nFirst, measure the total width - the individual width of each blind when added together, should equal the total width.\n\nAssuming you have multiple windows in a single large opening that are separated by a mullion or wood partition/divider - start left and measure to the center of the first mullion for the width of your first blind. Then, measure from the center of this mullion to the center of the second mullion if you have 3 windows or the right wall if you have only 2 blinds.\n\nWhen you place your order you will specify the width of the common valance in the note\'s section of each blind to be covered by the valance and request that the slats be aligned (i.e. common valance for lines 1, 2 & 3 at 84 inches wide/align slats).\n\nNOTE: common valances over 90\" wide may be spliced. Spliced valances are two pieces that are both cut at a 45-degree angle on one end so they can be joined together upon installation.\n\nMaximum Single Blind Length for width ' + sb_product['width_single_1'] + '\" is ' + sb_product['length_single_2'] + '\"');
    return sniglets_blinds_zero();
  }

if ((product_length > sb_product['length_single_2']) && (product_width > sb_product['width_single_2']))
  {
    f.elements['form_length_int'].value = sb_product['length_single_2'];
    e_l.selectedIndex = 0;
    e_w.selectedIndex = 0;
    el.selectedIndex = 0;
//    f.elements['form_width_int'].value = sb_product['width_single_2'];
//    e.selectedIndex = 0;
    alert('You are receiving this message because the dimensions you just entered exceeds the manufacturer\'s recommendation for a single blind. As a result, the manufacturer recommends that you split the total width into 2 or 3 separate blinds all sharing a common valance.\n\nFirst, measure the total width - the individual width of each blind when added together, should equal the total width.\n\nAssuming you have multiple windows in a single large opening that are separated by a mullion or wood partition/divider - start left and measure to the center of the first mullion for the width of your first blind. Then, measure from the center of this mullion to the center of the second mullion if you have 3 windows or the right wall if you have only 2 blinds.\n\nWhen you place your order you will specify the width of the common valance in the note\'s section of each blind to be covered by the valance and request that the slats be aligned (i.e. common valance for lines 1, 2 & 3 at 84 inches wide/align slats).\n\nNOTE: common valances over 90\" wide may be spliced. Spliced valances are two pieces that are both cut at a 45-degree angle on one end so they can be joined together upon installation.\n\nMaximum Single Blind Length for width ' + f.elements['form_width_int'].value + '\" is ' + sb_product['length_single_2'] + '\"');
    return sniglets_blinds_zero();
  }
  if ((product_length > sb_product['length_single_3']) && (product_width > sb_product['width_single_3']))
  {
    f.elements['form_length_int'].value = sb_product['length_single_3'];
    e_l.selectedIndex = 0;
    e_w.selectedIndex = 0;
    el.selectedIndex = 0;
//    f.elements['form_width_int'].value = sb_product['width_single_2'];
//    e.selectedIndex = 0;
    alert('You are receiving this message because the dimensions you just entered exceeds the manufacturer\'s recommendation for a single blind. As a result, the manufacturer recommends that you split the total width into 2 or 3 separate blinds all sharing a common valance.\n\nFirst, measure the total width - the individual width of each blind when added together, should equal the total width.\n\nAssuming you have multiple windows in a single large opening that are separated by a mullion or wood partition/divider - start left and measure to the center of the first mullion for the width of your first blind. Then, measure from the center of this mullion to the center of the second mullion if you have 3 windows or the right wall if you have only 2 blinds.\n\nWhen you place your order you will specify the width of the common valance in the note\'s section of each blind to be covered by the valance and request that the slats be aligned (i.e. common valance for lines 1, 2 & 3 at 84 inches wide/align slats).\n\nNOTE: common valances over 90\" wide may be spliced. Spliced valances are two pieces that are both cut at a 45-degree angle on one end so they can be joined together upon installation.\n\nMaximum Single Blind Length for width ' + f.elements['form_width_int'].value + '\" is ' + sb_product['length_single_3'] + '\"');
    return sniglets_blinds_zero();
  }

if (product_width > sb_product['width_maximum'])
  {
    f.elements['form_width_int'].value = sb_product['width_maximum'];
    e.selectedIndex = 0;
    alert('The product is not available for widths over ' +
      sb_product['width_maximum'] + ' inches!');
    return sniglets_blinds_zero();
  }
/*
e_l = f.elements['form_length_frac'];
  if (e_l.value != 'even')
    product_length += eval(e_l.value);
*/
if (product_length < sb_product['length_minimum'])
  {
    f.elements['form_length_int'].value = sb_product['length_minimum'];
    el.selectedIndex = 0;
    e_l.selectedIndex = 0;
    alert('The product is not available for lengths under ' +
      sb_product['length_minimum'] + ' inches!');
    return sniglets_blinds_zero();
  }
if (product_length > sb_product['length_maximum'])
  {
    f.elements['form_length_int'].value = sb_product['length_maximum'];
    el.selectedIndex = 0;
    e_l.selectedIndex = 0;
    alert('The product is not available for lengths over ' +
      sb_product['length_maximum'] + ' inches!');
    return sniglets_blinds_zero();
  }

e = f.elements['form_length_int'];
  if (e.value == '')
    return sniglets_blinds_zero();
  product_length = parseInt(e.value);
  if (isNaN(product_length) || (product_length < 1))
  {
    alert('The length must be a valid whole number.');
    e.value = 0;
    f.elements['form_length_frac'].selectedIndex = 0;
    return sniglets_blinds_zero();
  }


/*
e = f.elements['form_length_frac'];
  if (e.value != 'even')
    product_length += eval(e.value);
  if (product_length < sb_product['length_minimum'])
  {
    f.elements['form_length_int'].value = sb_product['length_minimum'];
    e.selectedIndex = 0;
    alert('The product is not available for lengths under ' +
      sb_product['length_minimum'] + ' inches!');
    return sniglets_blinds_zero();
  }
  if (product_length > sb_product['length_maximum'])
  {
    f.elements['form_length_int'].value = sb_product['length_maximum'];
    e.selectedIndex = 0;
    alert('Please contact us for lengths over ' +
      sb_product['length_maximum'] + ' inches!');
    return sniglets_blinds_zero();
  }
*/

  e = f.elements['form_quantity'];
  quantity = parseInt(e.value);
  if (isNaN(quantity) || (quantity < 1))
  {
    alert('The quantity must be a valid whole number.');
    e.value = 1;
    return sniglets_blinds_zero();
  }

  i_w = -1;
  for (i = 0; i <= sb_product['widths'].length; i++)
  {
    if (product_width <= sb_product['widths'][i])
    {
      i_w = i;
      break;
    }
  }
  if (i_w < 0)
  {
    f.elements['form_width_int'].value = sb_product['width_minimum'];
    f.elements['form_width_frac'].selectedIndex = 0;
    return sniglets_blinds_zero();
  }
  i_l = -1;
  for (i = 0; i <= sb_product['lengths'].length; i++)
  {
    if (product_length <= sb_product['lengths'][i])
    {
      i_l = i;
      break;
    }
  }
  if (i_l < 0)
  {
    f.elements['form_length_int'].value = sb_product['length_minimum'];
    f.elements['form_length_frac'].selectedIndex = 0;
    return sniglets_blinds_zero();
  }
  i = i_l * sb_product['widths'].length + i_w;
  a_prices = sb_product['prices'];
  price = a_prices[i];
  if (price < 0)
  {
    alert('Please contact us for sizes over ' + sb_product['widths'][i_w] +
      ' inches wide by ' + sb_product['lengths'][i_l] + ' inches in length.');
    f.elements['form_width_int'].value = '';
    f.elements['form_length_int'].value = '';
    return sniglets_blinds_zero();
  }
  price = Math.floor(price * 100.0);

  upcharge = 0;
  for (var i_option = 0; i_option < sb_options.length; i_option++)
  {
    sb_option = sb_options[i_option];
    if (!sb_option['script_price'])
      continue;
    e = f.elements['form_' + sb_option['label']];
    ec = f.elements['form_' + sb_option['label'] + '_charge'];
    if (sb_option['type'] == 'select')
    {
      v = e.value;
      si = e.selectedIndex;
    }
    else if (sb_option['type'] == 'radio')
    {
      v = '';
      for (si = 0; si < e.length; si++)
        if (e[si].checked)
	{
	  v = e[si].value;
	  break;
	}
      if (si >= e.length)
        si = -1;
    }
    else if (sb_option['type'] == 'checkbox')
    {
      v = (e.checked) ? 'yes' : 'no';
      si = (e.checked) ? 1 : 0;
    }
    else if (sb_option['type'] == 'text')
    {
      v = e.value;
      si = (v) ? 1 : 0;
    }
    else if (sb_option['type'] == 'internal')
    {
      continue;
    }
    p = -1;
    eval(sb_option['script_price']);
    if (p < 0)
    {
      if (ec)
        ec.value = 'N/A';
    }
    else
    {
      if (ec)
        ec.value = sniglets_blinds_dollar_format(p);
      upcharge += p;
    }
  }

  price += upcharge;
  f.elements['form_price'].value = sniglets_blinds_dollar_format(price);
  total = price * quantity;
  f.elements['form_total'].value = sniglets_blinds_dollar_format(total);
  return price;
}

function sniglets_blinds_change_type()
{
  var f, i_product, a_colors, i_color, i_select, i;

  f = document.forms['order_form'];
  i_product = parseInt(f.elements['form_type'].value);

  i_select = f.elements['form_color'].length;
  for (i = i_select - 1; i >= 0; i--)
	   f.elements['form_color'].options[i] = null;

  i_select = 0;
  if (i_product >= 0)
  {
    if (!sb_config['product_color_list_box'])
      f.elements['form_color'].options[i_select++] =
        new Option('Please select.', -1);
    a_colors = sb_products[i_product]['colors'];
    for (i_color = 0; i_color < a_colors.length; i_color += 4)
    {
      f.elements['form_color'].options[i_select] =
        new Option(a_colors[i_color], a_colors[i_color].toLowerCase());
      f.elements['form_color'].options[i_select].style.backgroundColor =
        a_colors[i_color + 2];
      f.elements['form_color'].options[i_select].style.color =
        a_colors[i_color + 1];
      f.elements['form_color'].options[i_select].src =
        a_colors[i_color + 3];
		i_select++;
    }
  }

else
    f.elements['form_color'].options[i_select++] =
      new Option('Please select.', -1);

  f.elements['form_comments'].value = '';
  f.elements['form_quantity'].value = 1;

  sniglets_blinds_calculate();
  return true;
}

function sniglets_blinds_startup()
{
  var i_product, i_select, i_tape;

  if (sb_products.length > 1)
  {
    i_select = 0;
    if (!sb_config['product_type_list_box'])
      document.forms['order_form'].elements['form_type'].options[i_select++] =
	new Option('Please select.', -1);
    for (i_product = 0; i_product < sb_products.length; i_product++)
      document.forms['order_form'].elements['form_type'].options[i_select++] =
	new Option(sb_products[i_product]['name'], i_product);
  }
  else
    document.forms['order_form'].elements['form_type'].value = 0;
  sniglets_blinds_change_type();
}

function sniglets_blinds_output_form(mode)
{
  var i, j, output;

  output = '<form name="order_form" action="javascript:;"><table class="sniglets_blinds_order">\n';

  for (i = 0; i < sb_options.length; i++)
  {
    sb_option = sb_options[i];
    if ((sb_option['type'] == 'internal') &&
      (sb_option['label'] == 'separator'))
    {
      output += '<tr><td class="sniglets_blinds_separator" colspan="3">' + sb_option['name'] + '</td></tr>\n';
      continue;
    }
    output += '<tr><th>' + sb_option['name'] + ':</th><td' +
      (sb_option['script_price'] ? '>' : ' colspan="2">');
    switch (sb_option['type'])
    {
      case 'select':
	output += '<select class="sniglets_blinds_select" name="form_' +
	  sb_option['label'] + '" onchange="sniglets_blinds_calculate();">\n';
	if (sb_option['options_color'])
	  for (j = 0; j < sb_option['options'].length; j += 4)
	    output += '<option style="background: ' +
	      sb_option['options'][j + 3] + '; color: ' +
	      sb_option['options'][j + 2] + '" value="' +
	      sb_option['options'][j + 1] + ((j == 0) ? '" selected>' : '">') +
	      sb_option['options'][j] + '</option>\n';
	else
	  for (j = 0; j < sb_option['options'].length; j += 2)
	    output += '<option value="' + sb_option['options'][j + 1] +
	      ((j == 0) ? '" selected>' : '">') + sb_option['options'][j] +
	      '</option>\n';
	output += '</select>\n';
	break;
      case 'radio':
	for (j = 0; j < sb_option['options'].length; j += 2)
	  output += 
	    '<input class="sniglets_blinds_radio" type="radio" name="form_' +
	    sb_option['label'] + '" value="' + sb_option['options'][j + 1] +
	    '" onchange="sniglets_blinds_calculate();">' +
	    sb_option['options'][j] + '&nbsp;&nbsp;\n';
	break;
      case 'checkbox':
        output += 
	  '<input class="sniglets_blinds_checkbox" type="checkbox" name="form_'
	  + sb_option['label'] + '" onclick="sniglets_blinds_calculate();">\n';
	break;
      case 'text':
        output += 
	  '<input class="sniglets_blinds_checkbox" type="text" name="form_' +
	  sb_option['label'] + '" onchange="sniglets_blinds_calculate();">\n';
	break;
      case 'internal':
        switch (sb_option['label'])
	{
	  case 'product':
	    if (sb_products.length != 1)
	      output += '<select class="sniglets_blinds_select" name="form_type" onchange="sniglets_blinds_change_type();"' + (sb_config['product_type_list_box'] ? ' size="' + sb_config['product_type_list_box'] + '"' : '') + '></select>\n';
	    else
	      output += sb_products[0]['name'] +
		'<input type="hidden" name="form_type" value="0">\n';
	    output += '<a class="sniglets_blinds_jump" href="javascript:sniglets_blinds_go_product();">Product Description</a>\n';
	    break;
	  case 'color':
            output += '<select class="sniglets_blinds_select" name="form_color"' + (sb_config['product_color_list_box'] ? ' size="' + sb_config['product_color_list_box'] + '"' : '') + '></select><br>Colors represented on your monitor may differ from actual product colors.  Please request samples before ordering to confirm color shades, if needed.\n';
	    break;
	  case 'width':
	  case 'length':
	    output += '<input class="sniglets_blinds_input" type="text" name="form_' + sb_option['label'] + '_int" onchange="sniglets_blinds_calculate();" maxlength="4" size="4"/>&nbsp;<select class="sniglets_blinds_select" name="form_' + sb_option['label'] + '_frac" onchange="sniglets_blinds_calculate();">\n';
	    output += '<option value="0" selected>even</option>\n';
	    output += '<option value="1/8">1/8</option>\n';
	    output += '<option value="1/4">1/4</option>\n';
	    output += '<option value="3/8">3/8</option>\n';
	    output += '<option value="1/2">1/2</option>\n';
	    output += '<option value="5/8">5/8</option>\n';
	    output += '<option value="3/4">3/4</option>\n';
	    output += '<option value="7/8">7/8</option>\n';
	    output += '</select>&nbsp;inches\n';
	    break;
	  case 'comments':
            output += '<input class="sniglets_blinds_input" type="text" name="form_comments" size="40" maxlength="250"/>\n';
	    break;
	  case 'quantity':
            output += '<input class="sniglets_blinds_input" align="right" name="form_quantity" onchange="sniglets_blinds_calculate();" size="4" maxlength="4" value="1"/>\n';
	    break;
	  case 'price':
            output += '<input type="text" class="sniglets_blinds_calculated" align="right" name="form_price" size="10" maxlength="10" value="$0.00"/> per blind, <input type="text" class="sniglets_blinds_calculated" align="right" name="form_total" size="10" maxlength="10" value="$0.00"/> total.\n';
	    break;
	  case 'submit':
            output += '<input class="sniglets_blinds_button" type="button" value="ADD TO CART" onclick="javascript:sniglets_blinds_go();">\n';
	    break;
	}
	break;
    }
    if (sb_option['suffix'])
      output += ' ' + sb_option['suffix'];
    if (sb_option['script_price'])
//      output += "</td><td><input type=\"text\" class=\"sniglets_blinds_calculated\" align=\"right\" name=\"form_" + sb_option['label'] + "_charge\" size=\"10\" maxlength=\"10\" value=\"N/A\">";
      output += "</td><td>";
    output += '</td></tr>\n';
  }

  output += '</table></form>\n';

  output += '<form name="store_form" method="post" action="http://www.accent-blinds.com/shopcart.php"><input type="hidden" name="cmd" value="add"/><input type="hidden" name="eidp" value=""/><input type="hidden" name="quantity" value="1"/></form>\n';
  if (mode)
    document.writeln(output);
  else
    return output;
}

function sniglets_blinds_generate_page()
{
  var output;
  output = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n';
  output += '<html lang="en">\n';
  output += '<head>\n';
  output += '<title>' + sb_config['name'] + '</title>\n';
  output += '<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">\n';
  output += '<link rel="stylesheet" type="text/css" href="../../css/style.css">\n';
  output += '<script type="text/javascript" src="../../js/config-' + sb_config['label'] + '.js"></script>\n';
  output += '<script type="text/javascript" src="../../js/sniglets-blinds.js"></script>\n';
  output += '</head>\n';
  output += '<body>\n';
  output += sniglets_blinds_output_form(false);
  output += '<script type="text/javascript">\n';
  output += '<!--\n';
  output += '  sniglets_blinds_startup();\n';
  output += '// -->\n';
  output += '</script>\n';
  output += '</body>\n';
  output += '</html>\n';
  return output;
}



