//***************Cookie相关函数开始***********************

function setCookie(name, value, expires, path, domain)
{
	if (typeof expires == "undefined")
	{
		expires = new Date(new Date().getTime() + 365*24*3600*100);
	}

	document.cookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "; path=/") +
		((domain) ? "; domain=" + domain : "");
}

function setCookie2(name, value, expires, path, domain)
{
	if (typeof expires == "undefined")
	{
		expires = new Date(new Date().getTime() + 365*24*3600*100);
	}

	document.cookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "; path=/") +
		((domain) ? "; domain=" + domain : "");
	alert("设置默认城市成功！")
}


function getCookie(name)
{
	var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
	if (arr != null)
	{
		return unescape(arr[2]);		
	}
	return null;
}

function deleteCookie(name) 
{ 
	var expdate = new Date(); 
	expdate.setTime(expdate.getTime() - (86400 * 1000 * 1)); 
	setCookie(name, "", expdate); 
	alert("操作成功！下次访问时系统将自动判断您所在的城市！\n但受众多因素影响，IP定位不一定准确，所以您看到的城市不一定就是您所在的城市！")
} 
//***************Cookie相关函数结束***********************
