// JavaScript Document
document.observe('dom:loaded', function(e) {
	if($('product-search')) {
		$('product-search').observe('change', function(v) {
			 // get the current URL
				var sParam = this.value;
				var url = window.location.toString(); //get the parameters 
				url.match(/\?(.+)$/); 
				var base = url.substring(0,url.indexOf("?")+1);
				var params = RegExp.$1;
				// split up the query string and store in an 
				// associative array 
				var params = params.split("&"); 
				var queryStringList = {}; 
				for(var i=0;i<params.length;i++) { 
					var tmp = params[i].split("=");
					if(i!=0 && tmp[0]!="s") {
						base = base + "&";
					}
					if(tmp[0]!="s") {
						base = base + params[i];
					}
				}
				base = base + "&s=" + sParam;
				window.location.href = base;
			});
	}
}, false);
