<!--
		var WAVE_PATH = "http://www.wavelife.com/";
		//since this is included in the aspx files, define equivalent of AG_WEB_PATH in constants.cs
		var ajaxRequestHandler = WAVE_PATH + "bin/SearchAjaxProxy.aspx"; //notice that ajax request is routed thru a asp proxy script
		//var ajaxRequestHandler = WAVE_PATH + "prs/index.php?module=Search&action=SearchAjax"; //notice that ajax request is routed thru a asp proxy script
		
		function Search(str)
		{
			if(str != "")
			{
				var ajaxRequest = new Ajax.Request(ajaxRequestHandler, 
					{method:"get", parameters:"method=Search&term=" + str, onComplete:SearchAjaxResponse});
			}
			else
			{
				RemoveNodes("divResult");
				ResultBorder();
			}
		}
		
		function SearchAjaxResponse(ajaxResponse)
		{
			var xmlData = responseToXML(ajaxResponse);

			RemoveNodes("divResult");
	
			for(var i = 0; i < xmlData.getElementsByTagName("result").length; i++)
			{
				if(i < 10)
				{
					var id = xmlData.getElementsByTagName("result")[i].attributes[0].nodeValue;
					var name = xmlData.getElementsByTagName("name")[i].firstChild.nodeValue;
					var table = xmlData.getElementsByTagName("table")[i].firstChild.nodeValue;
					//alert(id + " " + name + " " + table);
					var shortName;
					var div = document.createElement("div");
					div.id = i;
					div.style.width = "100%"; //IE
					div.style.background = "white";
					div.onmouseover = function() { this.style.background = "#acd1fb"; this.style.cursor = "pointer"; } /* cursor - FF */
					div.onmouseout = function() { this.style.background = "#ffffff"; }
					div.onclick = function() { window.location=document.getElementById("a_" + this.id).href; } /* href - FF */
					div.title = name;
					
					if(name.length > 28)
					{
						shortName = name.substr(0, 28).toLowerCase();
						shortName = shortName.substr(0, shortName.lastIndexOf(' ')) + "...";
					}
					else
					{
						shortName = name.toLowerCase();
					}
					
					if(table == "1")
						div.innerHTML = "<a id='a_" + i + "' href='" + WAVE_PATH + "prs/product/" 
							+ id + "' class='suggest'>" + shortName + "</a>"; /* width - IE */
					else if(table == "2")
						div.innerHTML = "<a id='a_" + i + "' href='" + WAVE_PATH + "prs/category/" 
							+ id + "' class='suggest'>" + shortName + "</a>";
					else if(table == "3")
						div.innerHTML = "<a id='a_" + i + "' href='" + WAVE_PATH + "prs/brand/" 
							+ id + "' class='suggest'>" + shortName + "</a>";
					else if(table == "4")
						div.innerHTML = "<a id='a_" + i + "' href='" + WAVE_PATH + "Article/ArticleView/" 
							+ id + "/' class='suggest'>" + shortName + "</a>";
					else if(table == "5")
						div.innerHTML = "<a id='a_" + i + "' href='" + WAVE_PATH + "Article/ArticleCategory/" 
							+ id + "/' class='suggest'>" + shortName + "</a>";
					else if(table == "6")
						div.innerHTML = "<a id='a_" + i + "' href='" + WAVE_PATH + "Article/ShowIssue/" 
							+ id + "/' class='suggest'>" + shortName + "</a>";

					document.getElementById("divResult").appendChild(div);
				}
				else
				{
					//alert("len=" + xmlData.getElementsByTagName("result").length + " while i=" + i);
					break;
				}
			}
			
			ResultBorder();
		}
		
		function ResultBorder()
		{
			if(document.getElementById("divResult").hasChildNodes() == false)
			{
				document.getElementById("divResult").style.borderBottom = "0px solid #fff";
				document.getElementById("divResult").style.borderLeft = "0px solid #fff";
				document.getElementById("divResult").style.borderRight = "0px solid #fff";
			}
			else
			{
				document.getElementById("divResult").style.borderBottom = "1px solid #000";
				document.getElementById("divResult").style.borderLeft = "1px solid #000";
				document.getElementById("divResult").style.borderRight = "1px solid #000";
			}
		}
		
		function SearchSubmit() //search button submit only
		{
			if(document.getElementById("txtSearch").value != "")
			{
				/*
				var search = document.createElement("hidden");
				search.name = "hdnSearch";
				search.value = document.getElementById("txtSearch").value;
				
				var page = document.createElement("hidden");
				page.name = "hdnPage";
				search.value = "1";
				
				document.getElementById("divResult").appendChild(search);
				document.getElementById("divResult").appendChild(page);
				
				document.getElementById("hdnSearch").value = document.getElementById("txtSearch").value;
				*/
				document.getElementById("frmSearch").submit();
			}
		}
		
		function EnterSubmit(field, event)
		{
			var keycode;
			
			if(window.event)
			{
				keycode = window.event.keyCode;
				//alert("if = " + keycode);
			}
			else if(event)
			{
				keycode = event.which;
				//alert("else = " + keycode);
			}
			else
			{
				return true;
			}

			if(keycode == 13) //13 = enter
			{
				SearchSubmit();
				return false;
			}
			else
			{
				return true;
			}
		}
		
		function CloseSuggest()
		{
			var time = setTimeout("RemoveNodes('divResult'); ResultBorder();", 2000);
		}
-->