/*
Function: displayLogin
	Parameters:
		blnValue: this represents the status of the login
					0: normal login
					1: logout
					2 or 32 or 42: to many failures - can't login again.
					3: redirect to subscriberHome on success
					4: continue to events page
*/

var winModalWindow;

function IgnoreEvents(e)
{
  return false
}
 
function displayLogin(blnValue,intToManyTries)
{
	if (blnValue != '1')
	{
		if ((window.showModalDialog) && (navigator.userAgent.indexOf('Win') > 0))  // is it IE and Windows
		{
 			if (blnValue == '2' || blnValue == '32' || blnValue == '42')
			{
				var resp = showModalDialog('wfLoginPopup.aspx?B=IE&BV=' + blnValue + '&Error=1&Failed=' + intToManyTries.toString(),'Login','dialogWidth:330px;dialogHeight:250px;toolbar=0;scrollbars=1;status=0;resizable=0;fullscreen=0;');
			}
			else
			{
				var resp = showModalDialog('wfLoginPopup.aspx?B=IE&BV=' + blnValue,'Login','dialogWidth:330px;dialogHeight:250px;toolbar=0;scrollbars=0;status=0;resizable=0;fullscreen=0;');
			}

			if (resp == null || resp == 'cancel' || resp == '')
			{
				runPostBack = false;
				return false;
			}
			else
			{
				document.getElementById("UcInternalHeader1_ucMainMenu_txtLPUsername").value = resp.split('+')[0];
		document.getElementById("UcInternalHeader1_ucMainMenu_txtLPPassword").value = resp.split('+')[1];
		document.getElementById("UcInternalHeader1_ucMainMenu_txtLPHash").value = location.hash;
				__doPostBack("CheckLogin",blnValue);
			}		
		}
		else
		{
		//window.top.captureEvents (Event.CLICK|Event.FOCUS|Event.MOUSEDOWN|Event.MOUSEUP);
		/*   window.top.captureEvents (Event.CLICK|Event.MOUSEMOVE|Event.CLICK|Event.DBLCLICK|Event.MOUSEDOWN|Event.MOUSEUP|Event.MOUSEOUT|Event.MOUSEOVER|Event.KEYDOWN|Event.KEYUP|Event.KEYPRESS|Event.FOCUS|Event.BLUR);
			window.top.onclick=IgnoreEvents;
		window.top.ondblclick = IgnoreEvents;
		window.top.onmousemove = IgnoreEvents;
		window.top.onmouseover = IgnoreEvents;
		window.top.onmouseout = IgnoreEvents;
		window.top.onmousedown = IgnoreEvents; 
		window.top.onmouseup = IgnoreEvents;
		window.top.onkeydown = IgnoreEvents;
		window.top.onkeypress = IgnoreEvents;
		window.top.onkeyup = IgnoreEvents;
		window.top.onblur = IgnoreEvents;

			window.top.onfocus=HandleFocus;*/

			if (blnValue == "2" || blnValue == "32")
			{
				winModalWindow = window.open ("wfLoginPopup.aspx?B=N&BV=" + blnValue + "&Error=1&Failed=" + intToManyTries.toString(),"Login","dependent=yes,width=330,height=250")
			}
			else
			{
				winModalWindow = window.open ("wfLoginPopup.aspx?B=N&BV=" + blnValue,"Login","dependent=yes,width=330,height=250");
			}
    		winModalWindow.focus();
		}
	}
	else
	{
		window.location.replace("index.aspx?Out=1");
	}
}
 
 
function HandleFocus()
{
  if (winModalWindow)
  {
    if (!winModalWindow.closed)
    {
      winModalWindow.focus();
    }
    else
    {
      //window.top.releaseEvents (Event.CLICK|Event.FOCUS|Event.MOUSEDOWN|Event.MOUSEUP);
/*      window.top.releaseEvents (Event.CLICK|Event.MOUSEMOVE|Event.CLICK|Event.DBLCLICK|Event.MOUSEDOWN|Event.MOUSEUP|Event.MOUSEOUT|Event.MOUSEOVER|Event.KEYDOWN|Event.KEYUP|Event.KEYPRESS|Event.FOCUS|Event.BLUR);
      window.top.onclick = "";
 window.top.ondblclick = "";
 window.top.onmousemove = "";
 window.top.onmouseover = "";
 window.top.onmouseout = "";
 window.top.onmousedown = ""; 
 window.top.onmouseup = "";
 window.top.onkeydown = "";
 window.top.onkeypress = "";
 window.top.onkeyup = "";
 window.top.onblur = "";*/
    }
  }
  return false
}	
