
function CookiesAreEnabled() {
rhrn = new Date();
rhrnt1 = rhrn.getTime();
rhrns1 = rhrn.getSeconds();
rhrnm1 = rhrn.getMinutes();
rhrnh1 = rhrn.getHours();

// this is arbitrary - it just looks like a normal cookie
cookievar1 = "ViperScanWeb" + rhrnh1 + rhrnm1 + rhrns1;
SetCookie ('tracker_id', cookievar1);

if (GetCookie('tracker_id') == cookievar1)
{
	rhrn2 = new Date();
	rhrnt2 = rhrn2.getTime();
}
else
{
	rhrnt2 = 0
}

if (rhrnt2 < (rhrnt1 + 300) && rhrnt2 > 0)
{
	DeleteCookie ("ViperScanWeb");
	return true;
}
else
{
	if (rhrnt2 == 0)
	{
		DeleteCookie ("ViperScanWeb");
		return false;
	}
	else
	{
		DeleteCookie ("ViperScanWeb");
		return true;
	}

}
DeleteCookie ("ViperScanWeb");
}

function getCookieVal(offset) {
var endstr = document.cookie.indexOf(";", offset);
if (endstr == -1)
 endstr = document.cookie.length;
return unescape(document.cookie.substring(offset,endstr));
}

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 "";
}

function SetCookie(name,value) {
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] : null;
document.cookie = name + "=" + escape(value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path))+
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {
 var exp = new Date();
 exp.setTime (exp.getTime() -1);
 var cval = GetCookie (name);
 document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function updateCookie () {

	var expdate = new Date ();

	expdate.setTime (expdate.getTime() + (30 * 24 * 60 * 60 * 1000)); // 30 days from now 

	//Date Field
	//SetCookie ("DateField", document.all.cboDateFilterField.value, expdate);
	//Date Field Start Date
	SetCookie ("StartDate", document.all.EdtStartDate.value, expdate);
	//Date Field End Date
	SetCookie ("EndDate", document.all.EdtEndDate.value, expdate);
	
	//Reference Field	
	//SetCookie ("ReferenceField", document.all.cboFilterField.value, expdate);
	//Reference Field Value
	//SetCookie ("ReferenceValue", document.all.EdtValue.value, expdate);
	
	//Operator	
	//SetCookie ("Operator", document.all.cboOperator.value, expdate);
	//Carrier - valid for shippers/receivers only
	//SetCookie ("Carrier", document.all.cboCarrier.value, expdate);
	// Records per page
	//SetCookie ("RecordsPerPage", document.all.cboRecPerPage.value, expdate);
	SetCookie ("RecordsPerPage", 50, expdate);
}

function SaveANDSearch(CurrentSearch) {

SetCookie("ANDSEARCH",CurrentSearch)

}

function SaveANDSearchCode(CurrentSearch) {

SetCookie("ANDSEARCHCODE",CurrentSearch)

}

function getCookieData () {
	GetCookie('ANDSEARCH');

}

function initialize () {
   getCookieData();

}

function GetListText(ListObject) {
 return ListObject.options(ListObject.selectedIndex).text;
}

function GetListValue(ListObject) {
 return ListObject.options(ListObject.selectedIndex).value;
}
