<!-- 处理搜索关键字的提示信息的保存，在显示查询列表时调用 -->
function log(kw,sum,leaf){
	//alert("=====log(kw,sum)1====="+frombar);
	var pattern = /opromote-a0-s1-b-g-c-j-r-m-d-p-b/;
	//alert(location);
	var frombar=pattern.test(location);
	//不管是输入关键字搜索的还是点击提示搜索的都保存记录
	//modifier: Eluli
	//frombar = true;
	if (frombar) {
		var url = '/fulltext/search_log.do';
		var pars = 'keyword=' + kw + '&resultCount=' + sum + '&leaf=' + leaf;
		//alert("=====log(kw,sum,leaf)3====="+pars);
		new Ajax.Request(url, {
			method: "post",
			parameters: pars
		});
		//search_log_cookie(kw);
	}
}
<!-- 保存用户输入的查询关键字，在查询表单提交时调用 -->
function search_log_cookie(kw){
	if (kw && kw != "") {
		var log_cookie = getCookie("search_log");
		//alert("=========search_log_cookie(kw)isExist?========"+log_cookie);
		var expire_time = new Date((new Date()).getTime() + 30 * 24 * 3600000).toGMTString();
		if (!log_cookie) {
			document.cookie = "search_log=" + encodeURI(kw) + ";expires=" + expire_time+";domain=.'+no3wUrl+';path=/";
		}else {
			//alert(decodeURI(log_cookie));
			//alert("=========search_log_cookie(kw)!=null,1========"+decodeURI(log_cookie));
			var log_cookie_array = decodeURI(log_cookie).split(":||:");
			var length = log_cookie_array.length;
			var exists = false;
			for (var i = 0; i < length; i++) {
				if (log_cookie_array[i] == kw) {
					exists = true;
					break;
				}
			}
			//alert(decodeURI(exists));
			if (!exists) {
				if (length >= 5) {
					var index = log_cookie.indexOf(":||:");
					log_cookie = log_cookie.substring(index + 4);
				}
				document.cookie = "search_log=" + log_cookie + ":||:" + encodeURI(kw) + ";expires=" + expire_time+";domain=."+no3wUrl+";path=/";
				//alert("=====search_log_cookie(kw)!=null, 2========="+document.cookie);
			}
		}
	}
}
		


function list_search_log(){
	var log_cookie=getCookie("search_log");
	//alert("====list_search_log()===="+decodeURI(log_cookie));
	if(log_cookie){
		document.write('<div class="border4 mt6" >');
		document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
		document.write('<tr><td class="left_title2"><strong>您的搜索记录</strong></td></tr>');
		document.write('<tr><td class="list1"><div><ul>');
		
		var log_cookie_arr=log_cookie.split(":||:");
		for(var i=0;i<log_cookie_arr.length;i++){
			document.write('<li><a href="/search/0/k'+log_cookie_arr[i]+'/o-a1-s1-b-g-c-j-r-m-d-p">');
			document.write(getShowStr(decodeURI(log_cookie_arr[i])));
			document.write('</a></li>');
		}
		document.write('</ul></div>');
		document.write('<div style="padding-left:30px; padding-bottom:10px; text-align:left"><input type="button" name="Submit" value=" 清 除 " onclick="clear_search_log_cookie();"/></div>');
		document.write('</td></tr></table></div>');
	}
}

function getShowStr(str){
	if(!str)
	 return "";
	//alert(str.length);
	if(str.length>12)
	 return str.substr(0,12)+"...";
	return str;
}

function clear_search_log_cookie(){
	var expire_time=new Date((new Date()).getTime(  )).toGMTString();
	document.cookie = "search_log=;expires=" + expire_time+";domain=."+no3wUrl+";path=/";
	if($('search_history_div'))
		$('search_history_div').innerHTML="";
}

