
function selword(p_word)
{
	var keyword = document.search.key.value;
	if(keyword.indexOf(p_word) == -1)
	{
		if(keyword == '' || keyword == ' ')
		{
			document.search.key.value = p_word; 
		}else{
			document.search.key.value = keyword + ' ' + p_word; 
		}
	}
}

function delword()
{
	var keyword = document.search.key.value;

	document.search.key.value = keyword.substring(0,keyword.lastIndexOf(' '));

}

function getCookie(name) {
	if (!name || !document.cookie) return "";

	var cookies = document.cookie.split("; ");
	for (var i = 0; i < cookies.length; i++) {
		var str = cookies[i].split("=");
		if (str[0] != name) continue;
		return decodeURIComponent(str[1]);
	}
	return "";
}

function setCookie(name, value, domain, path, expires, secure) {
	if (!name) return;

	var str = name + "=" + encodeURIComponent(value);
	if (domain) {
		if (domain == 1) domain = location.hostname.replace(/^[^\.]*/, "");
		str += "; domain=" + domain;
	}
	if (path) {
		if (path == 1) path = location.pathname;
		str += "; path=" + path;
	}
	if (expires) {
		var nowtime = new Date().getTime();
		expires = new Date(nowtime + (60 * 60 * 1000 * expires));
		expires = expires.toGMTString();
		str += "; expires=" + expires;
	}
	if (secure && location.protocol == "https:") {
		str += "; secure";
	}

	document.cookie = str;
}
