rules_grabar_datos = {
evento : function() {
             $("a.participa").click(rules_grabar_datos.ejecutar);
         },
ejecutar : function() {
               p=parametros(this.href);
               if(!$(this).parents("form").find(".acepto").is(":checked")){
                   aviso("Debe aceptar las condiciones del concurso.");
                   return false;
               }
               fin = function (html){
                   if(validarErr(html)){
                       if(html != "MAX" && html != "MAX_HOY")
                           aviso("Gracias por participar en el concurso");
                       else if(html == "MAX")
                           		aviso("No puede participar más veces en este concurso");
                          	else
                          		aviso("Hoy no puede participar más veces en este concurso");
                       return false;
                   }
               }
               $.ajax({ url: "/modulo/comunidad.html", data: p['aP'], success: fin });
               return false;
           }
}
$(document).ready(rules_grabar_datos.evento);
rules_mostrar_bases = {
evento : function() {
             $("a.ajaxBases").click(rules_mostrar_bases.ejecutar);
         },
ejecutar : function() {
               p=parametros(this.href);
               fin = function (html){
                   $("#modal").html(html).popUp();
               }
               $.ajax({ url: "/modulo/index.html", data: p['aP'], success: fin });
               return false;
           }
}
$(document).ready(rules_mostrar_bases.evento);
rules_mostrar_ganadores={
	evento:function(){
 		$("a.ajaxGanadores").click(rules_mostrar_ganadores.ejecutar);
	},
	ejecutar:function(){
	 	p=parametros(this.href);
	 	fin=function(html){
			$("#modal").html(html).popUp();
	 	}
	 	$.ajax({url:"/modulo/index.html",data: p['aP'],success:fin});
    return false;
  }
}
$(document).ready(rules_mostrar_ganadores.evento);
rules_busqueda_concursos = {
    evento : function() {
             $("form#buscarConcurso").submit(rules_busqueda_concursos.ejecutar);
    },
    before: function() {
    	//$().pre_loading("#columna415",img_cargando);
    },
	ejecutar : function() { 
			   idForm = this.id;
			   p = parametrosForm(idForm);			  	
			   fin = function(html)
			   {
				  $().post_loading();
                  $("div#"+p['ctn']).replaceWith(html);
                  $("div#"+p['ctn']).each(rules_busqueda_concursos.evento);
                  $("div#"+p['ctn']).each(rules_paginacion_concursos.evento);
               }
			   $.ajax({ 
			   url: "/modulo/index.html",
			   data: p['aP'],
			   beforeSend: rules_busqueda_concursos.before,
			   success: fin 
			   });
               return false;
           }
}
$(document).ready(rules_busqueda_concursos.evento);
rules_paginacion_concursos = {
    evento : function() {
                 $("a.aP").click(rules_paginacion_concursos.ejecutar);
             },
    ejecutar: function(){
                  var parametros = this.href.split("?")[1];
                  var url = this.href.split("?")[0];
                  var ctn = parametros.split("container=")[1];
                  var modulo = parametros.split("modulo=")[1];
                  var aP = "modulo="+modulo+"&params="+escape(parametros);
                  ctn = ctn.split("&")[0];
                  var regla = function(){};
                  fin = function(html){
                       if(validarErr(html)){
                       $("#"+ctn).html(html);
                       $("#"+ctn).each(rules_paginacion_concursos.evento);
                       }
                  }
                  $.ajax({ url: "/modulo/index.html",data: aP, success: fin });
                  return false;
              }
}
$(document).ready(rules_paginacion_concursos.evento);
