function dry_erase_info ( path )
	{
	// More info "box" 
	return  '<Table cellpadding="0" cellspacing="0" border="0"><tbody>' +
			'<TR><TD class="thls">&nbsp;Get&nbsp;More&nbsp;Information&nbsp;</TD>\n</TR>' +

			'<TR><TD valign="top">' +
			'<Table width="100%" cellpadding="0" cellspacing="0" border="0"><Tbody>' +
			'<TR>' +
			'<TD bgcolor="#cccccc"><IMG src="/images/nothing.gif" width="2" height="100%" border="0"></TD>' +
	
			'<TD>' +
			'<Table align="center" valign="middle" border="0" cellpadding="2" cellspacing="0" width="100%" bgcolor="#ffffff" border="0"><Tbody>' +
			'<TR><TD valign="middle"><IMG src="/images/pill.gif" width="8" height="8" border="0"></TD>' +
			'<TD class="tds"><A href="' + path + '/about_markerboards.html" onMouseOver="status=\'About our Markerboards\'; return true;">About&nbsp;our&nbsp;Markerboards</A></TD>' +
			'</TR>' +
			'<TR><TD><IMG src="/images/pill.gif" width="8" height="8" border="0"></TD>' +
			'<TD class="tds" valign="middle"><A href="' + path + '/guarantee.html" onMouseOver="status=\'Stain-Free Guarantee\'; return true;">Stain-Free&nbsp;Guarantee</A></TD>' +
			'</TR>' +
			'<TR><TD><IMG src="/images/pill.gif" width="8" height="8" border="0"></TD>' +
			'<TD class="tds" valign="middle"><A href="' + path + '/care_guide.html" onMouseOver="status=\'Care Instructions\'; return true;">Care&nbsp;Instructions</A></TD>' +
			'</TR>' +
			'</Tbody></Table>' +
			'</TD>' +

			'<TD bgcolor="#cccccc"><IMG src="/images/nothing.gif" width="2" height="100%" border="0"></TD>' +
			'</TR>' +
			'<TR>' +
			'<TD colspan="3" bgcolor="#cccccc"><IMG src="/images/nothing.gif" width="100%" height="2" border="0"></TD>' +
			'</TR>' +
			'</Tbody></Table>' +
			'</TD>' +
			'</TR></tbody></Table>';
	}
	
function product_header ( product_info )
	{
	var anchors = '';
	for ( var i = 0; i < product_info.items.length; i++ )
		anchors += '<A name="' + product_info.items[i].item_num + '"></A>';

	return  anchors + '<Table border="0" cellpadding="0" cellspacing="0" width="100%" class="norm"><Tbody>' +
			'<TR><TD valign="top" align="left" bgcolor="#cc0000"><IMG src="/images/nothing.gif" width="100%" height="2" border="0"></TD></TR>' +
			'<TR><TD valign="top" align="left" bgcolor="#ffff80"><IMG src="/images/nothing.gif" width="100%" height="3" border="0"></TD></TR>' +
			'<TR><TD><Table border="0" cellpadding="0" cellspacing="0" align="left" class="norm"><Tbody><TR>' +
			'<TD valign="top" align="right"><IMG src="/images/scallop2-l.gif" width="31" height="21" border="0"></TD>' +
			'<TD valign="middle" class="ph">&nbsp;' + product_info.nbsp_title + '&nbsp;</TD>' +
			'<TD valign="top" align="left"><IMG src="/images/scallop2-r.gif" width="31" height="21" border="0"></TD>' +
			// '<TD valign="top" align="right" bgcolor="#ffffff"><IMG src="/images/nothing.gif" width="100%" height="1" border="0"></TD>' +
			'</tr></tbody></table></TD></tr></tbody></table>';
	}

