/***************************************************************************************************
 *函数功能：设置Cookie值
 *参数说明：strName Cookie名称 strValue Cookie值
 *创建时间：2008年3月19日
 *创建人员：刘津
****************************************************************************************************/
function SetCookie(strName,strValue)
{
	document.cookie = strName +"="+strValue;
}

/***************************************************************************************************
 *函数功能：设置Cookie值 并给出有效时间
 *参数说明：strName Cookie名称 strValue Cookie值
 *创建时间：2008年4月10日
 *创建人员：刘津
****************************************************************************************************/
function SetCookieAndTime(strName,strValue,nHour)
{
	
	var date = new Date();
    var ms = nHour*3600*1000;
    date.setTime(date.getTime() + ms);
	
	document.cookie = strName +"="+strValue+"; expires=" + date.toGMTString()+";path=/";
}

/***************************************************************************************************
 *函数功能：读取Cookie值
 *参数说明：strName Cookie名称 
 *创建时间：2008年3月19日
 *创建人员：刘津
****************************************************************************************************/
function GetCookie(strName)
{
	var cookieArray = document.cookie.split(";");
	var cookie = "";

	for(var i = 0;i<cookieArray.length;i++)
	{
		
		var arr = cookieArray[i].split(",");
		
		for(var j = 0;j<arr.length;j++)
		{
			var arrcookie = arr[j].split("=")
			
			if (arrcookie[0].replace(/\s/g,"")==strName.replace(/\s/g,""))
			{
				
				cookie = arrcookie[1];
			}
		}
	}
	
	return cookie;
}


/***************************************************************************************************
 *函数功能：删除Cookie值
 *参数说明：strName Cookie名称 
 *创建时间：2008年4月10日
 *创建人员：刘津
****************************************************************************************************/
function delCookie(strName)
{
	//为了删除指定名称的cookie，可以将其过期时间设定为一个过去的时间
    var date;
	date = new Date();
    date.setTime(date.getTime() - 10000);
    document.cookie = strName + "=a; expires=" + date.toGMTString();
	
   }







