﻿
var httpRequest;
var last = new String();

function checkscript()
{
    var url = "lister.php"; 
    processList(url);

}   

function CheckKeres()
{

	var ip = document.ProgramKereso.idopont.selectedIndex;

	if (ip == 1)
	{
//		alert("Kattintson egy napra!");
		
		document.getElementById("pluszJel").style.visibility = "visible";
		document.ProgramKereso.program.style.visibility = "visible";
		document.ProgramKereso.Keres.style.visibility = "hidden";
		if (last == "")
			last = "help.php?z=1"		
		process(last);
	}
	else if (ip == 0)
	{
	       document.getElementById("pluszJel").style.visibility = "hidden";
	       document.ProgramKereso.program.style.visibility = "hidden";	       
	       document.ProgramKereso.Keres.style.visibility = "hidden";
	       last = "help.php?z=1"		
	       process(last);
	}
	else
	{
		document.getElementById("pluszJel").style.visibility = "visible";
		document.ProgramKereso.program.style.visibility = "visible";
	        document.ProgramKereso.Keres.style.visibility = "visible";
	}
}

function CheckProgram()
{

	var ip = document.ProgramKereso.idopont.selectedIndex;

	if (ip == 1)
		process(last);
}

// TAB
   function process(url)
   {
 
    var ip, 
        p;
    
	if (url == "")
	{
		return;
	};	
	
	last = url;
	
        if (window.ActiveXObject)
        {
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else
        {
          httpRequest = new XMLHttpRequest();
        }
        httpRequest.open("GET", url, true);
        httpRequest.onreadystatechange= function () {processRequest(); } ;
        httpRequest.send(null);
   }
  
   function processRequest()
   {

      if (httpRequest.readyState == 4)
      {
        if(httpRequest.status == 200)
        {
          var programCanvas = document.getElementById("programCanvas");
          programCanvas.innerHTML = httpRequest.responseText;
        }
        else
        {
            alert("Error loading page\n"+ httpRequest.status +":"+ httpRequest.statusText);
            var programCanvas = document.getElementById("programCanvas");
            programCanvas.innerHTML = "Error: can not get the content ("+ httpRequest.statusText +")";
        }
      }

   }
  
//NAPTAR  
     function processCalendar(url)
   {
 
        if (window.ActiveXObject)
        {
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else
        {
          httpRequest = new XMLHttpRequest();
        }
        httpRequest.open("GET", url, true);
        httpRequest.onreadystatechange= function () {processCalendarRequest(); } ;
        httpRequest.send(null);
   }
  
   function processCalendarRequest()
   {

 if (httpRequest.readyState == 4)
      {
        if(httpRequest.status == 200)
        {
	  var naptarCanvas = document.getElementById("naptarCanvas");
          naptarCanvas.innerHTML = httpRequest.responseText;
        }
        else
        {
            alert("Error loading page\n"+ httpRequest.status +":"+ httpRequest.statusText);
            var naptarCanvas = document.getElementById("naptarCanvas");
            naptarCanvas.innerHTML = "Error: can not get the content ("+ httpRequest.statusText +")";
        }
      }
   }
   
//LISTAZAS  
   function processList(url)
   {
 
        if (window.ActiveXObject)
        {
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else
        {
          httpRequest = new XMLHttpRequest();
        }
        httpRequest.open("GET", url, true);
        httpRequest.onreadystatechange= function () {processListRequest(); } ;
        httpRequest.send(null);
   }
  
   function processListRequest()
   {

      if (httpRequest.readyState == 4)
      {
        if(httpRequest.status == 200)
        {
          var programCanvas = document.getElementById("programCanvas");
          programCanvas.innerHTML = httpRequest.responseText;
        }
        else
        {
            alert("Error loading page\n"+ httpRequest.status +":"+ httpRequest.statusText);
            var programCanvas = document.getElementById("programCanvas");
            programCanvas.innerHTML = "Error: can not get the content ("+ httpRequest.statusText +")";
        }
      }
  }
  
  //RSS
  
  function RssLoad()
  {
	var i = document.RSSfeed.rsschannel.options[document.RSSfeed.rsschannel.selectedIndex].value;
	var url = "rssfeed.php?c=" + i;
	var programCanvas = document.getElementById("rssCanvas");
	programCanvas.innerHTML = "<font color='#005500' face='Arial, Helvetica, sans-serif' size='-1'>&nbsp;&nbsp;Letöltés alatt...</font>";
	    
	processRSS(url);
  }
  
   function processRSS(url)
   { 
 
        if (window.ActiveXObject)
        {
          httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else
        {
          httpRequest = new XMLHttpRequest();
        }
        httpRequest.open("GET", url, true);
        httpRequest.onreadystatechange= function () {processRSSRequest(); } ;
        httpRequest.send(null);
   }
  
   function processRSSRequest()
   {

      if (httpRequest.readyState == 4)
      {
        if(httpRequest.status == 200)
        {
          var programCanvas = document.getElementById("rssCanvas");
          programCanvas.innerHTML = httpRequest.responseText;
        }
        else
        {
            alert("Error loading page\n"+ httpRequest.status +":"+ httpRequest.statusText);
            var programCanvas = document.getElementById("rssCanvas");
            programCanvas.innerHTML = "Error: can not get the content ("+ httpRequest.statusText +")";
        }
      }
  }