// JavaScript Document

function goPrevious(y,m){

var month;
var year;
if(m==1){
month=12;
year	=parseInt(y)-1;
}
else {
month=parseInt(m)-1;
year=y;
}
/*document.frmM.submitcal.onclick=true;
document.frmM.submit();
*/
var url	=	"calendar.php?year="+ year +"&month="+ month ;
//alert(url);
 if (window.XMLHttpRequest) { 
      req = new XMLHttpRequest();
      req.onreadystatechange = takeCal;
      try {
      	req.open("GET", url, true); //was get
      } catch (e) {
        alert("Problem Communicating with Server\n"+e);
      }
      req.send(null);
    } else if (window.ActiveXObject) { // IE
      
      req = new ActiveXObject("Microsoft.XMLHTTP");
      if (req) 
      {
      req.onreadystatechange = takeCal;
        req.open("GET", url, true);
        req.send(null);
       
      }
    }
}
 function takeCal() 
   {
  	  if (req.readyState == 4)
  	   { // Complete
      if (req.status == 200) 
      { // OK response
    // alert("Ajax response:"+req.responseText);
        document.getElementById("show_calendar").style.display="inline";  
      document.getElementById("show_calendar").innerHTML=req.responseText 
                                  
      } 
      else 
      {
        alert("Problem with server response:\n " + req.statusText);
      }
    }
  }

function goNext(y,m){
var month;
var year;

if(m==12){
month=1;
year	=parseInt(y) + 1;
}
else {
month	= parseInt(m) + 1;
year=y;
}
var url	=	"calendar.php?year="+ year +"&month="+ month ;
//alert(url);
 if (window.XMLHttpRequest) { 
      req = new XMLHttpRequest();
      req.onreadystatechange = takeCal;
      try {
      	req.open("GET", url, true); //was get
      } catch (e) {
        alert("Problem Communicating with Server\n"+e);
      }
      req.send(null);
    } else if (window.ActiveXObject) { // IE
      
      req = new ActiveXObject("Microsoft.XMLHTTP");
      if (req) 
      {
      req.onreadystatechange = takeCal;
        req.open("GET", url, true);
        req.send(null);
       
      }
    }
}
