var interval = "";

// Starts the timeout countdown.

function startInterval()
{
  interval = window.setTimeout( "logoutWarn()" , 600000 );
}

// Resets the interval as the user continues with activity on the page.
function resetInterval()
{
  window.clearInterval( interval );
  interval = window.setInterval( "logoutWarn()" ,600000 );
}

// When the orginal interval is met send the user to the logout warning page.
function logoutWarn()
{
  // if we are already on the logoutwarning page just log then out
  // otherwise take them to the logout warning.
  if( window.location.href.indexOf( "logout_warning" ) > 0 )
  {
    window.location.href = '/home/logout';
  }
  else
  {
    window.location.href = '/login/logout_warning'+'?'+'return_to='+location.href;
  }
} 