<!--
// 08/15/2001 9:17 am. Took, fixed JS Login error in IE.
// 02/20/2001 Noi add login options Fast/Secure
// 12/07/2000 05:04:PM Pot, add checkkey function
var log_in;
/*
function testSite(){
	if (document.form1.the_site.value.length < 1 ){
		validatePrompt (document.form1.the_site, "Please enter an organization name.")
		return (false);
	} else
	return (true);
}
*/
function testMail(){
	if (document.form1.the_mail.value.length < 1 ){
		validatePrompt (document.form1.the_mail, "Please enter a valid email address to login.")
		return (false);
	} else
	return (true);
}

function testPW(){
	if (document.form1.the_pass.value.length < 1 ){
		validatePrompt (document.form1.the_pass, "Please enter a valid password.")
		return (false);
	} else
	return (true);
}

function testNewName(){
	if (document.form1.new_name.value.length < 1 ){
		validatePrompt (document.form1.new_name, "Please enter a new username.")
		return (false);
	} else
	return (true);
}

function testNewPW(){
	if (document.form1.new_pass.value.length < 1 ){
		validatePrompt (document.form1.new_pass, "Please enter a valid new password.")
		return (false);
	} else
	return (true);
}

function testNewPW2(){
	if (document.form1.new_pass2.value.length < 1 ){
		validatePrompt (document.form1.new_pass2, "Please re-enter the new password.")
		return (false);
	} else
	return (true);
}

function submitit () {
	if (!testMail()) return;
	if (!testPW()) return;
	Ctrl = document.form1.fromlogin;
	if (Ctrl.value.length<1){
		if (!testNewPW()) return;
		if (!testNewPW2()) return;
	}
	//Set();
	log_in=1;
	document.form1.submit();
	return;
}

function ok(e) {
	if(e.which==13){
		/*
		if((document.form1.my_action.value=='question') || ( document.form1.my_action.value=='question2'))
			SubmitHint(document.form1)
		else
			submitit();
		*/
		document.form1.submit();
	}
}
if (navigator.userAgent.indexOf("Mozilla/3.0") == -1) 
{
/*<?	
	$browsName = GetBrowserName();
	if (!ereg("IE",$browsName)) {
		print ("window.captureEvents(Event.KEYPRESS);\n");
		print ("window.onkeypress=ok;\n");
	}
?>*/
	if(navigator.appName == 'Netscape'){
		window.captureEvents(Event.KEYPRESS);
		window.onkeypress=ok;
	}
}


function validatePrompt(Ctrl,PromptStr){
	alert (PromptStr)
	Ctrl.focus();
	return;
}

function Set() 
{
	var Then = new Date();
	Then.setTime(Then.getTime() + 24 * 365 * 60 * 60 * 60 * 1000);
	document.cookie = "SOLCookie1="+document.form1.the_mail.value+"; expires=" + Then.toGMTString();
    document.cookie = "SOL_LOG_OPTION="+document.form1.log_ops.options[document.form1.log_ops.selectedIndex].value+"; expires=" + Then.toGMTString();
}

function LoginScheduleOnline(){
	//Set();
	document.form1.submit();
}
function Get(fromfile)
{
//fromfile =0 login,login_change; =1 admin_change_hint; =2 forget_password
	if (fromfile==2){
/*	<?
	if (($my_action == 'question')||( $my_action == 'question2'))
		print ("showhint = 1;");
	?>*/
	}
	if (!showhint){
		if (fromfile<2){
		document.form1.the_pass.value = "";
		}
		document.form1.the_mail.value = getCookie("SOLCookie1");
		if(!fromfile){
			document.form1.new_name.value = getCookie("SOLCookie2");
		}
		if(document.form1.the_mail.value)
			if (fromfile<2){
				this.document.form1.the_pass.focus();
			}
		else
			this.document.form1.the_mail.focus();
	}
}
function Get2()
{
	document.form1.the_pass.value = "";
	if(document.form1.the_mail.value)
		this.document.form1.the_pass.focus();
	else
		this.document.form1.the_mail.focus();
}

function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return "";
	} else
		begin += 2;
	var end = document.cookie.indexOf(";", begin);
	if (end == -1)
		end = dc.length;
		return unescape(dc.substring(begin + prefix.length, end));
}


function Unsetlogout(){
	log_in=1;
	return;
}

function noback(){
	if(log_in==1){
		return;
	}
/*	<?
	if ($logout == 1)
		print ("window.location=$SOL_URL/login.html?logout=1");
	?> */
	if(log_out){
		window.location = SOL_URL+'/login.html?logout=1';
	}
	return;
}

function checkkey (event) {
	var AsciiCode = 0;
	if(window.event)
		AsciiCode = window.event.keyCode;
	else
		AsciiCode = event.which;
	if (AsciiCode == 13)
		submitit();
}

//-->
