function setLoginFocus(){
with(document.loginForm)
{
if( weblogin.value == "" ) weblogin.focus();
else webpass.focus();
}
}
function checkLoginForm()
{
with( document.loginForm )
{
if( weblogin.value == "" || webpass.value == "" ) return false;
else return true;
}
}
var Login = {
ShowRetrievePassword:function() {
$("rpLink").hide();
$("loginForm").hide();
$("rpTool").show();
$("emailAddress").focus();
},
HideRetrievePassword:function() {
$("rpTool").hide();
$("rpLink").show();
$("loginForm").show();
},
SendPassword:function(cPath) {
if( $("emailAddress").value.blank() ) {
launchModal('Please enter your email address so we can send you your password', 'Reset Password Request', 'Close', 'none');
$("emailAddress").focus();
} else {
var url = cPath + "templates/dsp_sendPassword.cfm?e="+$("emailAddress").value;
new Ajax.Request( url, {asynchronous:true, evalScripts:false, onSuccess:Login.SendPassword_onSuccess, onFailure:errFunc});
}
},
SendPassword_onSuccess:function(t) {
z = parseJSON( t.responseText );
if(z.ok) {
launchModal(z.message, 'Reset Password Request', 'Close', 'none');
Login.HideRetrievePassword();
} else {
launchModal(z.message, 'Reset Password Request', 'Close', 'none');
$("emailAddress").focus();
}
}
}
function parseJSON( json ){
var o = eval('(' + json + ')');
if( o.redirectURL )
{
document.location = o.redirectURL;
return;
}
if( $("message") != null ) new Element.remove( "message" );
if( o.errMsg )
{
if( o.errMsgTitle == null ) o.errMsgTitle = "Error";
if( o.errMsgTimer == null ) o.errMsgTimer = 5000;
tw.ShowMessage( o.errMsgTitle, o.errMsg, "error", o.errMsgTimer, o.errMsgPosition );
return o;
}
if( o.msgTitle || o.msg )
{
if( o.msgTimer == null ) o.msgTimer = 5000;
tw.ShowMessage( o.msgTitle, o.msg, o.msgClass, o.msgTimer, o.msgPosition );
}
return o;
}
var errFunc = function(t) {
var win = window.open("", "win", "width=1024,height=700,resizable=yes,scrollbars=yes,status=no"); // a window object
win.document.open("text/html", "replace");
win.document.write( "Digital Crew Ajax Error"+t.responseText.replace(/^\s+|\s+$/, '') + " " );
win.document.close();
win.focus();
}
Akari |