<!-- 
Event.observe(window, 'load', function() {
	webLoginForm = $('webloginform');
	if (webLoginForm.visible()) webLoginForm.hide();	
	
	Event.observe('staffnav', 'click', function(event) {	
		Effect.toggle(webLoginForm, 'blind', {
			afterFinishInternal : function(effect) {		
				if (this.scaleFrom == 100) {
					effect.element.hide();
				} else {
					Form.focusFirstElement(effect.element.id);
				}
				effect.element.undoClipping();
			}
		});
	});
	
	loginWebUser = function() {
		if ($F('username').strip() == '' || $F('password').strip() == '')
			return;
			
		var iNow = new Date();
		var params = "&c_date_" + iNow.getTime().toString() + "=" + iNow;
		
		var myAjax = new Ajax.Request('xweblogin.html', {
			method: 'post', 
			parameters: $('loginfrm').serialize() + params,
			onLoading: function() { $('cmdweblogin').disabled = true; },
			onSuccess: function(transport) {				
				var textcontent = transport.responseText.strip();
				if (textcontent.indexOf('<xweblogin><alert>') != -1) {
					textcontent = textcontent.replace('<xweblogin><alert>', '');
					textcontent = textcontent.replace('</alert></xweblogin>', '');
					alertError('Login Error:\n' + textcontent);				
				} else if (textcontent.indexOf('<xweblogin><logout>') != -1) {
					window.location.href = window.location.href;
				}
			},
			on404: function(transport) {
				alertError('Incorrect username or password entered!');
				/* alertError('Error 404:\nlocation "' + transport.statusText + '" was not found.'); */
			},
			onFailure: function(transport) {
				alertError('Error ' + transport.status + ':\n' + transport.statusText);
			},
			onComplete: function() {
				$('cmdweblogin').disabled = false;
				Form.focusFirstElement('webloginform');
			}
		});
	}
	
});	

function alertError(msg) {
	alert(msg);
	//return false;
}
// -->