if (document.getElementById) {
		document.onkeydown = escapekey;
}

function escapekey(e) {
	var code;
	if (!e) e = window.event;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
	if ((code == 27) && (e.ctrlKey == false) && (e.altKey == false)) hideLogin();
}


function showLogin(islogin, rp)
{


	var f = document.forms['login'];
	if (document.getElementById && f) {
		if (typeof(rp) != 'undefined') {
			f.retpath.value = rp;
		}
		if (islogin == 2) {
			islogin = (login && login.length > 1);
		}
		
		document.getElementById('login-form').style.display = 'block';
	}

}

function hideLogin()
{
	if(document.getElementById('login-form')) document.getElementById('login-form').style.display = 'none';
	return false;
}

function getCookie(n)
{
	return false;
}

function CheckCookie()
{
	return false;
}

function CheckSession(rp)
{
	showLogin(2, rp);
}


function settime()
{
	document.forms['login'].timestamp.value = new Date().getTime();
}


function unescape_opera(text) {
	if(typeof(RegExp) == 'function') {
		re = /quot;/g;  
		newstr=text.replace(re, ''); 
		re = /&/g; 
		return newstr.replace(re, '"');  
	} 
	else return text;
}

function Popup (Pars)
{
  var V = Pars.split (',');
  var theURL = '', winName = '', features = new Array ();
  var Width = 0, Height = 0;
  for ( i = 0; i < V.length; i++ )
  {
    var V1 = V[i].split ('=');
    if ( V1[0] == 'url' )
      theURL = V[i].replace (/url=/, '');
    else
      if ( V1[0] == 'winname' )
        winName = V[i].replace (/winname=/, '');
      else
      {
        if ( V1[0] == 'width' )
          Width = V1[1];
        if ( V1[0] == 'height' )
          Height = V1[1];
        features.push (V[i]);
      }
  }
  var Left = (window.screen.availWidth - Width) / 2;
  var Top = (window.screen.availHeight - Height) / 2;
  features.push ('left=' + Left);
  features.push ('top=' + Top);
  window.open (theURL, winName, features.join(','));
}
function Rand ()
{
  return Math.round (Math.random () * 12345678);
}
