var Comunity = new function() {
	var urlmodulo="index.php?mod=community";
	
	this.ayuda = function(form) {
		var url = urlmodulo+"&exec=submit";
		var target = 'ayudaError';
		
		form.action=url;
		return AIM.submit(form, {
						'onStart' : function() { 
							//$('accountError').innerHTML = "<img src='images/loader_bar.gif'/>"; 
							return true; 
						},
						'onComplete': function(res) { 
							$(target).innerHTML = res;
						}
				});
			
	};
	
	
	this.search = function() {
		document.location.href=urlmodulo+"&exec=ayuda&"+Form.serialize("frmSearch");
		
	};
	
	this.login = function() {
		var url = urlmodulo+"&exec=submit";
		var params = Form.serialize("frmLogin");
		var target = 'loginError';

		var ajax = new Ajax.Updater(
			{success: target},
			url,
			{	method: 'post', 
				parameters: params,
				evalScripts: true,
				onComplete: function(res) { 
				},
				onLoading: function(res) { 
					$(target).innerHTML = "<img src='images/loading.gif'/>"; 
				},
				onFailure: function() { 
					$(target).innerHTML = "An error occurred"; 
				} 
			});
	};

	this.message = function() {
		alert("go!!!");
		var href=document.location.href;
		document.location.href=href;
	};
	
	this.send = function() {
		var url = urlmodulo+"&exec=getpassw";
		var params = Form.serialize("frmForgot");
		var target = 'forgotError';

		var ajax = new Ajax.Updater(
			{success: target},
			url,
			{	method: 'post', 
				parameters: params,
				evalScripts: true,
				onComplete: function(res) { 
				},
				onLoading: function(res) { 
					$(target).innerHTML = "<img src='images/loading.gif'/>"; 
				},
				onFailure: function() { 
					$(target).innerHTML = "An error occurred"; 
				} 
			});
	};
	
	this.vote = function(idgal) {
		var url = urlmodulo+"&exec=vote";
		var params = "idgal="+idgal;
		var target = 'ayudaError';

		var ajax = new Ajax.Updater(
			{success: target},
			url,
			{	method: 'post', 
				parameters: params,
				evalScripts: true,
				onComplete: function(res) { 
				},
				onLoading: function(res) { 
				//	$(target).innerHTML = "<img src='images/loading.gif'/>"; 
				},
				onFailure: function() { 
					$(target).innerHTML = "An error occurred"; 
				} 
			});
	};
	
	this.sendMensaje = function() {
		alert("your password was sent!!!");
		
		var href=document.location.href;
		document.location.href=href;
	};
	
	this.ayudaMensaje = function(msg) {
		alert(msg);
		document.location.href="index.php?mod=community&exec=ayuda";
	};
	
	this.mensaje = function(msg,accion) {
		alert(msg);
		if (accion=1) {	
			var link=document.location.href;
			document.location.href=link;
			//document.location.href="index.php?mod=community&exec=ayuda";
		}	
	};
	
	this.updmensaje = function(msg) {
		alert(msg);
		document.location.href="index.php?mod=community";
	};
	
	this.foto = function(form) {
		var url = urlmodulo+"&exec=submit";
		var target = 'uplError';
		
		form.action=url;
		return AIM.submit(form, {
						'onStart' : function() { 
							//$('accountError').innerHTML = "<img src='images/loader_bar.gif'/>"; 
							return true; 
						},
						'onComplete': function(res) { 
							$(target).innerHTML = res;
						}
				});
			
	};
	
	this.focusVideo = function(field) {
		if (field.value=='http://') {
			field.value='';
		}
	};
}
