var req;

function navigate(month,year) {
  
  
        var url = "basicCalendar.php?month="+month+"&year="+year;
        if(window.XMLHttpRequest) {
                req = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
                req = new ActiveXObject("Microsoft.XMLHTTP");
        }
        req.open("GET", url, true);
        req.onreadystatechange = callback;
        req.send(null);
}

function callback() {
        
        obj = document.getElementById("calendar");
        setFade(50);
        
		if(req.readyState == 4) {
                if(req.status == 200) {
                        response = req.responseText;
                        obj.innerHTML = response;
                        fade(50);
                } else {
                        alert("There was a problem retrieving the data:\n" + req.statusText);
                }
        }
}

function fade(amt) {
	if(amt <= 100) {
		setFade(amt);
		amt += 10;
		setTimeout("fade("+amt+")", 5);
    }
}

function setFade(amt) {
	obj = document.getElementById("calendar");
	
	amt = (amt == 100)?99.999:amt;
  
	// IE
	obj.style.filter = "alpha(opacity:"+amt+")";
  
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = amt/50;
  
	// Mozilla and Firefox
	obj.style.MozOpacity = amt/50;
  
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = amt/50;
}

function LoadGallery( pictureName, imageFile, idcaption, id,segundoid,noticiatitulo,titulo,comentariotitulo,comentarios,visitatitulo,visitas)
{
  var picture = document.getElementById(pictureName);
  picture.src = imageFile;

  document.getElementById(noticiatitulo).innerHTML =  titulo;
  
  document.getElementById(comentariotitulo).innerHTML =  "<h5>" + comentarios + " comentarios </h5>";
  
  document.getElementById(visitatitulo).innerHTML =  "<h5>" + visitas + " visitas </h5>";
  
  document.getElementById( idcaption ).href=id ;
  
  document.getElementById( segundoid ).href=id ;
  

  
  
}



function toggleDiv(divid){
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';
    }else{
      document.getElementById(divid).style.display = 'none';
    }
  }
  





