addEvent(window,'load',inicializarEventos,false);
var id,c1;

function inicializarEventos()

{
	$('.inicio').click(function () { 
            $('body,html').animate({ 
                scrollTop: 0 
            }, 800); 
            return false; 
        }); 
  
	$('select#dep').change(function(){

var anio,mes,dep,op;

anio = $('#anio option:selected').val();
mes = $('#mes option:selected').val();
dep = $('#dep option:selected').val();

op= $("input[@name='grupo']:checked").val();
	
window.location = 'busqueda.php?dep='+encodeURIComponent(dep)+'&mes='+mes+'&anio='+anio+'&opcion='+op;

});

 $(".nombre").hide();
 
 
  	$(".visible").live("click", function()
			{ 
			
			if (document.getElementById('boleti')){
				alert(' Hay un árticulo abierto, cierralo e intenta de nuevo!!!');
				this.checked = false;
			}

else{



$(this).parent().append('<div id="boleti" class="texto" style="cursor: text"></div>');

$(this).removeClass("visible");		
$(this).addClass("oculto");
id=$(this).attr("name");

enviar();

  $(".oculto").hide();

}
});
  	
		$(".muestra1").live("click", function(event){ 

   $("#floatMenu").remove();

	});
	
	
	$(".muestra").live("click", function(event){ 
	

 $(".oculto").removeClass("oculto").addClass("visible");
  $("#boleti").remove();
   $(".muestra").remove();
$(".visible").show();

	});
	

 
}



function presionEnlace(e)
{
  if (window.event)
  {
    window.event.returnValue=false;
    var url=window.event.srcElement.getAttribute('href');
    cargarPagina(url);     
  }
  else
    if (e)
    {
      e.preventDefault();
      var url=e.target.getAttribute('href');
      cargarPagina(url);     
    }
}


var conexion1;

function enviar() 
{
	   conexion1=crearXMLHttpRequest();
  conexion1.onreadystatechange = function() {
	  var detalles = document.getElementById("boleti");
  if(conexion1.readyState == 4)
  	{
 		detalles.innerHTML = conexion1.responseText;
 	} 
  else 
  	{
    	detalles.innerHTML = '<center><img src="imagenes_efectos/cargando.gif" width="30" height="30"><br> Cargando...</center>';
 	 }
	  
	  }
	  
 conexion1.open("GET",'boletines.php?lista='+id, true);
  conexion1.send(null); 


}





function addEvent(elemento,nomevento,funcion,captura)
{
  if (elemento.attachEvent)
  {
    elemento.attachEvent('on'+nomevento,funcion);
    return true;
  }
  else  
    if (elemento.addEventListener)
    {
      elemento.addEventListener(nomevento,funcion,captura);
      return true;
    }
    else
      return false;
}



function crearXMLHttpRequest() 
{
  var xmlHttp=null;
  if (window.ActiveXObject) {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

}
  else 
    if (window.XMLHttpRequest) 
      xmlHttp = new XMLHttpRequest();
  return xmlHttp;
}











