﻿

<!--

var scroll = 0;

function send_xmlhttprequest(obsluha, method, url, section, content, headers) {
   var xmlhttp = (window.XMLHttpRequest ? new XMLHttpRequest : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false));
   if (!xmlhttp) return false;
   
   xmlhttp.open(method, url);
   xmlhttp.onreadystatechange = function() {
       obsluha(xmlhttp, section);
   };
   
   if (headers) {
       for (var key in headers) {
           xmlhttp.setRequestHeader(key, headers[key]);
       }
   }
   
   xmlhttp.send(content);
   return true;
   
}




function levy_obdelnik(section,vars) {
	
		dnes_song = new Date();
	var sekundy_song = dnes_song.getSeconds();
	
	dnes_song_minute = new Date();
	var sekundy_song_minute = dnes_song_minute.getMinutes();
		
	var url = '/rpc/rpc.php?section='+section+'&time=' + sekundy_song +'&time_dve=' + sekundy_song_minute;

	if (section=='program') { url = '/rpc/rpc.php?section='+section+'&vars='+vars+'&time=' + sekundy_song; }
	
	if (section=='porady') { url = '/rpc/rpc.php?section='+section+'&vars='+vars+'&time=' + sekundy_song; }
	
	if (section=='moderatori') { url = '/rpc/rpc.php?section='+section+'&vars='+vars+'&time=' + sekundy_song; }
	

	
	if (!send_xmlhttprequest(levy_obdelnik_service, 'GET', url, section, vars +'&time=' + sekundy_song)) {
        return false;
}

// Loading
//var val = document.getElementById('levy-obdelnik');
//val.innerHTML = "Probíhá načítání";

return true; 
}

function levy_obdelnik_service(xmlhttp, section) {
//alert('fdsfds'); 
   if (xmlhttp.readyState == 4) {
    //alert(xmlhttp.status);
    var val = document.getElementById('levy-obdelnik');
    
       if (val.id == 'levy-obdelnik') {
        //val.innerHTML = xmlhttp.responseText;
        


        var resp = xmlhttp.responseXML.getElementsByTagName('content');
        for (var i=0; i < resp.length; i++) {
        val.innerHTML = resp[i].firstChild.data; 
        }

        var song = xmlhttp.responseXML.getElementsByTagName('song');
        for (var i=0; i < song.length; i++) {
        msg = song[i].firstChild.data+"                                                    ";
        }
        
        //220000

        if (section == 'nalad') {
        
        if (scroll == 0) {
        scrollmessage();
       
        }
        t=setTimeout("levy_obdelnik('nalad')",35000)
        window.t;
        }else{
        	clearTimeout(t);
        }
       }
   }else{
   //var val = document.getElementById('levy-obdelnik');
//val.innerHTML = "<img src='/images/ajax-loader.gif' alt='' />";
   }
}

// message to scroll in text field 
var spacer = "";
// current message position
var timeout = 200;
//
var pos = 0;
//flag to control message

function scrollmessage() {
scroll = 1;
//alert(msg);
document.form1.text1.value = msg.substring(pos, msg.length) + spacer + msg.substring(0, pos);
pos++;
if (pos > msg.length) pos = 0;
// set timeout for next update
window.setTimeout("scrollmessage()", timeout);
}

// Display a link help message
function LinkMessage(text) {
window.status = text;
}








// >>>>>>>>>>>>>>> pridano edited by Spy

/**
 * Nacteni pozadi ajaxem
 * @param from od
 * @param direction smer, 1 - dalsi, 0 - predchozi
 * @param section sekce ktera se bude menit
 */    
function changeBackground(from, direction, section) 
{
	  if (!send_xmlhttprequest(changeBackgroundService, 'GET', "/ajax.php?action=background&from=" + from + "&sloupec=" + section + "&direction=" + direction, section, "")) return false;
	   return true;
}

function changeBackgroundService(xmlhttp, section) {
	if (section == 2)
	 {
       var val = document.getElementById('sloupec-stahuj-pozadi');
	 }
	else if (section == 3)
	 {
       var val = document.getElementById('sloupec-stahuj-reprizy');
	 } 
	
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	val.innerHTML = "Načítám...";
	}
}

function changeRep(from, direction, section) 
{
	  if (!send_xmlhttprequest(changeRepService, 'GET', "/ajax.php?action=rep&from=" + from + "&sloupec=" + section + "&direction=" + direction, section, "")) return false;
	   return true;
}

function changeRepService(xmlhttp, section) {
	if (section == 2)
	 {
       var val = document.getElementById('sloupec-stahuj-pozadi');
	 }
	else if (section == 3)
	 {
       var val = document.getElementById('sloupec-stahuj-reprizy');
	 } 
	
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	//val.innerHTML = "Načítám...";
	}
}


// >>>>>>>>>>>>>>> pridano edited by Spy

/**
 * Nacteni pozadi ajaxem
 * @param from od
 * @param direction smer, 1 - dalsi, 0 - predchozi
 * @param section sekce ktera se bude menit
 */    