function product_detail_table ( product_info )
	{
	var row_str = '';
	if ( ! product_info.attr )
		return '';

	for ( var i = 0; i < product_info.attr.length; i++ )
		{
		if ( product_info.attr[i].spacer )
			row_str += '<TR><TD colspan="2"><IMG src="/images/nothing.gif" width="100%" height="5" border="0"></TD></TR>';
		else if ( product_info.attr[i].subhead )
			row_str += '<TR><TD colspan="2" class="pdsh">' +
				  		  product_info.attr[i].subhead + '</TD></TR>';
		else if ( product_info.attr[i].words )
			row_str += '<TR><TD colspan="2" class="pdw">' +
				  		  product_info.attr[i].words + '</TD></TR>';
		else
			row_str += 
				'<TR><TD valign="middle" class="pdan">' + product_info.attr[i].name + 
				'</TD><TD valign="middle" class="pdav">' +
				product_info.attr[i].value + '</TD></TR>';
		}

	return  spacer_row ( 10 ) + 
			'<TR><TD align="center"><TABLE cellspacing="3" class="norm"><TBODY>' +
			'<TR><TD colspan="2" valign="middle" class="pdh">' +
			product_info.nbsp_title + '</TD></TR>' +
			row_str + '</TBODY></TABLE></TD></TR>';
	}

function spacer_col ( width )
	{
	return '<TD valign="top" align="left"><IMG src="/images/nothing.gif" height="100%" width="' +
		   width + '" border="0"></TD>';
	}

function product_images ( product_info )
	{
	var row_str = spacer_row ( 10 );
	for ( var i = 0; i < product_info.images.length; i++ )
		{
		row_str += '<TR><TD align="center">';
		if ( product_info.images[i].lg_name )
			row_str += '<A href="' + product_info.images[i].lg_name + '">';
		row_str += '<IMG src="' + product_info.images[i].name +
			'" width="' +  product_info.images[i].width +
			'" height="' +  product_info.images[i].height +
			'" border="0" alt="' + product_info.images[i].desc + '">';
		if ( product_info.images[i].lg_name )
			row_str += '</A>';
		row_str += '</TD></TR>';
		} 
	return row_str;
	}

function gen_main_options ( item )
	{
	var sel_name = item.item_num + 'mainopt';

	// Options box
	var add_to_cart_str = 
		'&nbsp;&nbsp;&nbsp;' + item.main_prompt + '&nbsp;&nbsp;&nbsp;' +
		'<SELECT NAME="' + sel_name + '">\n';

	for ( var j = 0; j < item.main_options.length; j++ )
		{
		var option = item.main_options[j];
		add_to_cart_str += 
			'<OPTION VALUE="' + option.item_num + '^^' +
			option.value + item.add_desc + '^^' + option.price + '^^' + 
			( item.qty_min ? item.qty_min : "0" ) + '"> ' + 
			option.value + '</OPTION>\n';
		}

	item.main_sel_opt_str = 
			'document.itemsform.' + sel_name + 
			'.options[document.itemsform.' + 
			sel_name + '.selectedIndex].value + ';

	return add_to_cart_str + '</SELECT>';
	}
	
function gen_option ( item, qty_name )
	{
	var sel_name = item.item_num + 'opt';
	// Options box
	var add_to_cart_str = 
		'<TD class="op">' + item.prompt + '</TD>\n' +
		'<TD><SELECT NAME="' + sel_name + '">\n';

	for ( var j = 0; j < item.options.length; j++ )
		{
		var option = item.options[j];
		add_to_cart_str += '<OPTION VALUE="'; 
		// If there are main_options, then the item number and description 
		// will come from there.
		if ( item.main_sel_opt_str )
			add_to_cart_str += '^^' + option.value + '^^' + option.price;
		else
			add_to_cart_str += 
				option.item_num + '^^' + item.name + ' -- ^^' +
				option.price + '^^' + ( item.qty_min ? item.qty_min : "0" ) + 
				'^^' + option.value;
		add_to_cart_str += '"> ' + option.value + '</OPTION>\n';
		}

	var sel_opt_str = 'document.itemsform.' + sel_name + 
					  '.options[document.itemsform.' + sel_name + '.selectedIndex].value';

	add_to_cart_str += 
		'</SELECT></TD>\n' + spacer_col ( 10 ) +

		// Add to cart button
		'<TD><A href="javascript:top.add_to_cart(' + 
		( item.main_sel_opt_str ? item.main_sel_opt_str : '' ) +
		sel_opt_str + ', document.itemsform.' + qty_name + 
		'.value, top.remove_loc_hash ( document.location ) + \'#' + item.item_num + '\'' + 
		')" onMouseOver="status=\'Add to cart\'; return true;">\n';

	return add_to_cart_str;
	}
	
