<!--
function sessionWindow() {
	 var d = window.open('sessionRefresh.cfm','refresh','width=500,height=200,top=50,left=50,resizable');
	// get active window
	// get window size
	// inner width and height
	if(d == null)
	{
	var w,h;
	if (self.innerHeight) // all except Explorer
	{
		w = self.innerWidth;
		h = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		w = document.documentElement.clientWidth;
		h = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		w = document.body.clientWidth;
		h = document.body.clientHeight;
	}

//Scrolling offset
//How much the page has scrolled.

	var x,y;
	if (self.pageYOffset) // all except Explorer
	{
		x = self.pageXOffset;
		y = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	}
	// find active window
	
	var width = 500;
	var height = 200;
	d = document.createElement("DIV");
	d.setAttribute("id","timeOutDiv");
	d.style.width = width+"px";
	d.style.height = height+"px";
	d.style.border = "solid black 2px";
	d.style.textAlign = "center";
	d.style.position = "absolute";
	d.style.padding = "2px";
	var ww = (w-width)/2;
	var hh = (h - height)/2;
	var t = y+hh;
	d.style.top = t+"px";
	d.style.left = ww+"px";
	d.style.backgroundColor = "white";
	d.style.zOrder = 1000;
	//d.innerHTML = "timeout "+ww+" "+hh;
	var f = document.createElement("iframe");
	f.style.width="90%";
	f.style.height = "90%";
	f.style.border = "0px";
	f.src = "sessionrefreshA.cfm";
	d.appendChild(f);
	document.body.appendChild(d);
	//d.scrollIntoView(true);
	}
	return d;
}

var increment = 5000;
var timeOutWindow = null;
var sessionTime = new Date();// should be milliseconds
sessionTime = sessionTime.valueOf(); // milliseconds current time
var threshhold = sessionTime +expire_time - thresh;
var theTime = null;
function watchTime() {
	theTime = new Date();
	theTime = theTime.valueOf(); // now in milliseconds
	if(window.feedbackLoaded == 1 || document.getElementById('liveclock'))
	{
		var theClock = document.getElementById('liveclock');
		t = threshhold-theTime+thresh;
		t = Math.floor(t / 1000);
		m = Math.floor(t/60);
		t = t-m*60;
		t = t.toString();
		t = (t.length <2)?'0'+t:t;
		theClock.innerHTML = m+":"+t;
		if(m < 3)
		{
			theClock.style.color = "Red";
		}
		else
		{
			theClock.style.color = "Black";
		}
	}
	if(theTime > threshhold)
	{
		if (!timeOutWindow)
		timeOutWindow = sessionWindow();
	}
	timer = setTimeout('watchTime()',increment);
}
function resetTime() {
	sessionTime = new Date();// should be milliseconds
	sessionTime = sessionTime.valueOf(); // milliseconds current time
	threshhold = sessionTime +expire_time - thresh;
	theTime = new Date();
	theTime = theTime.valueOf(); // now in milliseconds
}
// SessionTick.cfm?"+token
function resetSession(token)
{
	try 
	{
		xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (ex) 
	{
		try 
		{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e2) 
		{
			xmlHttp = false;
		}
	}
	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') 
	{
		xmlHttp = new XMLHttpRequest();
	}
	if(xmlHttp)
	{
		host = "LOCAL";
		var sURL = getServerName();
		var sPath = location.pathname;
		if(sURL.indexOf('.')> -1)
		{
			host = (sPath.toUpperCase().indexOf("DEMO") > -1) ? "DEMO" : "LIVE";
		}
		if(host == "LOCAL")
		{
			sURL +="/wp";
		}
		sURL += "/SessionTick.cfm?"+token;
		xmlHttp.open("GET",sURL,true);
		xmlHttp.onreadystatechange = function()
		{
			if(xmlHttp.readyState == 4) 
			{
				resetTime();

			}
		}
		xmlHttp.send(null);
	}
}


//-->
