function loadLogin(act){
		var hideProgress = true;
		if(null == act){act = 'none';}
		var params = new Hash({	action: act});
		if(null != $('user')){
			params.set('user', $F('user'));
		}
		if(null != $('pass')){
			params.set('pass', $F('pass'));
		}
		new Ajax.Request('ajax_jsp/login.jsp', 
				{
					parameters: params,   
					onSuccess:
						function(transport) { 
							if (transport.responseText.match(/<error>/)){       
								setErrorInfo(transport.responseText.stripTags());
							}else{
								if((act == 'login') && (!transport.responseText.match(/Error!/)))
								{	
									hideProgress = false;
									//to fix the safari bug with the "strange" URL
									$('form').onsubmit = null;
									$('form').action = transport.responseText.stripTags();
									$('form').submit();
								}else{
									$('login_form').update(transport.responseText);
								}
							}
						},
					onFailure:function(transport){setErrorInfo(transport.responseText.stripTags());}, 
					onCreate: function(){$('progress').show();},
					onComplete: function(){if(hideProgress)$('progress').hide();}				   
				});
}

function loadUsername(act){
		if(null == act){act = 'none';}
		var rf = null;
		
		var params = new Hash({	action: act});
		if(null != $('txt_uid')){
			params.set('uid', $F('txt_uid'));
		}
		new Ajax.Request('ajax_jsp/username.jsp', 
				{
					parameters: params,   
					onSuccess:
						function(transport) { 
							if (transport.responseText.match(/<error>/)){       
								setErrorInfo(transport.responseText.stripTags());
							}else{
								$('login_form').update(transport.responseText);
							}
						},
					onFailure:function(transport){setErrorInfo(transport.responseText.stripTags());}, 
					onCreate: function(){$('progress').show();},
					onComplete: function(){$('progress').hide();}				   
				});
}

function loadChangePassword(act, update){
	if(null == act){act = 'none';}
	var rf = null;
	
	var params = new Hash({action: act});
	if(null != $('hid_uid')){
		params.set('uid', $F('hid_uid'));
	}
	if(null != $('hid_fromurl')){
		params.set('fromurl', $F('hid_fromurl'));
	}
	if(null != $('hid_tmp')){
		params.set('guid', $F('hid_tmp'));
	}
	if(null != $('txt_pass')){
		params.set('pass', $F('txt_pass'));
	}
	if(null != $('txt_oldpass')){
		params.set('oldpass', $F('txt_oldpass'));
	}
	if(null != update){
		params.set('update', update);
	}
	new Ajax.Request('ajax_jsp/change_password.jsp', 
			{
				parameters: params,   
				onSuccess:
					function(transport) { 
						if (transport.responseText.match(/<error>/)){       
							setErrorInfo(transport.responseText.stripTags());
						}else{
							$('login_form').update(transport.responseText);
						}
					},
				onFailure:function(transport){setErrorInfo(transport.responseText.stripTags());}, 
				onCreate: function(){$('progress').show();},
				onComplete: function(){$('progress').hide();}				   
			});
}
function logIN(username, password){
	var params = new Hash({	action: 'login',
							user: username,
							pass: password});
	new Ajax.Request('ajax_jsp/login.jsp', 
			{
				parameters: params,   
				onSuccess:
					function(transport) { 
						if (transport.responseText.match(/<error>/)){       
							setErrorInfo(transport.responseText.stripTags());
						}else{
							window.location = transport.responseText.stripTags();
						}
					},
				onFailure:function(transport){setErrorInfo(transport.responseText.stripTags());}, 
				onCreate: function(){$('progress').show();},
				onComplete: function(){$('progress').hide();}				   
			});
}
function checkDataConsistencyPassChange() 
{
	if($('txt_oldpass') && $F('txt_oldpass').blank()){
		alert('The field ' + $('txt_oldpass').title +' should not be empty!');
		return false;
	}
	if($F('txt_pass').blank()){
		alert('The field ' + $('txt_pass').title +' should not be empty!');
		return false;
	}
	if(($F('txt_pass')!=$F('txt_confirmpass'))){
		alert('The values in '+$('txt_pass').title +' and ' + $('txt_confirmpass').title+' are different!');
		return false;			
	}

	return true;
}

function addAction(act){
	if ('' != action) action = action + '\r\n';
	action = action + act;
}

function setgetActionFunc(f){
	getactionfunc = f;
}
function toggleDiv(divid, group){
	if(null == group)group='';
	else group = '.' + group;
	isSelected = false;
	$$(group + '.selected').each(function(item){
			Effect.toggle(item.id, 'blind', {duration:0.8, transition: Effect.Transitions.linear } );
			item.removeClassName('selected');
			if(divid == item.id){
				isSelected = true; throw $break;
			}
	});
	
	if(!isSelected){
		Effect.toggle(divid, 'blind', {duration:0.8, transition: Effect.Transitions.linear});
		$(divid).addClassName('selected');
	}
}
function setFocus(id)
{
	$(id).activate();
}