function SetCookie(name, value, expires, path, domain, secure) {
     document.cookie = name + "=" + escape(value) + 
     ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
     ((path == null) ? "" : "; path=" + path) +
     ((domain == null) ? "" : "; domain=" + domain) +
     ((secure == null) ? "" : "; secure");
}

//get the value of a specific cookie in the cookie string
function GetCookie(name) {
	var cname = name + "=";
	var dc = document.cookie;
	if(dc.length > 0) {
		begin = dc.indexOf(cname);
		if(begin != -1) {
			begin += cname.length;
			end = dc.indexOf(";", begin);
			if(end==-1) {
				end = dc.length;
			}
			return unescape(dc.substring(begin, end));
		}
	}
	return null;
}

function DelCookie(name, path, domain)
{
	if(GetCookie(name)) {
	document.cookie = name + "= " +
	((path = null) ? "" : "; path=" + path) + 
	((domain = null) ? "" : "; domain=" + domain) + 
	"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function openWindow(url, attribs) {
	var newWind = window.open(url, '', attribs);
    if (newWind.opener == null) {
	    window.opener = self;
    }
}