
var arrRecords = new Array();
var arrCookie = new Array();
var recCount = 0;
var strRecord = "";
var WTUserSegment = "";
expireDate = new Date;
expireDate.setDate(expireDate.getDate()+90);

function cookieVal(cookieName) {
	var thisCookie = document.cookie.split("; ")
	for (i = 0; i < thisCookie.length; i++) {
		if (cookieName == thisCookie[i].split("=")[0]) {
			return thisCookie[i].split("=")[1];
		   }
	}
	return 0;
}

function loadCookie() {
	
	var result = null;
	
	if(document.cookie != "" && cookieVal("Records") != 0) {
		arrValue = cookieVal("Records");
		arrRecords = arrValue.split(",");
		result = currentRecord();
	}
	return result;
}

function setRec(s1,s2) {
	arrRecords[0] = s1;
	arrRecords[1] = s2;
	document.cookie = "Records="+arrRecords+";expires=" + expireDate.toGMTString();
	//alert("setSegment:"+arrRecords);
}

function currentRecord() {
	var result = null;
	if (arrRecords.length != "") {
		//strRecord = arrRecords[recCount];
		//currRecord = strRecord.split(":");
		//alert("getSegment:"+currRecord[0]);
		//result = currRecord[0];
		result = arrRecords;
	}
	return result;
}

function navigate() {
	recCount = 0;
	currentRecord();
}
    
if (!Array.prototype.splice) {	
	function array_splice(ind,cnt) {
		if (arguments.length == 0) return ind;
		if (typeof ind != "number") ind = 0;
		if (ind < 0) ind = Math.max(0,this.length + ind);
		if (ind > this.length) {
			if (arguments.length > 2) ind = this.length;
			else return [];
		}
		if (arguments.length < 2) cnt = this.length-ind;
		cnt = (typeof cnt == "number") ? Math.max(0,cnt) : 0;
		removeArray = this.slice(ind,ind+cnt);
		endArray = this.slice(ind+cnt);
		this.length = ind;
		for (var i = 2; i < arguments.length; i++) {
			this[this.length] = arguments[i];
		}
		for(var i = 0; i < endArray.length; i++) {
			this[this.length] = endArray[i];
		}
		return removeArray;
	}
	Array.prototype.splice = array_splice;
}

recCount = 0;
WTUserSegment = loadCookie();