function changeTV(from, direction, play) 
{
	  if (!send_xmlhttprequest(changeTVService, 'GET', "/ajax.php?action=television&from=" + from + "&play=" + play + "&direction=" + direction, play, "")) return false;
	   return true;
}

function changeTVService(xmlhttp, play) {
    
	var val = document.getElementById('television');
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	//val.innerHTML = "Načítám...";
	}
}


function changeClanky(den) 
{
	  if (!send_xmlhttprequest(changeClankyService, 'GET', "/ajax.php?action=clanky&den=" + den , "")) return false;
	   return true;
}

function changeClankyService(xmlhttp) {
    
	var val = document.getElementById('article-old');
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	//val.innerHTML = "Načítám...";
	}
}

function changePoslechni(id) 
{
	  if (!send_xmlhttprequest(changePoslechniService, 'GET', "/ajax.php?action=poslechni&id=" + id , "")) return false;
	   return true;
}

function changePoslechniService(xmlhttp) {
    
	var val = document.getElementById('poslechni-si-player');
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	//val.innerHTML = "Načítám...";
	}
}


// test

function changeStars(hodnota_stars, c_id, u_id) 
{
	    if (!send_xmlhttprequest(changeStarsService, 'GET', "/ajax.php?action=hlasovani&hlas=" + hodnota_stars + "&c_id=" + c_id + "&u_id=" + u_id, "")) return false;
	    return true;
}

function changeStarsService(xmlhttp) {
    
	var val = document.getElementById('star-rating');
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	//val.innerHTML = "Načítám...";
	}
}

// stars download

function changeStarsdown(hodnota_stars, c_id, u_id) 
{
	    if (!send_xmlhttprequest(changeStarsdownService, 'GET', "/ajax.php?action=hlasovanidown&hlas=" + hodnota_stars + "&c_id=" + c_id + "&u_id=" + u_id, "")) return false;
	    return true;
}

function changeStarsdownService(xmlhttp) {
    
	var val = document.getElementById('star-rating');
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	//val.innerHTML = "Načítám...";
	}
}


// test dve

function sendReport() 
{
		 var report = document.getElementById('report').value;
		 var report_link = document.getElementById('report_link').value;
         if (!send_xmlhttprequest(sendReportService, 'GET', "/ajax.php?action=report&report=" + encodeURI(report) + "&report_link=" + report_link)) return false;
         return true;
}

function sendReportService(xmlhttp) {
    
	var val = document.getElementById('box-send-pole');
    var report = document.getElementById('report').value;
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	// val.innerHTML = "Načítám...";
	}
}

// test tri

function sendReportPoslat() 
{
		 var jmeno = document.getElementById('report_name').value;
		 var email = document.getElementById('report_email').value;
		 var email_adresat = document.getElementById('report_email_adr').value;
		 var report_poslat_text = document.getElementById('report_poslat').value;
		 var report_link_poslat = document.getElementById('report_link_poslat').value;
         if (!send_xmlhttprequest(sendReportPoslatService, 'GET', "/ajax.php?action=report_poslat&jmeno=" + encodeURI(jmeno) + "&report_link_poslat=" + report_link_poslat + "&email=" + email + "&email_adresat=" + email_adresat + "&report_poslat_text=" + encodeURI(report_poslat_text))) return false;
         return true;
}

function sendReportPoslatService(xmlhttp) {
    
	var val = document.getElementById('box-send-general');
    var jmeno = document.getElementById('report_name').value;
		 var email = document.getElementById('report_email').value;
		 var email_adresat = document.getElementById('report_email_adr').value;
		 var report_poslat_text = document.getElementById('report_poslat').value;
		 var report_link_poslat = document.getElementById('report_link_poslat').value;
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	// val.innerHTML = "Načítám...";
	}
}

function sendReportTip() 
{
		 var kontakt = document.getElementById('tip-text-input').value;
		 var text = document.getElementById('tip_obsah').value;
		 var link = document.getElementById('tip_link').value;
         if (!send_xmlhttprequest(sendReportTipService, 'GET', "/ajax.php?action=tip&kontakt=" + encodeURI(kontakt) + "&text=" + encodeURI(text) + "&link=" + link)) return false;
         return true;
}

function sendReportTipService(xmlhttp) {
    
	var val = document.getElementById('tip-text-odeslat');
    var kontakt = document.getElementById('tip-text-input').value;
		 var text = document.getElementById('tip_obsah').value;
		 var link = document.getElementById('tip_link').value;
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	// val.innerHTML = "Načítám...";
	}
}




