function PopupPic(sPicURL) { 
	msgWindow=window.open("../../Tools/popup.htm?"+sPicURL, "", "resizable=1,screenx=0,screeny=0,top=20,left=2,HEIGHT=200,WIDTH=200");
}

function PopupPic_New(popup_rela_path, sPicURL) { 
	msgWindow=window.open(popup_rela_path + "Tools/popup_new.htm?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
}

function showpopup(img) {
    msgWindow=window.open('','windowname','toolbar=no,status=no,scrollbars=yes,resizable=no,screenx=0,screeny=0,top=10,left=0,width=370,height=370');
    msgWindow.document.write('<BODY><center><img src="' + img + '" border="0"><\/center><\/BODY>');
    msgWindow.document.close();
}

function closepopup() {
    if (!msgWindow.closed)
        msgWindow.close();
}

function browser_version()
{
	var version = "ie";
	var browserName = navigator.appName; 
	var browserVer = parseInt(navigator.appVersion);
	
	switch (browserName)
	{
		case "Netscape":
			if (navigator.userAgent.indexOf("Firefox") != -1)
			{
				var versionindex = navigator.userAgent.indexOf("Firefox") + 8;
				if (parseInt(navigator.userAgent.charAt(versionindex)) >= 1)
					version = "firefox_v1_up";
				else
					version = "firefox";
			}
			else
				version = "netscape";
			break
		default:
			if (browserVer <= 3)
				version = "ie_early";
			else
				version = "ie";
	}

	return version;
}

function noshade_bordered_thumb_image_ie(img_tag, img)
{
	var tmp_img = new Image();
	tmp_img.src = img;
	
	/* The size of the border box will be defined in CSS  for image_thumb */
	document.write('		<div class="out image_s_thumb" align="center" valign="middle">');
	document.write('		<div class="in">');

	document.write(img_tag);
	
	document.write('		</div>');
	document.write('		</div>');
}

function bordered_s_thumb_image_ie(img_tag, img)
{
	var tmp_img = new Image();
	tmp_img.src = img;
	
	/* The size of the border box will be defined in CSS  for image_thumb */
	document.write('		<div class="out image_s_thumb" align="center" valign="middle" style="width:' + (tmp_img.width + 7) + 'px; height:' + (tmp_img.height + 5) + 'px;">');
	document.write('		<div class="in rtin tpin" style="width:' + (tmp_img.width + 1) + 'px; height:' + (tmp_img.height + 1) + 'px;">');

	document.write(img_tag);
	
	document.write('		</div>');
	document.write('		</div>');
}

function bordered_thumb_image_ie(img_tag, img)
{
	var tmp_img = new Image();
	tmp_img.src = img;
	
	/* The size of the border box will be defined in CSS  for image_thumb */
	document.write('		<div class="out image_thumb" align="center" valign="middle" style="width:' + (tmp_img.width + 7) + 'px; height:' + (tmp_img.height + 5) + 'px;">');
	document.write('		<div class="in rtin tpin" style="width:' + (tmp_img.width + 1) + 'px; height:' + (tmp_img.height + 1) + 'px;">');

	document.write(img_tag);
	
	document.write('		</div>');
	document.write('		</div>');
}

function bordered_medium_image_ie(img_tag, img)
{
	var tmp_img = new Image();
	tmp_img.src = img;
	
	/* The size of the border box will be defined in CSS  for image_medium */
	document.write('		<div class="out image_medium" align="center" valign="middle" style="width:' + (tmp_img.width + 7) + 'px; height:' + (tmp_img.height + 5) + 'px;">');
	document.write('		<div class="in rtin tpin" style="width:' + (tmp_img.width + 1) + 'px; height:' + (tmp_img.height + 1) + 'px;">');

	document.write(img_tag);
	
	document.write('		</div>');
	document.write('		</div>');
}

function noshade_bordered_thumb_image_otherbrowser(img_tag)
{
	/* The size of the border box will be defined in CSS  for image_thumb */
	document.write('		<div class="out image_s_thumb" align="center" valign="middle">');
	document.write('		<div class="in">');

	document.write(img_tag);
	
	document.write('		</div>');
	document.write('		</div>');
}

function bordered_s_thumb_image_otherbrowser(img_tag)
{
	/* The size of the border box will be defined in CSS  for image_thumb */
	document.write('		<div class="out image_s_thumb" align="center" valign="top">');
	document.write('		<div class="in rtin tpin">');

	document.write(img_tag);
	
	document.write('		</div>');
	document.write('		</div>');
}

function bordered_thumb_image_otherbrowser(img_tag, img)
{
	/* The size of the border box will be defined in CSS  for image_thumb */
	document.write('		<div class="out image_thumb" align="center" valign="top">');
	document.write('		<div class="in rtin tpin">');

	document.write(img_tag);
	
	document.write('		</div>');
	document.write('		</div>');
}

function bordered_medium_image_otherbrowser(img_tag)
{
	/* The size of the border box will be defined in CSS  for image_medium */
	document.write('		<div class="out image_medium" align="center" valign="top"');
	document.write('		<div class="in rtin tpin">');

	document.write(img_tag);
	
	document.write('		</div>');
	document.write('		</div>');
}

function noshade_bordered_thumb_image(img_tag, img)
{
	if (browser_version() == "ie")
		noshade_bordered_thumb_image_ie(img_tag, img);
	else
		noshade_bordered_thumb_image_otherbrowser(img_tag, img);
}

function bordered_s_thumb_image(img_tag, img)
{
	if (browser_version() == "ie")
		bordered_s_thumb_image_ie(img_tag, img);
	else
		bordered_s_thumb_image_otherbrowser(img_tag, img);
}

function bordered_thumb_image(img_tag, img)
{
	if (browser_version() == "ie")
		bordered_thumb_image_ie(img_tag, img);
	else
		bordered_thumb_image_otherbrowser(img_tag, img);
}

function bordered_medium_image(img_tag, img)
{
	if (browser_version() == "ie")
		bordered_medium_image_ie(img_tag, img);
	else
		bordered_medium_image_otherbrowser(img_tag, img);
}

function gen_showroom_page(background_image, main_image)
{
	var str = '';
	
	str += '<html>';
	str += '	<head>';
	str += '		<title>Showroom</title>';
	
	str += '		<link href=../../Config/style.css rel=stylesheet>';
	str += '		<script language=javascript src=../../Scripts/utils.js></script>';
	
	str += '	</head>';
	str += '	<body>';

	str += '<table width=100% height=100% border=1>';
	str += '<tr>';
	
	str += '	<td id=caption align="center" valign="middle" background=' + background_image  + ' width=100%>';
	str += '		<img name=display src=' + main_image + ' width=400 border=0></a></td>';

	str += '</tr>';
	str += '</table>';

	str += '</body>';
	str += '</html>';

	return str;
}

function display_showroom_page(background_image, main_image)
{
	parent.frames['showroom'].document.open();
	parent.frames['showroom'].document.write(gen_showroom_page(background_image, main_image));
	parent.frames['showroom'].document.close();
}

function goto_page(selection)
{
	var id = selection.options[selection.selectedIndex].value;
	location.href = id ;
}

function goto_category_page(selection)
{
	var id = selection.options[selection.selectedIndex].value;
	location.href = "../" + id ;
}

function popup_help(url, width, height) {
	var win = window.open(url, 'image_display', 'toolbar=no,status=no,scrollbars=yes,resizable=no,screenx=0,screeny=0,top=10,left=0,width=' + width + ',height=' + height);
	//win.location.reload();
}

function open_popup(url, width, height) {
	width = 840;
	height = 840;

	var win = window.open('', 'image_display', 'toolbar=no,status=no,scrollbars=yes,resizable=yes,screenx=0,screeny=0,top=10,left=0,width=' + width + ',height=' + height);
    win.document.write('<BODY><center><img src="' + url + '" border="0"><\/center><\/BODY>');
    win.document.close();
	//win.location.reload();
}

function open_popup_old(url, width, height) {
	/*
	if (height > 800)
	{
		width *= 800 / height;
		height = 800;
	}
	
	width = 850;
	height = 850;
	*/
	
	/*	
	if (height > screen.height)
	{
		width *= screen.height / height;
		height = screen.height - 100;
	}
	
	if (width > screen.width)
	{
		height *= screen.width / width;
		width = screen.width - 100;
	}
	*/
	
	width = 838;
	height = 838;

	var win = window.open(url, 'image_display', 'toolbar=no,status=no,scrollbars=yes,resizable=yes,screenx=0,screeny=0,top=0,left=0,width=' + width + ',height=' + height);
	//win.location.reload();
}

function close_popup() {
	window.close();
}

function popup_tight_image(image_src)
{
	var tmp_img = new Image();
	tmp_img.src = image_src;
	
	open_popup(image_src, tmp_img.width, tmp_img.height);
}

function draw_tight_image(image_src)
{
	max_width =350;
	var tmp_img = new Image();
	tmp_img.src = image_src;
	
	if (tmp_img.width < max_width)
		max_width = tmp_img.width;
		
	document.write("<img src=" + image_src + " border=0 width=" + max_width + " alt='" + image_src + "'>");
}

function close_basket() {
     basket.close();
}

function open_basket() {
	var basket = window.open('basket_popup.asp', 'basket', 'toolbar=no,status=no,scrollbars=yes,resizable=no,screenx=0,screeny=0,top=0,left=0,width=750,height=280');
	basket.location.reload();
}

function category_open_basket() {
	var basket = window.open('../basket_popup.asp', 'basket', 'toolbar=no,status=no,scrollbars=yes,resizable=no,screenx=0,screeny=0,top=0,left=0,width=750,height=280');
	basket.location.reload();
}

function product_open_basket() {
	var basket = window.open('../../basket_popup.asp', 'basket', 'toolbar=no,status=no,scrollbars=yes,resizable=no,screenx=0,screeny=0,top=0,left=0,width=750,height=280');
	basket.location.reload();
}

function show_basket() {
	Self.setTimeout('open_basket()',3000);
}

function catalog_update_basket() {
	frames["basket"].location.href = "./inline_basket.asp";
}

function catagory_update_basket() {
	frames["basket"].location.href = "../inline_basket.asp";
}

function product_update_basket() {
	frames["basket"].location.href = "../../inline_basket.asp";
}

function nameFormat(str) {
	var tempArray = str.split(' ');
	return tempArray.join('_').toLowerCase();
}

// Define a function to replace all whitespaces with "_"
function joinByUnderscore(str) {
	var tempArray = str.split(' ');
	return tempArray.join('_');
}

function real_url(relative_path, url)
{
	if (url.indexOf("http:") < 0)
		url = relative_path + url;

	return url;
}

function build_bottom_misc_menu (relative_path)
{
	var str = '';
	str += '<div align="center" class="smaller_content">';
	
	for (var i = 0; i < navigation_menu_items.length; i++)
	{
		if (navigation_menu_items[i][0] != "Seperator")
		{
			if (navigation_menu_items[i][1].indexOf("http:") < 0)
				str += ' | <a href="' + relative_path + navigation_menu_items[i][1] + '" target="' + navigation_menu_items[i][4] + '">' + navigation_menu_items[i][0] + '</a>';
			else
				str += ' | <a href="' + navigation_menu_items[i][1] + '" target="' + navigation_menu_items[i][4] + '">' + navigation_menu_items[i][0] + '</a>';
		}
	}
	
	str += ' |</div>';

	document.write(str);
}

function build_left_menu (relative_path)
{
	var str = '';
	str += '<table bordercolor="black" border="0" width="100%" cellspacing="0" cellpadding="0" ID="Table7">';
	str += '<tr>';
	str += '<td>';
	str += '	<!-- Left menu cells -->';
	str += '	<b>';
	
	for (var i = 0; i < navigation_menu_items.length; i++)
	{
		if (navigation_menu_items[i][0] == "Seperator")
			str += '<br>';
		else
		{
			if (navigation_menu_items[i][1].indexOf("http:") < 0)
				str += '<table width="100%" border="0"><tr><td class="category" align="center" width="' + left_menu_width + '" bgcolor="' + category_llite_color + '"><a class="category" href="' + relative_path + navigation_menu_items[i][1] + '" target="' + navigation_menu_items[i][4] + '">' + navigation_menu_items[i][0] + '</a></td></tr></table>';
			else
				str += '<table width="100%" border="0"><tr><td align="center" width="' + left_menu_width + '" bgcolor="' + category_llite_color + '"><a class="category" href="' + navigation_menu_items[i][1] + '" target="' + navigation_menu_items[i][4] + '">' + navigation_menu_items[i][0] + '</a></td></tr></table>';
		}
	}
	
	str += '	</b>';

	document.write(str);
}

function build_menu_cell_bg(relative_path, category_menu_type, highlight)
{
	var str = '';
	switch (category_menu_type)
	{
		case 'jpg':
		case 'gif':
			str = '';
		break
		case 'bg_button':
			if ( highlight == true)
				str = ' background="' + relative_path + 'Images/h_' + bg_button_image + '"';
			else
				str = ' background="' + relative_path + 'Images/l_' + bg_button_image + '"';
		break
		default: // Text and others
			if ( highlight == true)
				str = ' bgcolor="' + category_hlite_color + '"';
			else
				str = ' bgcolor="' + category_llite_color + '"';
	}
	
	return str;
}

function build_menu_link (relative_path, category_menu_type, main_category, highlight)
{
	var str = '';
	switch (category_menu_type)
	{
		case 'jpg':
		case 'gif':
			if ( highlight == true)
				str = '<img src="' + relative_path + 'Images/' + nameFormat(main_category) + '_h.' + category_menu_type + '" border="0">';
			else
				str = '<img src="' + relative_path + 'Images/' + nameFormat(main_category) + '_l.' + category_menu_type + '" border="0">';
		break
		case 'bg_button':
		default: // Text and others
			str = main_category;
	}
	
	return str;
}

function build_pulldown_category_menu (category_menu_type, relative_path, level, input_category, menu_level)
{
	document.write('				<!-- Category menu cells -->');
	Cat(relative_path);

	document.write('<div class="menu2">');
	document.write('<ul>');



	
	var main_menu = "";
	var two_submenu = "";
	var three_submenu = "";
	var menu_array = "";
	
	var main_menu_closed = true;
	var two_submenu_closed = true;
	var i = 0;

	for (i = 0; i < navigation_home_menu_items.length; i++) /* We only deal with 3 menu levels for now */
	{
		menu_array = navigation_home_menu_items[i][0].split('|');
		
		if (two_submenu != menu_array[1])
		{
			if (two_submenu_closed == false)
			{
				document.write('	</ul>');
				document.write('	</td></tr></tbody></table>');
				document.write('<!--[if lte IE 6]></a><![endif]-->');
				document.write('</li>');
				two_submenu_closed = true;
			}
		}

		if (main_menu != menu_array[0])
		{
			if (main_menu_closed == false)
			{
				document.write('	</ul>');
				document.write('	</td></tr></tbody></table>');
				document.write('<!--[if lte IE 6]></a><![endif]-->');
				document.write('</li>');
				main_menu_closed = true;
			}
		}

		if (main_menu != menu_array[0])
		{
			if (menu_array.length == 1)
			{
				if (navigation_home_menu_items[i][0] == "Seperator")
					document.write('<li><a href="#"><br></a></li>');
				else
					document.write('<li><a href="' + real_url(relative_path, navigation_home_menu_items[i][1]) + '" target="' + navigation_home_menu_items[i][4] + '">' + menu_array[0] + '</a></li>');
			}
			else
			{
				document.write('<li><a href="#">' + menu_array[0]);

				document.write('<!--[if IE 7]><!--></a><!--<![endif]-->');			
				document.write('	<table ID="Table6"><tbody><tr><td>');
				document.write('	<ul>');
				main_menu_closed = false;
			}
		}
		
		if ((two_submenu != menu_array[1]) && (menu_array.length > 1))
		{
			if (menu_array.length == 2)
				document.write('<li><a href="' + real_url(relative_path, navigation_home_menu_items[i][1]) + '" target="' + navigation_home_menu_items[i][4] + '">' + menu_array[1] + '</a>');
			else
			{
				document.write('<li><a href="#">' + menu_array[1]);
				document.write('<!--[if IE 7]><!--></a><!--<![endif]-->');			
				document.write('	<table ID="Table6"><tbody><tr><td>');
				document.write('	<ul>');
				two_submenu_closed = false;
			}
		}
		
		if (menu_array.length > 2)
			document.write('<li><a href="' + real_url(relative_path, navigation_home_menu_items[i][1]) + '" target="' + navigation_home_menu_items[i][4] + '">' + menu_array[2] + '</a></li>');

		main_menu = menu_array[0];
		if (menu_array.length > 1)
			two_submenu = menu_array[1];
		if (menu_array.length > 2)
			three_submenu = menu_array[2];
	}
	
	if (main_menu_closed == false)
	{
		document.write('	</ul>');
		document.write('	</td></tr></tbody></table>');
		document.write('<!--[if lte IE 6]></a><![endif]-->');
		document.write('</li>');
	}
	
	if (two_submenu_closed == false)
	{
		document.write('	</ul>');
		document.write('	</td></tr></tbody></table>');
		document.write('<!--[if lte IE 6]></a><![endif]-->');
		document.write('</li>');
	}

	if (user_account == true)
		document.write('<li><a href="' + relative_path + 'login.asp">Logon/off</a></li>');


	// For the category menus
	main_menu = "";
	two_submenu = "";
	three_submenu = "";
	var current_main_category = "";
	var current_sub_category = "";
	
	main_menu_closed = true;
	two_submenu_closed = true;

	for (i = 0; i < category_menu_items.length; i++)
	{
		menu_array = category_menu_items[i][0].split('|');
		var menu_label_array = category_menu_items[i][1].split('|');
		
		if (two_submenu != menu_array[1])
		{
			if (two_submenu_closed == false)
			{
				document.write('	</ul>');
				document.write('	</td></tr></tbody></table>');
				document.write('<!--[if lte IE 6]></a><![endif]-->');
				document.write('</li>');
				two_submenu_closed = true;
			}
		}

		if (main_menu != menu_array[0])
		{
			if (main_menu_closed == false)
			{
				document.write('	</ul>');
				document.write('	</td></tr></tbody></table>');
				document.write('<!--[if lte IE 6]></a><![endif]-->');
				document.write('</li>');
				main_menu_closed = true;
			}
		}

		if (main_menu != menu_array[0])
		{
			if (menu_array.length == 1)
			{
				if (category_menu_items[i][0] == "Seperator")
					document.write('<li><a href="#"><br></a></li>');
				else
					document.write('<li><a href="' + real_url(relative_path,joinByUnderscore(menu_array[0])) + '/index.asp">' + menu_label_array[0] + '</a></li>');
			}
			else
			{
				document.write('<li><a href="' + real_url(relative_path,joinByUnderscore(menu_array[0])) + '/index.asp">' + menu_label_array[0]);

				document.write('<!--[if IE 7]><!--></a><!--<![endif]-->');			
				document.write('	<table ID="Table6"><tbody><tr><td>');
				document.write('	<ul>');
				main_menu_closed = false;
			}
		}
		
		if ((two_submenu != menu_array[1]) && (menu_array.length > 1))
		{
			if (menu_array.length == 2)
				document.write('<li><a href="' + real_url(relative_path, joinByUnderscore(menu_array[0]) + '/' + nameFormat(menu_array[1]) + '_index.asp') + '">' + menu_label_array[1] + '</a>');
			else
			{
				document.write('<li><a href="' + real_url(relative_path, joinByUnderscore(menu_array[0]) + '/' + nameFormat(menu_array[1]) + '_index.asp') + '">' + menu_label_array[1]);
				document.write('<!--[if IE 7]><!--></a><!--<![endif]-->');			
				document.write('	<table ID="Table6"><tbody><tr><td>');
				document.write('	<ul>');
				two_submenu_closed = false;
			}
		}
		
		if (menu_array.length > 2)
			document.write('<li><a href="' + real_url(relative_path, joinByUnderscore(menu_array[0]) + '/' + nameFormat(menu_array[1]) + '_' + nameFormat(menu_array[2]) + '_index.asp') + '">' + menu_label_array[2] + '</a></li>');

		main_menu = menu_array[0];
		if (menu_array.length > 1)
			two_submenu = menu_array[1];
		if (menu_array.length > 2)
			three_submenu = menu_array[2];
	}
	
	if (main_menu_closed == false)
	{
		document.write('	</ul>');
		document.write('	</td></tr></tbody></table>');
		document.write('<!--[if lte IE 6]></a><![endif]-->');
		document.write('</li>');
	}
	
	if (two_submenu_closed == false)
	{
		document.write('	</ul>');
		document.write('	</td></tr></tbody></table>');
		document.write('<!--[if lte IE 6]></a><![endif]-->');
		document.write('</li>');
	}



	main_menu = "";
	two_submenu = "";
	three_submenu = "";
	
	main_menu_closed = true;
	two_submenu_closed = true;

	for (i = 0; i < navigation_menu_items.length; i++)
	{
		menu_array = navigation_menu_items[i][0].split('|');
		
		if (two_submenu != menu_array[1])
		{
			if (two_submenu_closed == false)
			{
				document.write('	</ul>');
				document.write('	</td></tr></tbody></table>');
				document.write('<!--[if lte IE 6]></a><![endif]-->');
				document.write('</li>');
				two_submenu_closed = true;
			}
		}

		if (main_menu != menu_array[0])
		{
			if (main_menu_closed == false)
			{
				document.write('	</ul>');
				document.write('	</td></tr></tbody></table>');
				document.write('<!--[if lte IE 6]></a><![endif]-->');
				document.write('</li>');
				main_menu_closed = true;
			}
		}

		if (main_menu != menu_array[0])
		{
			if (menu_array.length == 1)
			{
				if (navigation_menu_items[i][0] == "Seperator")
					document.write('<li><a href="#"><br></a></li>');
				else
					document.write('<li><a href="' + real_url(relative_path, navigation_menu_items[i][1]) + '" target="' + navigation_menu_items[i][4] + '">' + menu_array[0] + '</a></li>');
			}
			else
			{
				document.write('<li><a href="#">' + menu_array[0]);

				document.write('<!--[if IE 7]><!--></a><!--<![endif]-->');			
				document.write('	<table ID="Table6"><tbody><tr><td>');
				document.write('	<ul>');
				main_menu_closed = false;
			}
		}
		
		if ((two_submenu != menu_array[1]) && (menu_array.length > 1))
		{
			if (menu_array.length == 2)
				document.write('<li><a href="' + real_url(relative_path, navigation_menu_items[i][1]) + '" target="' + navigation_menu_items[i][4] + '">' + menu_array[1] + real_url(relative_path, navigation_menu_items[i][1]) + '</a>');
			else
			{
				document.write('<li><a href="#">' + menu_array[1]);
				document.write('<!--[if IE 7]><!--></a><!--<![endif]-->');			
				document.write('	<table ID="Table6"><tbody><tr><td>');
				document.write('	<ul>');
				two_submenu_closed = false;
			}
		}
		
		if (menu_array.length > 2)
			document.write('<li><a href="' + real_url(relative_path, navigation_menu_items[i][1]) + '" target="' + navigation_menu_items[i][4] + '">' + menu_array[2] + '</a></li>');

		main_menu = menu_array[0];
		if (menu_array.length > 1)
			two_submenu = menu_array[1];
		if (menu_array.length > 2)
			three_submenu = menu_array[2];
	}
	
	if (main_menu_closed == false)
	{
		document.write('	</ul>');
		document.write('	</td></tr></tbody></table>');
		document.write('<!--[if lte IE 6]></a><![endif]-->');
		document.write('</li>');
	}
	
	if (two_submenu_closed == false)
	{
		document.write('	</ul>');
		document.write('	</td></tr></tbody></table>');
		document.write('<!--[if lte IE 6]></a><![endif]-->');
		document.write('</li>');
	}


	document.write('</ul>');
	document.write('</div>');
	document.write('			</td>');
	document.write('			</tr>');
	document.write('			<tr>');
	document.write('			<td width="100%">');
	
	document.write('<table bordercolor="black" border="0" width="100%" cellspacing="0" cellpadding="0" ID="Table7">');
}

function build_category_menu (category_menu_type, relative_path, level, input_category, menu_level)
{
	document.write('				<!-- Category menu cells -->');
	document.write('				<center>');
	Cat(relative_path);
	document.write('				<table bordercolor="black" border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#FFFFFF" ID="Table15" class="table_border">');
	//document.write('<div align="right"><iframe name="basket" frameborder="0" scrolling="no" hspace="0" marginheight="0" marginwidth="0" align="top" src="./inline_search.asp" width="140" height="40"></iframe></div><br>');
	document.write('					<tr>');
	document.write('					<td height="' + (left_menu_height + left_menu_vertical_space) + '" align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, false) + '><a class="category" href="' + relative_path + 'index.asp">' + build_menu_link(relative_path, category_menu_type, "Home", false) + '</a></td></tr>');
	if (user_account == true)
	{
		document.write('					<td height="' + (left_menu_height + left_menu_vertical_space) + '" align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, false) + '><a class="category" href="' + relative_path + 'login.asp">' + build_menu_link(relative_path, category_menu_type, "Login/out", false) + '</a></td></tr>');
		document.write('					<tr>');
	}
	document.write('					<tr>');
	document.write('					<td height="' + (left_menu_height + left_menu_vertical_space) + '"align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, false) + '><a class="category" href="' + relative_path + 'basket.asp">' + build_menu_link(relative_path, category_menu_type, "Shopping Cart", false) + '</a></td></tr>');
	document.write('					<tr>');
	document.write('					<td height="' + (left_menu_height + left_menu_vertical_space) + '" align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, false) + '><a class="category" href="' + relative_path + 'order.asp">' + build_menu_link(relative_path, category_menu_type, "Checkout", false) + '</a></td></tr>');
	document.write('				</table>');
	document.write('<br>');

	var current_main_category = "";
	var current_sub_category = "";
	document.write('				<table bordercolor="black" border="0" width="100%" cellspacing="0" cellpadding="0" bordercolor="#FFFFFF" id="category_menu" class="table_border">');
	for (var i = 0; i < category_menu_items.length; i++)
	{
		// Figure out category_array[0] or current_main_category based on Menu_Label field
		if (category_menu_items[i][0].indexOf("|") < 0)
		{
			document.write('				<tr>');
			document.write('				<td height="' + (left_menu_height + left_menu_vertical_space) + '" align="right"><table width="100%" height="' + left_menu_height + '" border="0" bordercolor="black" cellspacing="0" cellpadding="0"><tr>');
			current_main_category = category_menu_items[i][0];
			menu_label = category_menu_items[i][1];
			if (category_menu_items[i][0] == input_category)
			{
				// document.write('					<img src="' + relative_path + 'Images/folder_open.gif" border="0"></td><td align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, true) + '><a class="category_h" href="' + relative_path + joinByUnderscore(current_main_category) + '/index.asp">' + build_menu_link(relative_path, category_menu_type, current_main_category, true) + '</a></td></tr></table></td></tr>');
				document.write('<td align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, true) + '><a class="category_h" href="' + relative_path + joinByUnderscore(current_main_category) + '/index.asp">' + build_menu_link(relative_path, category_menu_type, menu_label, true) + '</a></td></tr></table></td></tr>');
			}
			else
			{
				// document.write('					<img src="' + relative_path + 'Images/folder_close.gif" border="0"></td><td align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, false) + '><a class="category" href="' + relative_path + joinByUnderscore(current_main_category) + '/index.asp">' + build_menu_link(relative_path, category_menu_type, current_main_category, false) + '</a></td></tr></table></td></tr>');
				document.write('<td align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, false) + '><a class="category" href="' + relative_path + joinByUnderscore(current_main_category) + '/index.asp">' + build_menu_link(relative_path, category_menu_type, menu_label, false) + '</a></td></tr></table></td></tr>');
			}
		}
		else
		{
			var category_array = category_menu_items[i][0].split('|');
			var menu_label_array = category_menu_items[i][1].split('|');
			var input_category_array = input_category.split('|');
			var input_main_category = input_category_array[0];
			
			if (current_main_category != category_array[0])
			{
				// new main category
				menu_label = menu_label_array[0];
				document.write('				<tr>');
				document.write('				<td height="' + (left_menu_height + left_menu_vertical_space) + '" align="right"><table width="100%" height="' + left_menu_height + '" border="0" cellspacing="0" cellpadding="0"><tr>');
				if (category_array[0] == input_main_category)
				{
					// document.write('					<img src="' + relative_path + 'Images/folder_open.gif" border="0" ></td><td align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, true) + '><a class="category_h" href="' + relative_path + joinByUnderscore(category_array[0]) + '/index.asp">' + build_menu_link(relative_path, category_menu_type, category_array[0], true) + '</a></td></tr></table></td></tr>');
					document.write('<td align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, true) + '><a class="category_h" href="' + relative_path + joinByUnderscore(category_array[0]) + '/index.asp">' + build_menu_link(relative_path, category_menu_type, menu_label, true) + '</a></td></tr></table></td></tr>');
				}
				else
				{
					// document.write('					<img src="' + relative_path + 'Images/folder_close.gif" border="0"></td><td align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, false) + '><a class="category" href="' + relative_path + joinByUnderscore(category_array[0]) + '/index.asp">' + build_menu_link(relative_path, category_menu_type, category_array[0], false) + '</a></td></tr></table></td></tr>');
					document.write('<td align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, false) + '><a class="category" href="' + relative_path + joinByUnderscore(category_array[0]) + '/index.asp">' + build_menu_link(relative_path, category_menu_type, menu_label, false) + '</a></td></tr></table></td></tr>');
				}
			}
			
			current_main_category = category_array[0];

			// generate subcategory only it's in that main category
			if (input_main_category == category_array[0]) 
			{
				if ((input_category_array[1] == category_array[1]) && (menu_level > 0))
				{
					document.write('				<tr>');
					document.write('				<td height="' + (left_menu_height + left_menu_vertical_space) + '" align="right" colspan="2"><table border="0" width="92%" height="' + left_menu_height + '" cellspacing="0" cellpadding="0"><tr><td width="100%" align="right"' + build_menu_cell_bg(relative_path, category_menu_type, true) + '>');
					document.write('					<a class="category_h" href="' + relative_path + joinByUnderscore(current_main_category) + "/" + nameFormat(category_array[1]) + '_index.asp">' + build_menu_link(relative_path, category_menu_type, category_array[1], true) + '</a></td></tr></table></td></tr>');
					current_sub_category = category_array[1];
				}
				else
				{
					document.write('				<tr>');
					document.write('				<td height="' + (left_menu_height + left_menu_vertical_space) + '" align="right" colspan="2"><table border="0" width="92%" height="' + left_menu_height + '" cellspacing="0" cellpadding="0"><tr><td width="100%" align="right"' + build_menu_cell_bg(relative_path, category_menu_type, false) + '>');
					document.write('					<a class="category" href="' + relative_path + joinByUnderscore(current_main_category) + "/" + nameFormat(category_array[1]) + '_index.asp">' + build_menu_link(relative_path, category_menu_type, category_array[1], false) + '</a></td></tr></table></td></tr>');
					current_sub_category = category_array[1];
				}
			}
		}
		
		document.write('');
	}

	document.write('				</table>');
	
	document.write('				<br></center>');
	document.write('			</td>');
	document.write('			</tr>');
	document.write('			<tr>');
	document.write('			<td width="100%">');
	
	var str = '';
	str += '<table bordercolor="black" border="1" width="100%" cellspacing="0" cellpadding="0" ID="Table7" class="table_border">';
	str += '<tr>';
	str += '<td>';
	str += '	<!-- Left menu cells -->';
	
	for (var i = 0; i < navigation_menu_items.length; i++)
	{
		if (navigation_menu_items[i][0] == "Seperator")
			{
				//str += '	<a href="' + relative_path + navigation_menu_items[i][1] + '" target="' + navigation_menu_items[i][4] + '"><img src="' + relative_path + 'Images/' + navigation_menu_items[i][3] + '" border="0"></a><br>';
			}
		else
		{
			if (navigation_menu_items[i][1].indexOf("http:") < 0)
			{
				str += '<tr>';
				str += '<td height="' + (left_menu_height + left_menu_vertical_space) + '" class="category" align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, false) + '><a class="category" href="' + relative_path + navigation_menu_items[i][1] + '" target="' + navigation_menu_items[i][4] + '">' + build_menu_link(relative_path, category_menu_type, navigation_menu_items[i][0], false) + '</a></td></tr>';
				//str += '	<a href="' + relative_path + navigation_menu_items[i][1] + '" target="' + navigation_menu_items[i][4] + '"><img src="' + relative_path + 'Images/' + navigation_menu_items[i][3] + '" border="0"></a><br>';
			}
			else
			{
				str += '<tr>';
				str += '<td height="' + (left_menu_height + left_menu_vertical_space) + '" align="center" width="' + left_menu_width + '"' + build_menu_cell_bg(relative_path, category_menu_type, false) + '><a class="category" href="' + navigation_menu_items[i][1] + '" target="' + navigation_menu_items[i][4] + '">' + build_menu_link(relative_path, category_menu_type, navigation_menu_items[i][0], false) + '</a></td></tr>';
				//str += '	<img src="' + relative_path + 'Images/bullet.gif"><a href="' + navigation_menu_items[i][1] + '" target="' + navigation_menu_items[i][4] + '"><img src="' + relative_path + 'Images/' + navigation_menu_items[i][3] + '" border="0"></a><br>';
			}
		}
	}
	
	document.write(str);
}

function build_page_header(level, input_category, menu_level)
{
	var relative_path = "./";
	for (var i = 0; i < level; i++)
		relative_path += "../";
		
	document.write('<div align="' + display_align + '">');

	document.write('<!-- Overall display section -->');
	document.write('<table id="display_area" bgcolor="' + display_area_bgcolor + '" border="' + display_border + '" bordercolor="' + display_border_color + '" width="' + display_width + '" height="100%" cellspacing="0" cellpadding="0" valign="top">');
	document.write('<tr valign="top">');
	document.write('<td width="' + left_pane_width + '" valign="top">');
	document.write('	<!-- Left Menu Panel Section -->');
	document.write('	<table border="0" bordercolor="' + category_deco_border_color + '" width="' + left_pane_width + '" height="100%" cellspacing="0" cellpadding="0" id="menu" valign="top">');
	document.write('	<tr valign="top">');
	document.write('	<td width="' + left_pane_width + '" height="' + logo_height + '" valign="top" background="' + relative_path + logo + '">');
	document.write('		<img src="' + relative_path + 'Images/spac.gif" width="1">');
	document.write('	</td>');
	document.write('	</tr>');
	document.write('	<tr valign="top">');
	document.write('	<td width="' + left_pane_width + '" valign="top" align=center bgcolor="' + category_bg_color + '">');
	document.write('		<table bordercolor="' + category_deco_border_color + '" border="0" width="' + left_pane_width + '" height="100%" cellspacing="0" cellpadding="0" id="menu_frame" align=center>');
	document.write('		<tr>');
	document.write('		<td valign="top" width="' + left_edge_width + '">');
	document.write('			<img src="' + relative_path + 'Images/spac.gif" width="' + left_edge_width + '" height="70" alt="spac.gif (848 bytes)">');
	document.write('		</td>');
	document.write('		<td valign="top" width="' + (left_pane_width - left_edge_width) + '">');
	document.write('			<table border="0" width="100%" cellspacing="0" cellpadding="0" id="menu_inner_frame" valign="top">');
	document.write('			<tr>');
	document.write('			<td width="100%">');

	if (pulldown_menu_flag == true) // "text|jpg|gif|pulldown|bg_button"
	{
		if (browser_version() == "ie")
			build_category_menu (category_menu_type, relative_path, level, input_category, menu_level);
		else
			build_pulldown_category_menu (category_menu_type, relative_path, level, input_category, menu_level);
	}
	else
		build_category_menu (category_menu_type, relative_path, level, input_category, menu_level);
}

function build_left_menu_footer(level)
{
	var relative_path = "./";
	for (var i = 0; i < level; i++)
		relative_path += "../";
	var relative_path_bg = "./";
	for (var i = 0; i < (level - 1); i++)
		relative_path_bg += "../";
		
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
	//document.write('<center><br><img src="' + relative_path + 'Images/turbo_ssl.gif" border="0"><br><a href="javascript:popup_help(\'http://spokane.bbb.org/WWWRoot/Report.aspx?site=70&bbb=1256&firm=64004540\', 800, 600);"><br><img src="' + relative_path + 'Images/logo_bbb_100_border.gif" border="0"></a></center>');
	document.write('<center><br><span class="host">Designed by<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="host" href="http://www.ebiz-wa.com/" target="_blank">Emerald Smallbiz Solutions</a></center><br><br>');
	
	document.write('			</td>');
	document.write('			</tr>');
	document.write('			</table>');
	document.write('		</td>');
	document.write('		</tr>');
	document.write('		</table>');
	document.write('	</td>');
	document.write('	</tr>');
	document.write('	</table>');
	document.write('</td>');
	document.write('<td width="100%" rowspan="2" valign="top">');
	
	document.write('	<!-- Content area with top bar -->');
	document.write('	<table bordercolor="black" border="0" width="100%" cellspacing="0" cellpadding="0" ID="Table8" valign="top">');
	document.write('	<tr valign="top">');
	document.write('	<td width="100%" valign="top">');
	
	//document.write('		<!-- Top Panel Section -->');
	//document.write('		<table background="' + relative_path_bg + header_img + '" border="0" width="100%" height="' + header_img_height + '" cellspacing="0" cellpadding="0" ID="Table9">');
	//document.write('		<tr>');
	//document.write('		<td colspan="3">');
	//document.write('		</td>');
	//document.write('		</tr>');
	//document.write('		</table>');
	
	document.write('	</td>');
	document.write('	</tr>');
	document.write('	<tr>');
	document.write('	<td width="100%">');
	document.write('		<!-- Content Section -->');
	document.write('		<table border="0" width="100%" background="' + relative_path_bg + 'Images/content_bg.gif" ID="Table10">');
	document.write('		<tr>');
	document.write('		<td colspan="3">');
	
	// Show for test mode
	// document.write('			<u><h1><font color=orange size=5>The site is in Test Mode now!</font></h1></u>');
	// document.write('			<center><u><h3><font color=orange size=3>No order will be taken during the test period, we will be online by the end of June.</font></h3></u></center>');
}

function build_page_footer(level)
{
	var relative_path = "./";
	for (var i = 0; i < level; i++)
		relative_path += "../";

	build_bottom_misc_menu (relative_path);
	document.write('			<div class="copyright">');
	document.write('				Copyright &copy; 2004 - 2006 DreamHomeSupply.com. All rights reserved.');
	document.write('			</div>');
	document.write('		</td>');
	document.write('		</tr>');
	document.write('		</table>');
	document.write('		<p>&nbsp;');
	document.write('	</td>');
	document.write('	</tr>');
	document.write('	</table>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');

	document.write('</div>');
}