document.form1.login.focus();
function checkForm()
{
msg = new Array()
if($("#login").val() == "") msg.push("Please type in a username");
if($("#pwd").val() == "") msg.push("You need to type in your password");
if (msg != "") {
noty({
text: msg.join('
'),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
_timeout: 1500,
});
return false;
}
else
return true;
}
function guestLogin()
{
theme = $("#themeselector").val();
lang = $("#languageselector").val();
url = "../op/op.Login.php?login=guest";
if(theme)
url += "&sesstheme=" + theme;
if(lang)
url += "&lang=" + lang;
if (document.form1.referuri) {
url += "&referuri=" + escape(document.form1.referuri.value);
}
document.location.href = url;
}
$(document).ready( function() {
/*
$('body').on('submit', '#form', function(ev){
if(checkForm()) return;
ev.preventDefault();
});
*/
$('body').on('click', '#guestlogin', function(ev){
ev.preventDefault();
guestLogin();
});
$("#form").validate({
invalidHandler: function(e, validator) {
noty({
text: (validator.numberOfInvalids() == 1) ? "The form still contains # error.".replace('#', validator.numberOfInvalids()) : "The form still contains # errors.".replace('#', validator.numberOfInvalids()),
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 1500,
});
},
messages: {
login: "Please type in a username",
pwd: "You need to type in your password"
},
});
});