function URLEncode(url) //Function to encode URL.
{
// The Javascript escape and unescape functions do not correspond
// with what browsers actually do...
var SAFECHARS = "0123456789" + // Numeric
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic
"abcdefghijklmnopqrstuvwxyz" +
"-_.!~*'()"; // RFC2396 Mark characters
var HEX = "0123456789ABCDEF"; 

var plaintext = url;
var encoded = "";
for (var i = 0; i < plaintext.length; i++ ) {
var ch = plaintext.charAt(i);
if (ch == " ") {
encoded += "+"; // x-www-urlencoded, rather than %20
} else if (SAFECHARS.indexOf(ch) != -1) {
encoded += ch;
} else {
var charCode = ch.charCodeAt(0);
if (charCode > 255) {
alert( "Unicode Character '" 
+ ch 
+ "' cannot be encoded using standard URL encoding.\n" +
"(URL encoding only supports 8-bit characters.)\n" +
"A space (+) will be substituted." );
encoded += "+";
} else {
encoded += "%";
encoded += HEX.charAt((charCode >> 4) & 0xF);
encoded += HEX.charAt(charCode & 0xF);
}
}
} 

return encoded;
}; 


  


function URLDecode(url) //function decode URL
{
// Replace + with ' '
// Replace %xx with equivalent character
// Put [ERROR] in output if %xx is invalid.
var HEXCHARS = "0123456789ABCDEFabcdef"; 
var encoded = url;
var plaintext = "";
var i = 0;
while (i < encoded.length) {
var ch = encoded.charAt(i);
if (ch == "+") {
plaintext += " ";
i++;
} else if (ch == "%") {
if (i < (encoded.length-2) 
&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
plaintext += unescape( encoded.substr(i,3) );
i += 3;
} else {
alert( 'Bad escape combination near ...' + encoded.substr(i) );
plaintext += "%[ERROR]";
i++;
}
} else {
plaintext += ch;
i++;
}
} // while 

return plaintext;
};




/*

function sendReport() {
var xmlhttp = (window.XMLHttpRequest ? new XMLHttpRequest : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false));
  
if(xmlhttp) {
    var obj = document.getElementById('box-send-pole');
    var report = document.getElementById('report').innerHTML;
    xmlhttp.open("GET", "/ajax.php?action=report&report="+report);

    xmlhttp.onreadystatechange = function() {
      if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        obj.innerHTML = xmlhttp.responseText;
      }
    }

    xmlhttp.send(null);
  }
}
*/


/*test bannerz */

dnes_banner = new Date();
var sekundy_banner = dnes_banner.getSeconds();

function reklama3(pozice, sekundy) 
{
	


	    if (!send_xmlhttprequest(reklama3Service, 'GET', "/ajax.php?action=reklama&pozice=" + pozice + "&time=" + sekundy_banner, "")) return false;
	    return true;
}

function reklama3Service(xmlhttp) {
    
	var val = document.getElementById('reklama-big');
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	//val.innerHTML = "Načítám...";
	}
}

function reklama1(pozice) 
{
	    if (!send_xmlhttprequest(reklama1Service, 'GET', "/ajax.php?action=reklama&pozice=" + pozice + "&time=" + sekundy_banner, "")) return false;
	    return true;
}

function reklama1Service(xmlhttp) {
    
	var val = document.getElementById('reklama');
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	//val.innerHTML = "Načítám...";
	}
}

function reklama2(pozice) 
{
	    if (!send_xmlhttprequest(reklama2Service, 'GET', "/ajax.php?action=reklama&pozice=" + pozice + "&time=" + sekundy_banner, "")) return false;
	    return true;
}

function reklama2Service(xmlhttp) {
    
	var val = document.getElementById('reklama-b');
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	//val.innerHTML = "Načítám...";
	}
}

function flash() 
{
	    if (!send_xmlhttprequest(flashService, 'GET', "/ajax.php?action=flashindex", "")) return false;
	    return true;
}

function flashService(xmlhttp) {
    
	var val = document.getElementById('rotace');
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	//val.innerHTML = "<div id='loader'><img src='/images/ajax-loader.gif' /></div>";
	}
}

function fotoback(id_fot, i) 
{
	    if (!send_xmlhttprequest(fotobackService, 'GET', "/ajax.php?action=fotoback&id_fot=" + id_fot + "&i=" + i, "")) return false;
	    return true;
}

function fotobackService(xmlhttp) {
    
	var val = document.getElementById('thumb-all');
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
		val.innerHTML = xmlhttp.responseText;
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	val.innerHTML = "<div id='loader'><img src='/images/ajax-loader.gif' /></div>";
	}
}

function fotoforward(id_fot, i) 
{
	    if (!send_xmlhttprequest(fotoforwardService, 'GET', "/ajax.php?action=fotoforward&id_fot=" + id_fot + "&i=" + i, "")) return false;
	    return true;
	    
}

function fotoforwardService(xmlhttp) {
    
	var val = document.getElementById('thumb-all');
	//var hide = document.getElementById('viewport').style.display="none";
	var valdd = document.getElementById('viewport');
	if (xmlhttp.readyState == 4) {
    if((xmlhttp.status >= 200 && xmlhttp.status < 300 ) || xmlhttp.status == 304) {
			val.innerHTML = xmlhttp.responseText;
			
    
   

	
			
			
			
		} else {
			val.innerHTML = "Chyba";
		}
  } else {
	 	val.innerHTML = "<div id='loader'><img src='/images/ajax-loader.gif' /></div>";
	}
}




//-->
