

		
		mam.search  = new function() {
			
			mam.config.initialize(function(){
				$(document).ready(function(){
					
					var clearSearchField = function(obj) {
						$(obj).toggleClass("searchFocusColor");
						var searchField = obj.value;
						if (searchField == "Search")
						{
							obj.value = "";	
						}
					};
					
					var resetForeColor = function(obj) {
						$(obj).toggleClass("searchFocusColor");
					};
				
					var siteConfig = mam.config.getSiteConfigXml();
					//alert(siteConfig);
					var modules = siteConfig.getElementsByTagName("module");
					//var paths = "/core/legal,/core/how_we_do_it";
					var paths = "/";				
					
					for (var i = 0; i < modules.length; i++) 
					{
						if (modules[i].getAttribute("path") != null) 
						{
							if (paths == "")
							{
								paths = modules[i].getAttribute("path");
							}
							else
							{
								paths += ',' + modules[i].getAttribute("path");
							}
							
						}
					}
					
					
					var html = '<div id="search-widget"><form action="/core/search/results.html">';
					html += '<input type="hidden" name="sp_a" value="sp10037811" />';
					html += '<input type="hidden" name="sp_p" value="all" />';
					html += '<input type="hidden" name="sp_e" value="3"/>';
					html += '<input type="hidden" name="sp_f" value="ISO-8859-1" />';
					html += '<input type="hidden" name="sp_g" value="2" />';
					html += '<input type="hidden" name="resultsperpage" value="5" />';
					html += '<input type="hidden" name="maxresults" value="100" />';
					html += '<input type="hidden" name="path" value="' + paths + '" />';
					
					html += '<fieldset>';
					html += '<input id="search-criteria" id="sp_q" name="sp_q" type="text" value="Search" />';
					html += '<input type="image" id="searchimage" value="Go" src="/core/library/images/search.gif\" alt="Click here to perform the search" />';
					html += '</fieldset>';
					html += '</form></div>';
					
					//Add search div to body and add functions/classes to its objects
					$("body").append(html);
					$("#searchimage").addClass("searchimage");
					$("#search-criteria").focus(function(){clearSearchField(this);});
					$("#search-criteria").blur(function(){resetForeColor(this);});
					
				});
			},{siteConfigXml: true});
		}	
	


