function Scroll2Top()
{
   window.scroll(0, 0);
   return false;
}

function setup_goto_top()
{
  if (!document.getElementsByTagName) return false;
  var lnks = document.getElementsByTagName("a");
  for (var i=0; i<lnks.length; i++)
  {
    if (lnks[i].getAttribute("class") == "goto_top")
    {
      lnks[i].onclick = function() { return Scroll2Top(); }
    }
  }
}

function showLoading()
{
   if( !document.getElementById ) return false;

   document.write('<div id="loading" style="position: fixed;"><img src="grafik/loading.gif" /></div>');
}

function hideLoading()
{
   if( !document.getElementById ) return false;

   var loading = document.getElementById( 'loading' );
   if ( loading )
   {
      loading.style.display = "none";
   }
}

function createQCObject()
{
   var req;
   if( window.XMLHttpRequest )
   {
      // Firefox, Safari, Opera...
      req = new XMLHttpRequest();
   }
   else if( window.ActiveXObject )
   {
      // Internet Explorer 5+
      req = new ActiveXObject( "Microsoft.XMLHTTP" );
   }
   else
   {
      // alert('Problem creating the XMLHttpRequest object');
      req = null;
   }
   return req;
}

// Make the XMLHttpRequest object
var http = createQCObject();
var QCrunning = false;

function displayQCalendar( par )
{
   if ( ! http ) { return true; }
   if ( QCrunning ) { return false; }
   QCrunning = true;
//   var ran_no=(Math.round((Math.random()*9999)));
//   http.open( 'get', '<?= $ajaxPath; ?>?m='+m+'&y='+y+'&ran='+ran_no );
   http.open( 'get', 'live_calender.htm'+par );
   http.onreadystatechange = function() {
      if( http.readyState == 4 && http.status == 200 )
      {
         var response = http.responseText;
         if( response )
         {
            document.getElementById("ajax_calender").innerHTML = http.responseText;
         }
         QCrunning = false;
      }
   }
   http.send( null );
   return false;
}

window.onload = function() {
  setup_goto_top();
  hideLoading();
}