function display_product ( doc, product_info )
	{
	product_info.nbsp_title = product_info.title.replace ( / /g, '&nbsp;' );

	doc.writeln 
		( '<TR><TD>' + product_header ( product_info ) + '</TD></TR>' +
		  '<TR><TD bgcolor="#ffffff">' +
	
		  // Start product detail table
		  '<TABLE width="100%" cellpadding="2" cellspacing="0"><TBODY>' +

		  // Product image and price
		  '<TR><TD align="center" valign="top">' +
		  '<TABLE cellpadding="0" cellspacing="0"><TBODY>' + 
		  product_images ( product_info ) +
		  product_detail_table ( product_info ) + '</TBODY></TABLE></TD>' +

		  // Product description
		  '<TD class="td">' + product_info.description + '</TD></TR>' +
		  
		  // Cross column description
		  ( ( ! product_info.cross_column_desc ) ? '' : 
		  	'<TR><TD align="center" valign="top" colspan="2">' + 
			product_info.cross_column_desc + '</TD></TR>' ) +

		  // Start table for add-to-cart entry
		  spacer_row ( 10, 2 ) + '<TR><TD colspan="2">' + 
		  '<TABLE align="center" width="95%" border="0" cellpadding="0" cellspacing="0"><TBODY>' );

	var add_to_cart_str = '';
	
	for ( var i = 0; i < product_info.items.length; i++ )
		{
		// Gray line between products
		if ( i > 0 )
			{
			add_to_cart_str += 
				'<TR><TD colspan="8"><IMG src="/images/nothing.gif" width="100%" height="3" border="0"></TD></TR>' +
				'<TR><TD colspan="8" bgcolor="#cccccc"><IMG src="/images/nothing.gif" width="100%" height="2" border="0"></TD></TR>' +
				'<TR><TD colspan="8"><IMG src="/images/nothing.gif" width="100%" height="3" border="0"></TD></TR>';
			}

		var item = product_info.items[i];

		var qty_name = item.item_num + 'qty';

		// Item name
		add_to_cart_str += '<TR bgcolor="#ddffdd"><TD colspan="8" class="tds">' + item.name + ': ';

		if ( item.main_prompt ) 
			{
			add_to_cart_str += gen_main_options ( product_info.items[i] ) + '</TD>';
				
			}

		add_to_cart_str += 
			'</TD></TR><TR bgcolor="#ddffdd"><TD class="in">' + 
			( item.qty_prompt ? item.qty_prompt : 'Quantity' ) + ':</TD>' + 
			spacer_col ( 10 ) +
			// Quantity field
			'<TD><INPUT TYPE="TEXT" NAME="' + qty_name +
			'" VALUE="' + ( item.qty_min ? item.qty_min : "1" ) + 
			'" SIZE="3"></TD>\n' + spacer_col ( 10 );
		

		if ( item.options )
			{
			add_to_cart_str += gen_option ( item, qty_name );
			}
		else
			{
			var esc_name = item.name.replace ( /\'/g, '\\\'' );
			// Add to cart button
			add_to_cart_str += 
				'<TD colspan="4" align="left"><A href="javascript:top.add_to_cart(\'' + 
				item.item_num + '^^' + esc_name + '^^' + item.price + '^^' + 
				( item.qty_min ? item.qty_min : "0" ) + 
				'\', document.itemsform.' + qty_name + 
				'.value, top.remove_loc_hash ( document.location ) + \'#' + item.item_num + '\'' + 
				')" onMouseOver="status=\'Add to cart\'; return true;">\n';
			}
		add_to_cart_str +=
			'<IMG src="/images/add_to_cart_button.gif" width="103" height="23" border="0" alt="Click to add this item to your cart">' +
			'</A></TD></TR>';
		}

	doc.writeln 
		( add_to_cart_str +
		  // End table for add to cart entry
		  '</TD></TR></TBODY></TABLE>' +
		  // End product detail table
		  '</TBODY></TABLE></TD></TR>' );
	}

