//opening actions


var countDownTime = 1200000;
var timeID;
var countDownID;
var parseLimitResetValue = 30;
var limit="0:" + parseLimitResetValue;
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1


function resetTimer(myTime) {
clearTimeout(timeID); // reset the timer
  timeID = setTimeout('finalCountdown()', myTime);//relocate page in 2 minutes
}


function finalCountdown(){
	
	if (!document.images) {
		return
		}
		if (parselimit==1) {
			window.location="index.cfm?method=members.processLogout"
		} else { 
			parselimit-=1
			curmin=Math.floor(parselimit/60)
			cursec=parselimit%60
			}
		if (curmin!=0) {
			curtime= cursec;
		} else {
			curtime=cursec;
			var innerText = 'For your safety and protection your online session will end in <br /><br />' + '<span style="color:#990000;">'+ curtime +'</span>' + ' seconds. <br /><br />If you would like to continue this session, please click the button below. <br /><br /><a href=""><img src="../assets/images/global/buttons/continueOnly.gif"/></a>';
			var wrapper = document.getElementById('layAuthentication');
			
			if(wrapper) {
				$("#layAuthentication").html(innerText);
			} else {
				$("#layGlobalWrapper").prepend("<div id='layAuthenticationVeil'></div><div id='layAuthentication'>" + innerText + "</div>");
			}
			

			countDownID = setTimeout("finalCountdown()",1000);
			
		}
}
		
function resetCountdown() {
	clearTimeout(countDownID);
	parselimit=parseLimitResetValue;
}



// JavaScript Document
var fadeDuration = 800; //time in milliseconds
var myTimeOut = 0;
var authenticateBox = $('#layAuthentication');

if(authenticateBox != null) {

$('#layAuthentication').css({top: '150px'});


$(window).scroll(function () { 
		if (myTimeOut != 0) {
			clearTimeout(myTimeOut);
		}
      	thisScroll = window.pageYOffset;
		logScrollOld = $('#layAuthentication').css('top');
		logScrollNew = thisScroll+150 + 'px';
		myTimeOut = setTimeout('$("#layAuthentication").animate({ top: logScrollNew }, fadeDuration)', 100);
		
    });



}




document.onmousemove = function(){resetTimer(countDownTime);};
document.onkeypress = function(){resetTimer(countDownTime);};

