/*****************************************************************
  Copyright Avaya Ltd 2003
  http://www.avaya.com

  ConsoleRequestLogoff.js
  Author: Laoise Murphy
*****************************************************************/
<!-- -->Sorry your browser needs Javascript enabled
<!--

// active and appWindow are set on load
var active = new String("no");
var appWindow = null;
var httpConnection = new ActiveXObject("Msxml2.XMLHTTP");

//
function requestLogoff()
{
  if (appWindow && !appWindow.closed)
    {
      appWindow.logoff();
    }
  else if(httpConnection != null)
    {
      // cannot access the child window - send a logoff request to the server and re-display login page
      if(httpConnection.readyState != 2 && httpConnection.readyState != 3)
	{
	  httpConnection.open("POST", "console-conference-operation?Op=requestlogoff", true);
	  httpConnection.setRequestHeader("Content-Type", "text/xml");
	  httpConnection.onreadystatechange = displayLoginPage;
	  httpConnection.send();
	}
    }
}


function displayLoginPage()
{
  if (httpConnection.readyState == 4)
    {
      if (window.opener && !window.opener.closed)
	{
	  try 
	    {
	      if (active.match("yes"))
		{
		  window.opener.location.href = "http://" + document.domain + "/console/console-login?active=yes";
		}
	      else
		{
		  window.opener.location.href = "http://" + document.domain + "/console/console-login";
		}
	    }
	  catch (e) 
	    {
	      // window.opener.closed always returns false in IE 5.0
	      // so this will through an exception if window.opener is closed
	    }   
	}
    }
}

	
// -->
