var Singin = new function() {
		
	this.signup= function(){
		var url = "index.php?mod=login";
		document.location.href=url;
	}
	
	this.logout = function() {
		var url = "index.php?mod=login&exec=logout";
		var params = ""
		var target = 'showLogin';

		var ajax = new Ajax.Updater(
			{success: target},
			url,
			{	method: 'post', 
				evalScripts: true,
				parameters: params,
				onLoading: function(res) { 
					$(target).innerHTML = "<img src='images/loading.gif'/>"; 
				},
				onComplete: function(res) { 
					//document.write(res.responseText);
				},
				onFailure: function() { 
					$(target).innerHTML = "An error occurred"; 
				} 
			});
	};
	
	this.validate = function() {
		var url = "index.php?mod=login&exec=login";
		var params = Form.serialize("logintopForm");
		var target = 'showLogin';
		
		var overlay = new Overlay();

		var ajax = new Ajax.Updater(
			{success: target},
			url,
			{	method: 'post', 
				evalScripts: true,
				parameters: params,
				onLoading: function(res) { 
					//$(target).innerHTML = "<img src='images/loading.gif'/>"; 
					overlay.show();
				},
				onComplete: function(res) { 
					//document.write(res.responseText);
					overlay.hide();
				},
				onFailure: function() { 
					$(target).innerHTML = "An error occurred"; 
				} 
			});
	};
	
	this.resetForm = function() {
		//$("logintop").focus();
	//	$("logintop").value="Username...";
	//	$("clavetop").value="Password...";
//		$("logintop").focus();
	};

	this.switchType = function(fieldPassword) {
		if (fieldPassword.value=='Password...') {
			try {
				fieldPassword.type='password';
				fieldPassword.value='';
			} catch(e){
				$("changePassword").innerHTML="<input name=\"clavetop\" type=\"password\" class=\"bgcelda2\" id=\"clavetop\" value=\"\"/>";
				$("clavetop").focus();
				$("clavetop").focus();
			}
		}
	};
}
