
var cookieF = ''
var cookieS = ''
var cookieI = ''

function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1){ endstr = document.cookie.length; }
	return unescape(document.cookie.substring(offset, endstr));
}

function FixCookieDate (date) {
	var base = new Date(0);
	var skew = base.getTime(); 
	if (skew > 0){date.setTime (date.getTime() - skew);}
}

function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg){ return getCookieVal (j); }
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break; 
	}
	return null;
}

function SetCookie (name,value,expires,path,domain,secure) {
	document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}

function DeleteCookie (name,path,domain) {
	if (GetCookie(name)) {
		document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function getLCookie(NameOfCookie){
	if (document.cookie.length > 0) { 
	var begin = document.cookie.indexOf(NameOfCookie+"="); 
	if (begin != -1){ 
		begin += NameOfCookie.length+1; 
		var end = document.cookie.indexOf(";", begin);
		if (end == -1) end = document.cookie.length;
		return unescape(document.cookie.substring(begin, end)); } 
	}
	return ''
}


function getLocalCookie(){
	cookieF = getLCookie('llF')
	if (cookieF==''){
		var v = GetCookie('llF')
		if (v != null){ cookieF = v } else {cookieF = ''}
	}
	cookieS = getLCookie('llS')
	if (cookieS==''){
		var v = GetCookie('llS')
		if (v != null){ cookieS = v } else {cookieS = ''}
	}
}

function setLocalCookie(f,s){
	document.cookie = 'llF=' + escape(f)
	document.cookie = 'llS=' + escape(s)
}

function fetchNCLBTCookie(){
//	var v = GetCookie('llF')
//	if (v != null){ cookieF = v } else {cookieF = ''}
//	var v2 = GetCookie('llS')
//	if (v2 != null){ cookieS = v2 } else {cookieS = ''}
//	getLocalCookie()
	var v3 = GetCookie('llI')
	if (v3 != null){ cookieI = v3 } else {cookieI = ''}
}

function storeNCLBTCookie(f,s,i){
	var expdate = new Date ();
//	expdate.setTime (expdate.getTime() + (20 * 1000)); // 20 seconds from now
//	expdate.setTime (expdate.getTime() + (4 * 60 * 60 * 1000)); // 4 hrs from now
	expdate.setTime (expdate.getTime() + (365 * 24 * 60 * 60 * 1000)); // 1 year from now

//	SetCookie('llF', f, expdate)
//	SetCookie('llS', s, expdate)
//	setLocalCookie(f,s)
	SetCookie('llI', i, expdate)
//	if (getLCookie('llF') == ''){
//		SetCookie('llF', f, expdate)
//		SetCookie('llS', s, expdate)
//	}
}

function cookieOn(){
	var v3 = GetCookie('llLI')
	if (v3 != null){ return true } else { return false }
}

