/*jslint browser: true, eqeqeq: true, undef: true, evil: true */
/*global jQuery, validateSiteSearchForm, validateAdvancedSearchForm */
/******************************************************************************
Lines above are for jslint, the JavaScript verifier.  http://www.jslint.com/
******************************************************************************/

document.write(
	"<div id=\"nav_header\">\n" +
	"\n" +
	"<div id=\"search_container\">\n" +
	"<p class=\"tight\">\n" +
	"<a href=\"http://www.monogram.com/search/advanced.htm\">Advanced Search</a>\n" +
	"&nbsp;|&nbsp;\n" +
	"<a href=\"http://www.geappliances.com/search/google/user_help.html\" target=\"_blank\" onclick=\"window.open(this.href, 'help', 'width=640,height=480,resizable=yes,scrollbars=yes').focus(); return false;\">Search Tips</a>\n" +
	"</p>\n" +
	"<form id=\"monogram_header_searchform\" class=\"mastheadSearchForm halfline\" action=\"http://www.monogram.com/search/results/product.htm\" name=\"SiteSearchForm\" method=\"get\" target=\"_top\">\n" +
	"<input class=\"text\" type=\"text\" name=\"q\" maxlength=\"150\" />\n" +
	"<input class=\"image\" type=\"image\" src=\"http://www.monogram.com/images/button_search.gif\" value=\"SEARCH\" width=\"75\" height=\"18\" alt=\"Product Search\" title=\"Product Search\" />\n" +
	"</form>\n" +
	"</div>\n" +
	"\n" +
	"<div id=\"emblem_container\">\n" +
	"<a href=\"http://www.monogram.com/\"><img src=\"http://www.monogram.com/images/header_monogram_emblem_white.jpg\" alt=\"GE Monogram&reg;\" title=\"GE Monogram&reg;\" width=\"108\" height=\"48\" border=\"0\" /></a>\n" +
	"</div>\n" +
	"\n" +
	"<div id=\"nav_header_menu\">\n" +
	"\n" +
	"<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"menu1\" class=\"ddmx\">\n" +
	"<tr>\n" +
	"<td>\n" +
	"<div class=\"item1_container\">\n" +
	"<a class=\"item1\" href=\"http://www.monogram.com/products/\"><img id=\"tab_image_products\" class=\"rollover\" src=\"http://www.monogram.com/images/tabs/products.gif\" alt=\"Products\" title=\"Products\" width=\"116\" height=\"27\" /></a>\n" +
	"\n" +
	"<!-- begin Products flyout -->\n" +
	"<div class=\"section\" id=\"flyout_products\">\n" +
	"<a class=\"item2 arrow\" href=\"http://www.monogram.com/products/refrigeration.htm\">Refrigeration Systems</a>\n" +
	"<div class=\"section\">\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0058&amp;SITEID=MON2&amp;MONWEB=MH0044\">30&quot; Fully Integrated</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0057&amp;SITEID=MON2&amp;MONWEB=MH0009\">Built-in Side-by-Sides</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0057&amp;SITEID=MON2&amp;MONWEB=MH0010\">Free-Standing Side-by-Sides</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0058&amp;SITEID=MON2&amp;MONWEB=MH0011\">Built-In Bottom-Freezers</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0058&amp;SITEID=MON2&amp;MONWEB=MH0043\">Free-Standing Bottom-Freezers</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0055&amp;SITEID=MON2&amp;MONWEB=MH0012\">Built-In All-Refrigerators</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0061&amp;SITEID=MON2&amp;MONWEB=MH0013\">Built-In All-Freezers</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0013&amp;SITEID=MON2&amp;MONWEB=MH0001\">Icemakers</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0052&amp;SITEID=MON2&amp;MONWEB=MH0014\">Wine Reserve Refrigerators</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0052&amp;SITEID=MON2&amp;MONWEB=MH0015\">Beverage Centers</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0022&amp;SITEID=MON2&amp;MONWEB=MH0016\">Double-Drawer Refrigerators</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0024&amp;SITEID=MON2&amp;MONWEB=MH0017\">Fresh Food Refrigerators</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0021&amp;SITEID=MON2&amp;MONWEB=MH0018\">Outdoor/Indoor Refrigerator</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0025&amp;SITEID=MON2&amp;MONWEB=MH0019\">Bar Refrigerators with Icemaker</a>\n" +
	"</div>\n" +
	"<a class=\"item2 arrow\" href=\"http://www.monogram.com/products/cooking.htm\">Cooking Products</a>\n" +
	"<div class=\"section\">\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0078&amp;SITEID=MON2&amp;MONWEB=MH0023\">Professional Ranges</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0081&amp;SITEID=MON2&amp;MONWEB=MH0024\">Professional Range Tops</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0081&amp;SITEID=MON2&amp;MONWEB=MH0025\">Gas Cooktops</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0070&amp;SITEID=MON2&amp;MONWEB=MH0026\">Electric Cooktops</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0068&amp;SITEID=MON2&amp;MONWEB=MH0027\">Built-In Wall Ovens&nbsp;&mdash; Single</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0068&amp;SITEID=MON2&amp;MONWEB=MH0028\">Built-In Wall Ovens&nbsp;&mdash; Double</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0076&amp;SITEID=MON2&amp;MONWEB=MH0029\">Microwave Ovens&nbsp;&mdash; Built-In</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0077&amp;SITEID=MON2&amp;MONWEB=MH0030\">Microwave Ovens&nbsp;&mdash; Compact</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0068&amp;SITEID=MON2&amp;MONWEB=MH0031\">Trivection&reg; Ovens</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0076&amp;SITEID=MON2&amp;MONWEB=MH0032\">Advantium&reg; Ovens</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0065&amp;SITEID=MON2&amp;MONWEB=MH0033\">Warming Drawers</a>\n" +
	"</div>\n" +
	"<a class=\"item2 arrow\" href=\"http://www.monogram.com/products/ventilation.htm\">Ventilation Systems</a>\n" +
	"<div class=\"section\">\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0051&amp;SITEID=MON2&amp;MONWEB=MH0034\">Wall Mount</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0050&amp;SITEID=MON2&amp;MONWEB=MH0035\">Island Mount</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0046&amp;SITEID=MON2&amp;MONWEB=MH0036\">Telescopic Downdrafts</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0051&amp;SITEID=MON2&amp;MONWEB=MH0037\">Custom Hood Inserts</a>\n" +
	"</div>\n" +
	"<a class=\"item2 arrow\" href=\"http://www.monogram.com/products/dishwashers.htm\">Dishwashers &amp; Compactors</a>\n" +
	"<div class=\"section\">\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0086&amp;SITEID=MON2&amp;MONWEB=MH0038\">Dishwashers</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0027&amp;SITEID=MON2&amp;MONWEB=MH0039\">Compactors</a>\n" +
	"</div>\n" +
	"<a class=\"item2 arrow\" href=\"http://www.monogram.com/products/outdoor.htm\">Outdoor Products</a>\n" +
	"<div class=\"section\">\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0072&amp;SITEID=MON2&amp;MONWEB=MH0040\">Grills</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=RESULTSPAGE&amp;CATEGORY=CA0021&amp;SITEID=MON2&amp;MONWEB=MH0042\">Outdoor/Indoor Refrigerators</a>\n" +
	"</div>\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/products/energy_efficient.htm\">Energy Efficient Products</a>\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/whats_new/\">New Products</a>\n" +
	"</div>\n" +
	"<!-- end Products flyout -->\n" +
	"\n" +
	"</div>\n" +
	"</td>\n" +
	"<td>\n" +
	"<div class=\"item1_container\">\n" +
	"<a class=\"item1\" href=\"http://www.monogram.com/whats_new/\"><img id=\"tab_image_whats_new\" class=\"rollover\" src=\"http://www.monogram.com/images/tabs/whats_new.gif\" alt=\"What's New\" title=\"What's New\" width=\"127\" height=\"27\" /></a>\n" +
	"</div>\n" +
	"</td>\n" +
	"<td>\n" +
	"<div class=\"item1_container\">\n" +
	"<a class=\"item1\" href=\"http://www.monogram.com/find_a_dealer/\"><img id=\"tab_image_find_a_dealer\" class=\"rollover\" src=\"http://www.monogram.com/images/tabs/find_a_dealer.gif\" alt=\"Find A Dealer\" title=\"Find A Dealer\" width=\"147\" height=\"27\" /></a>\n" +
	"</div>\n" +
	"</td>\n" +
	"<td>\n" +
	"<div class=\"item1_container\">\n" +
	"<a class=\"item1\" href=\"http://www.monogram.com/get_inspired/\"><img id=\"tab_image_get_inspired\" class=\"rollover\" src=\"http://www.monogram.com/images/tabs/get_inspired.gif\" alt=\"Get Inspired\" title=\"Get Inspired\" width=\"137\" height=\"27\" /></a>\n" +
	"\n" +
	"<div class=\"section\" id=\"flyout_get_inspired\">\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/all-in-good-food/\"><i>All in Good Food</i><br />Monogram Chefs website</a>\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/for_the_trade/design_center/\">GE Monogram Design Center&nbsp;&mdash;<br />New York</a>\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/get_inspired/kitchen_tours/\">Kitchen Tours</a>\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/get_inspired/home_gallery/\">Home Photo Galleries</a>\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/get_inspired/see_whats_cooking/couturier.htm\">Robert Couturier's Kitchen</a>\n" +
	"</div>\n" +
	"\n" +
	"</div>\n" +
	"</td>\n" +
	"<td>\n" +
	"<div class=\"item1_container\">\n" +
	"<a class=\"item1\" href=\"http://www.monogram.com/service_and_support/\"><img id=\"tab_image_service_and_support\" class=\"rollover\" src=\"http://www.monogram.com/images/tabs/service_and_support.gif\" alt=\"Service &amp; Support\" title=\"Service &amp; Support\" width=\"183\" height=\"27\" /></a>\n" +
	"\n" +
	"<div class=\"section\" id=\"flyout_service_and_support\">\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/service_and_support/\">Service for Your Monogram</a>\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/service_and_support/literature.htm\">Monogram Literature</a>\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/service_and_support/register.htm\" target=\"_blank\">Register Your Appliance</a>\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/service_and_support/contact_us.htm\">Contact Us</a>\n" +
	"</div>\n" +
	"\n" +
	"</div>\n" +
	"</td>\n" +
	"<td>\n" +
	"<div class=\"item1_container\">\n" +
	"<a class=\"item1\" href=\"http://www.monogram.com/for_the_trade/\"><img id=\"tab_image_for_the_trade\" class=\"rollover\" src=\"http://www.monogram.com/images/tabs/for_the_trade.gif\" alt=\"Design Specs\" title=\"Design Specs\" width=\"147\" height=\"27\" /></a>\n" +
	"\n" +
	"<div class=\"section\" id=\"flyout_for_the_trade\">\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/for_the_trade/design_center/\">GE Monogram Design Center&nbsp;&mdash;<br />New York</a>\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/for_the_trade#product_search\">Product Search for Professionals</a>\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/for_the_trade/faqs/\">Installation FAQs &amp; Tips</a>\n" +
	"<a class=\"item2\" href=\"http://products.geappliances.com/ApplProducts/Dispatcher?REQUEST=FORTHETRADERESULT\">Comprehensive Product List</a>\n" +
	"<a class=\"item2\" href=\"http://www.monogram.com/for_the_trade/library/\">Professional Library</a>\n" +
	"</div>\n" +
	"\n" +
	"</div>\n" +
	"</td>\n" +
	"</tr>\n" +
	"</table>\n" +
	"\n" +
	"</div> <!-- / nav_header_menu -->\n" +
	"\n" +
	"<div class=\"hr\"></div>\n" +
	"\n" +
	"</div> <!-- / nav_header -->\n" +
	"\n"
);

