function setStatus(msg)	{
	status=msg;
	return true;
}

var appWindow = null

function CreateMainWindow(form) {
	document.Login.loginname.value = form.name.value;
	document.Login.loginpassword.value = form.password.value;
	
	var ok = VerifyForm(form)
	
	if (ok && (!appWindow || appWindow.closed)) {
		form.name.value = "";
		form.password.value = "";
		
		var avail_width = screen.availWidth - 10;
		var avail_height = screen.availHeight - 93;
				
		appWindow = window.open("","MainApp", "toolbar,scrollbars,resizable,status,width="+avail_width + ",height=" + avail_height + ",top=0,left=0");

		document.Login.target = "MainApp";
		document.Login.submit();

		appWindow.opener = null;		
	}
	else if (ok) {
		form.name.value = "";
		form.password.value = "";
		document.Login.target = "MainApp";
		document.Login.submit();
		appWindow.focus();		
	}
}

function VerifyForm(form) {
  if (document.Login.loginname.value == "")
  {
    alert("Please enter a value for the Username field.");
    form.name.focus();
    return (false);
  }

  if (document.Login.loginname.value.length < 5)
  {
    alert("Please enter at least 5 characters in the Username field.");
    form.name.focus();
    return (false);
  }

  if (document.Login.loginname.value.length > 20)
  {
    alert("Please enter at most 20 characters in the Username field.");
    form.name.focus();
    return (false);
  }

  var checkOK = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ. ";
  var checkStr = document.Login.loginname.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
	alert("The following character in your Username is invalid: " + ch);
    	form.name.focus();
    	return (false);
    }
  }

  if (document.Login.loginpassword.value == "")
  {
    alert("Please enter a value for the Password field.");
    form.password.focus();
    return (false);
  }

  if (document.Login.loginpassword.value.length < 4)
  {
    alert("Please enter at least 4 characters in the Password field.");
    form.password.focus();
    return (false);
  }

  if (document.Login.loginpassword.value.length > 8)
  {
    alert("Please enter at most 8 characters in the Password field.");
    form.password.focus();
    return (false);
  }

  return (true);
}

function Verify() {
	window.open('https://digitalid.verisign.com/as2/7c6f672a5b9108bc281f38e9a7a7db6d','Verify','width=718,height=500,resizable,scrollbars')
}

function IsJavaEnabled() {
	if (navigator.javaEnabled()) {
		return true;
	}
	return false;
}