function spacer_row ( height, col_span )
	{
	var col_span_str = '';
	if ( col_span ) 
		col_span_str = 'colspan="' + col_span + '" ';
	return '<TR><TD ' + col_span_str + 'valign="top" align="left"><IMG src="/images/nothing.gif" width="100%" height="' +
			height + '" border="0"></TD></TR>';
	}

function contents ( doc )
	{
	with ( doc )
		{
		var contents_str = ''; 
		if ( product_order.length > 1 ) 
			{
			contents_str += 
				'<Table cellpadding="0" cellspacing="0" border="0"><tbody>' +
				'<TR><TD colspan="2" class="tds" align="left"><B>Products&nbsp;on&nbsp;this&nbsp;page:</B></TD>\n</TR>' ;

			for ( var i = 0; i < product_order.length; i ++ )
				{
				var product_info = product_order[i];
				var esc_title = product_info.title.replace ( /\'/g, '\\\'' );
				contents_str += 
					'<TR><TD valign="middle"><IMG src="/images/pill.gif" width="8" height="8" border="0"></TD>' +
					'<TD class="tds"><A href="#' + product_info.items[0].item_num + 
					'" onMouseOver="status=\'Jump to:  ' + esc_title + '\'; return true;">' + 
					product_info.title + '</A></TD></TR>'
				}
			contents_str += '</TBODY></TABLE>';
			}
		return contents_str;
		}
	}


function build_product_page ( doc )
	{
	with ( doc )
		{
		if ( ! page_header.sale_image )
			page_header.sale_image = '';
		
		var path_str = '';
		for ( var i = 0; i < page_header.path.length; i++ )
			{
			var path = page_header.path[i];
			path_str += '<A href="' + path.doc + '" onMouseOver="status=\'' + 
						path.stat + '\'; return true;">' + path.name + 
						'</A>&nbsp;&gt;&nbsp;';
			}

			
		writeln 
			( '<FORM NAME="itemsform">\n' +
			  '<TABLE cellpadding="0" cellspacing="0" class="norm" ><TBODY>\n' +
			  '<TR><TD class="tds">&nbsp' +
			  path_str + page_header.title + '</TD></TR>\n' + 
			  spacer_row ( 20 ) +

			  '<TR><TD><table border="0" cellpadding="0" cellspacing="0" width="100%"><TBODY>' +

			  // Page subtitle
			  '<tr><TD align="center"><TABLE cellpadding="0" cellspacing="0"><TBODY>' +
			  '<TR><TD align="center"><IMG src="' + page_header.image.name + 
			  '" width="' + page_header.image.width + '" height="' + 
			  page_header.image.height + '" border="0" alt="' + 
			  page_header.title + '"></TD></TR>' +
			  spacer_row ( 10 ) + '<TR><TD align="left">' + contents ( doc ) + 
			  '</TD></TR></TBODY></TABLE></TD>' +
			  '<td align="right">' + 
			  '<TABLE cellpadding="0" cellspacing="0"><TBODY>' +
			  '<TR><TD align="right">' + page_header.sale_image + '</TD></TR>' +
			  spacer_row ( 10 ) + '<TR><TD align="right">' + 
			  page_header.more_info () + '</td></TR></TBODY></TABLE></TD>' +
			  '</TBODY></TABLE></TD></TR>' );

		if ( page_header.intro )
			{
			writeln ( spacer_row ( 20 ) + '<tr><Td>' + page_header.intro() + '</TD></tr>' );
			}
		writeln ( spacer_row ( 20 ) );

		// Show each product
		for ( i = 0; i < product_order.length; i++ )
			{
			display_product ( doc, product_order[i] );
			writeln ( spacer_row ( 30 ) );
			}

		writeln ( top.copyright_row () + '</TBODY></TABLE></FORM>' );
		}
	}
