// JavaScript Document
function getcookie (name) 
{ 
	var arg = name + "="; 
	var alen = arg.length; 
	var clen = window.document.cookie.length; 
	var i = 0; 
	while (i < clen)
	{ 
		var j = i + alen; 
		if (window.document.cookie.substring(i, j) == arg) return getCookieVal (j); 
		i = window.document.cookie.indexOf(" ", i) + 1; 
		if (i == 0) break; 
	} 
	return null;
}

function getCookieVal (offset)
{ 
	var endstr = window.document.cookie.indexOf (";", offset); 
	if (endstr == -1)
	{
	  endstr = window.document.cookie.length; 
	}
	return unescape(window.document.cookie.substring(offset, endstr));
}

function SetCookie(name, value)
//Éè¶¨CookieÖµ
{
var expdate = new Date();
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
+((secure == true) ? "; secure" : "");
}

function DelCookie(name,path)
//É¾³ýCookie
{
var exp = new Date();
exp.setTime (exp.getTime() - 300*1000);
var cval = getcookie (name);
document.cookie = name + "=" + cval + ";path=" + path +"; expires="+ exp.toGMTString();
}

