function getCookie(name) {
	var pairs = document.cookie.split("; ");
	for (i = 0; i < pairs.length; i++) {
		pair = pairs[ i ].split("=");
		if (pair[ 0 ] == name) return unescape(pair[ 1 ]);
	}
	return null;
}

function setCookie(name, value) {
	document.cookie = name+"="+escape(value)+"; path=/";
}

function deleteCookie(name) {
	document.cookie = name+"=; path=/; expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function cookiesEnabled(name) {
	setCookie(name, 1);
	var t = getCookie(name);
	deleteCookie(name);
	return t;
}

var pagecount = getCookie("p_sanb")||0;
setCookie("p_sanb",++pagecount);

var h = location.hash; var hl = h.length;
if( hl ) setCookie("a_sanb",h.substr(1,hl-1));

if( pagecount == 1 && cookiesEnabled("zzz") ) {
	var sid = Math.random();
	sid += "";
	sid = sid.substr(2,sid.length-2);
	setCookie("i_sanb",sid);
	with( window.location ) {
		if( search ) { href = pathname+search+"&Welcome"; }
		else         { href = pathname+"?Welcome";        }
	}
}

