        //Global Variables
        var tID = ''; var cnt = 0; var cntPopUp=0; var blnNo=0;
        
        
        //function to clear the count and start the timer again
        function LogOffAlertReset()
        {
            //tie onmousemove event to the function - LogOffAlertReset
            document.onmousemove = LogOffAlertReset
            document.onkeydown = LogOffAlertReset
            clearTimeout(tID)
            cnt = 0;
            ShowLogOffAlert()
	        
        }

        //Function to count the time and after specified time show the Confirmation Div
        function ShowLogOffAlert()
        {
	            cnt++;
	            var objcntPopUp = document.forms[0].elements['LogOutPopUp1$txtAutoLogOutTimer'];
	            if (objcntPopUp!=null)
	            {
		            if(cnt == objcntPopUp.value) 
		            { 
		                ShowLogOffConfirmation();
		                oresetDiv();
		                cnt = 0;
		            }
		            tID = setTimeout("ShowLogOffAlert()",1000);
		        }
        }


        var tID_Div = '';
        function oresetDiv()
        {
	        blnNo=0;
	        clearTimeout(tID_Div)
	        InputEventCaptureStart();
        }

        function InputEventCaptureStart()
        {
            if(blnNo==0)
            {
                cntPopUp++
                var ObjCount = document.forms[0].elements['LogOutPopUp1$txtAutoLogOutTimer'];
	            if(cntPopUp==ObjCount.value)
		            fnLogOffYes();
		        tID_Div = setTimeout("InputEventCaptureStart()",1000);
            }
            else    
            {
            }
	    }

        function fnLogOffNo()
        {
	        HideLogOffConfirmation();
	        cnt = 0;
	        cntPopUp = 0;
	        blnNo = 1;
	        LogOffAlertReset();
        }
         
        function fnLogOffYes()
        {
            _is_redirect_allowed = true;
            var urlPrefix = '';
            var mainURL = document.location.href.split("?")[0];
            //First hide the confirmation box
            HideLogOffConfirmation();
            //Log the user off
            clsUtility.LogOut();
            if (mainURL.search('/EZFAFSA/') == -1 && mainURL.search('/FAFSA/') == -1)
            {
                switch(document.forms[0].elements['LogOutPopUp1$txtAffiliateCode'].value)
                {
                    case "OFAS":
                        window.location = 'EZFAFSA/fafsa.aspx';
                    break;
                    case "SFAS":
                        window.location = 'FAFSA/fafsa.aspx';
                    break;
                }
            }
            else
                window.location = 'Default.aspx';
        }

        function ShowLogOffConfirmation()
        {
            document.documentElement.scrollTop = 0;
            document.documentElement.style.overflow = 'hidden'
            
            var frmZIndex = document.forms[0].style.zIndex;
            //var objDivBack = document.forms[0].elements['LogOutPopUp1$divBack'];
            var objDivBack = document.getElementById('divBack');
            objDivBack.style.position = 'absolute';
            objDivBack.style.top = 0;
            objDivBack.style.left = 0;
            objDivBack.style.width = window.screen.width;
            objDivBack.style.height = window.screen.height;
            objDivBack.style.zIndex = frmZIndex + 1;
            objDivBack.style.display='block'
                        
            //var objDivConfirm = document.forms[0].elements['LogOutPopUp1$divConfirm'];
            var objDivConfirm = document.getElementById('divConfirm');
            
            //alert("Width : " + divConfirmWidth + "\n" + "Height : " + divConfirmHeight + "\n" + "ScreenX : " + window.screenX)
            objDivConfirm.style.left = ((window.screen.width / 2) - (objDivConfirm.style.width.replace('px','') / 2)) + 'px'
            //objDivConfirm.style.top = ((window.screen.height / 2) - (objDivConfirm.style.height.replace('px','') / 2)) + 'px'
            objDivConfirm.style.top = ((window.screen.height / 2) - 150) + 'px'
	        objDivConfirm.style.zIndex = frmZIndex + 2;
	        objDivConfirm.style.display='block';
	        
	        //alert(document.documentElement.style.overflow);
	        
        }

        function HideLogOffConfirmation()
        {
	        document.getElementById('divConfirm').style.display='none';
	        document.getElementById('divBack').style.display='none';
	        document.documentElement.style.overflow = 'auto'
	        
        }
