// login.js

function CheckAdminLogin() {

	if (document.WebLocAdminLogin.adminuid.value == "") {
		alert("Please enter your Administrator User ID");
		document.WebLocAdminLogin.adminuid.focus();
		return false;
	}

	if (document.WebLocAdminLogin.adminpassword.value == "") {
		alert("Please enter your Administrator Password");
		document.WebLocAdminLogin.adminpassword.focus();
		return false;
	}

	return true;

}

function focusMe() {

	var autLogin = "<%=saveInfoChecked%>";

	document.cssLogin.username.focus();

	if (autLogin != "") {
		//autoLogin();
	}

}


function Authmode_(a, Path) {
	if (a == "checked") {
		window.location = Path + "?authmode=0";
	}
	else{
		window.location = Path + "?authmode=1";
	}

}

function checkLogin() {
	
	var authMode = document.cssLogin.authModeSelect.value
	
	if ( authMode != "CurrentNT" )
	{
	    if (document.cssLogin.txtUserID.value == "") {
		    alert("Please enter your user name.");
		    document.cssLogin.txtUserID.focus();
		    return false;
	    }
	    if (document.cssLogin.txtPassword.value == "") {
		    alert("Please enter your user password.");
		    document.cssLogin.txtPassword.focus();
		    return false;
	    }
	}
	
	if ( authMode == "DifferentNT" )
	{
	    if (document.cssLogin.domain.value == "") {
		    alert("Please enter your domain.");
		    document.cssLogin.domain.focus();
		    return false;
	    }
    }
    
	if (document.cssLogin.txtServer.value == "") {
		alert("Please enter server name.");
		document.cssLogin.txtServer.focus();
		return false;
	}
	if (document.cssLogin.txtRepository.value == "") {
		alert("Please enter repository name.");
		document.cssLogin.txtRepository.focus();
		return false;
	}
	
}

function checkpwd() {
	if (document.changepwd.txtChangedPWD.value == "") {
		alert("Please enter a new password.");
		document.changepwd.txtChangedPWD.focus();
		return false;
	}
	if (document.changepwd.txtReEnter.value == "") {
		alert("Please confirm your new password.");
		document.changepwd.txtReEnter.focus();
		return false;
	}
	if (document.changepwd.txtReEnter.value != changepwd.txtChangedPWD.value) {
		alert("Your password value entered does not match the confirmation value.");
		document.changepwd.txtChangedPWD.focus();
		return false;
	}
	
	if (document.changepwd.txtReEnter.value == changepwd.txtPassword.value) {
		alert("Your new password must be different than the current password.");
		document.changepwd.txtChangedPWD.focus();
		return false;
	}
}

function closeMe() {

	this.close();

}

function autoLogin() {

	var newSecond = cssLogin.logon.value;

	if (newSecond != "") {
		newSecond = newSecond - 1;
		document.cssLogin.logon.value = newSecond;

		if (newSecond > 0) {
			setTimeout("autoLogin()",1000)
			document.cssLogin.logon.value = newSecond;
		}
		else {	
			document.cssLogin.submit();
		}
	}
	
}

function breakOutOfFrames() {

	if (parent.frames.length > 0) {
		parent.location.href = location.href;
	}

}