if (!String.prototype.negateEveryWord) {
	String.prototype.negateEveryWord = function () {
		var s = this;
		s = s.replace(/(^|\s)(?=\S)/g, "$1-");
		return s;
	};
}

function populateMastheadSearchForm () {
	if (typeof(jQuery) !== "undefined") {
		jQuery(document).ready(function ($) {
			var query;
			if (/(?:^|\?|\&)q=([^\?\&\=]+)/.test(location.search) ||
			    /(?:^|\?|\&)as_q=([^\?\&\=]+)/.test(location.search) ||
			    /(?:^|\?|\&)as_epq=([^\?\&\=]+)/.test(location.search) ||
			    /(?:^|\?|\&)as_oq=([^\?\&\=]+)/.test(location.search)) {
				// extract the first nonblank of the following:
				// - q      = regular search
				// - as_q   = advanced search: all these words
				// - as_epq =                  exact wording or phrase
				// - as_oq  =                  one or more of these words
				query = decodeURIComponent(RegExp.$1.replace(/\+/g, " ")).trim();
				if (/(?:^|\?|\&)as_eq=([^\?\&\=]+)/.test(location.search)) {
					// as_eq = unwanted words
					query = query + " " + 
						(decodeURIComponent(RegExp.$1.replace(/\+/g, " ")).
						 trim().
						 negateEveryWord());
				}
				$("form.mastheadSearchForm").find("input[name='q']").val(query);
			}
		});
	}
}

function addSearchFormValidation () {
	if (typeof(jQuery) !== "undefined") {
		jQuery(document).ready(function ($) {
			$("form.mastheadSearchForm").each(function () {
				var form = this;
				if (validateSiteSearchForm) {
					form.onsubmit = function () {
						return validateSiteSearchForm(this);
					};
				}
			});
			$("form.advancedSearchForm").each(function () {
				var form = this;
				if (validateAdvancedSearchForm) {
					form.onsubmit = function () {
						return validateAdvancedSearchForm(this);
					};
				}
			});
		});
	}
}

populateMastheadSearchForm();
addSearchFormValidation();


