<!--
//

var zobrazeny_kalendar = '';
var zobrazeny_kalendar_typ = '';


var lastchr;
var divid;
function doSomething(e){
	// requires that outerDIV is named 'div' + number
	// innerdiv(s) is named 'somethingelse' + number
	if (!e) var e = window.event;
	var tg = (window.event) ? e.srcElement : e.target;
	if (tg.nodeName != 'DIV') return;
	divid = tg.id;
	lastchr = divid.charAt(divid.length - 1);
	divid = ''+zobrazeny_kalendar;
	
	var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
	
	while (reltg != tg && reltg.nodeName != '#document'){
		reltg= reltg.parentNode
	}
	if (reltg == tg) return;
	document.getElementById(divid).style.display = 'none';
	prebarvi_kalendar(divid);		
	
}

function prebarvi_kalendar(odbarvi) {
	var odbarvi = 'kalendar_podklad'+odbarvi;
	if (zobrazeny_kalendar_typ!=''){
		if (zobrazeny_kalendar_typ==1){
		document.getElementById(odbarvi).style.background='#ffffff';
		document.getElementById(odbarvi).style.color='#6cb2ba';
		}
		else if (zobrazeny_kalendar_typ==2){
		document.getElementById(odbarvi).style.background='#01181b';
		document.getElementById(odbarvi).style.color='#6cb2ba';
		}
		else if (zobrazeny_kalendar_typ==3){
		document.getElementById(odbarvi).style.background='#000000';
		document.getElementById(odbarvi).style.color='#ffffff';
		}		
	}
}




// tlacitka v menu

function tlacitko_over(tlacitko, akce){
	var tlacitkop = tlacitko +'p';
	var tlacitkom = tlacitko +'m';
	var tlacitkol = tlacitko +'l';
	var odkaz = tlacitko +'odkaz';
	if (akce<1) {
	document.getElementById(tlacitkom).style.backgroundImage = "url('imgs/menu_tlacitko_m.gif')";
	document.getElementById(tlacitkol).style.backgroundImage = "url('imgs/menu_tlacitko_p.gif')";
	document.getElementById(tlacitkop).style.backgroundImage = "url('imgs/menu_tlacitko_l.gif')";
	document.getElementById(odkaz).style.color = '#4b939a';
	}
	else{
	document.getElementById(tlacitkom).style.backgroundImage = "url('imgs/menu_tlacitko_m2.gif')";
	document.getElementById(tlacitkol).style.backgroundImage = "url('imgs/menu_tlacitko_p2.gif')";
	document.getElementById(tlacitkop).style.backgroundImage = "url('imgs/menu_tlacitko_l2.gif')";
	document.getElementById(odkaz).style.color = '#ffffff';
	}
}

// naseptavani

sdiak = "áäčďéěíĺľňóô öŕšťúů üýřžÁÄČĎÉĚÍĹĽŇÓÔ ÖŔŠŤÚŮ ÜÝŘŽ";
bdiak = "aacdeeillnoo orstuu uyrzAACDEEILLNOO ORSTUU UYRZ";
function bezdiak(form)
{
  tx = "";
  txt = form;
  for(p = 0; p < txt.length; p++)
  {
    if (sdiak.indexOf(txt.charAt(p)) != -1)
    {
      tx += bdiak.charAt(sdiak.indexOf(txt.charAt(p)));
    }
    else tx += txt.charAt(p);
  }
  return tx;
} 



var lastSelected;

function GetKeyCode(e) {
  if (e) {
    return e.charCode ? e.charCode : e.keyCode;
  }
  else {
    return window.event.charCode ? window.event.charCode : window.event.keyCode;
  }
} 

function generujNaseptavac(e) {
  var unicode = GetKeyCode(e);
  var str = document.getElementById("inputText").value;
  str = bezdiak(str);
      
  if (unicode != 38 && unicode != 40 && str != lastSelected) {
    if (str != "") {

      // IE/zbytek světa
      if (window.ActiveXObject) {
      httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
      } else {
        httpRequest = new XMLHttpRequest();
      }
      var url = "ajax/naseptavac.php?str=" + encodeURI(str);
      httpRequest.open("GET", url, true);     
      httpRequest.onreadystatechange= function () {processRequest(); } ;
      httpRequest.send(null);     
    }
    else {     
      document.getElementById("naseptavacDiv").style.visibility = "hidden";
    }
  }

}


function processRequest() {
  if (httpRequest.readyState == 4) {
    if(httpRequest.status == 200) {
      var response = httpRequest.responseText;
      if (response == 'EMPTY') {
        document.getElementById("naseptavacDiv").style.visibility = "hidden";
      }
      else {        
        document.getElementById("naseptavacDiv").innerHTML = response;
        document.getElementById("naseptavacDiv").style.visibility = "visible";
               // setTimeout("schovej_naseptavac()", 25 * 1000);
      }
    }
    else {
      alert("Chyba při načítání stránky"

        + httpRequest.status +":"+ httpRequest.statusText);
    }
  }
}



function getResultClickHandler(value) {
  window.location.href=value;
}

function schovej_naseptavac() {
 document.getElementById("naseptavacDiv").style.visibility = "hidden";
}

// naseptavani

// zobrazeni vice clanku


var titulkaclanky =  630;
var titulkafotky =  630;
var content_podklad = 2370;

var clanku = 3;
var fotek = 3;



function vytvorXMLHttpRequest1() {
  if (window.ActiveXObject) {
    xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
    xmlHttp1 = new XMLHttpRequest();
  }
}

function vice_clanku() {
                  vytvorXMLHttpRequest1();
                  var dotazovaciRetezec = "ajax/vice_clanku.php?co=clanky&clanku=" + clanku;
                  xmlHttp1.open("GET", dotazovaciRetezec, true);
                  xmlHttp1.onreadystatechange = zpracujZmenuStavu1;
                  xmlHttp1.send(null);
}

function zpracujZmenuStavu1() {
    if(xmlHttp1.readyState == 4) {
    document.getElementById('vice_clanku').innerHTML = "<img src='imgs/titulka/ajax-loader.gif' alt='loading' width='15' height='15' style='position: relative; left: 25px;'>";
    if(xmlHttp1.status == 200) {

    titulkaclanky = titulkaclanky + 180;
    content_podklad = content_podklad + 180;

    document.getElementById('content_podklad').style.height = content_podklad + 'px';
    document.getElementById('titulkaclanky').style.height = titulkaclanky + 'px';
    document.getElementById('titulkaclanky').innerHTML = document.getElementById('titulkaclanky').innerHTML + '<p>' + xmlHttp1.responseText + '</p>';

    document.getElementById('vice_clanku').innerHTML = "<input type='image' src='imgs/titulka/dalsi_clanky.gif' class='titulka_dalsiclanky' onclick='vice_clanku();'>";

    clanku = clanku +2;

    }
  } 
}


function vytvorXMLHttpRequest2() {
  if (window.ActiveXObject) {
    xmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
    xmlHttp2 = new XMLHttpRequest();
  }
}

function vice_fotek() {
                  vytvorXMLHttpRequest2();
                  var dotazovaciRetezec = "ajax/vice_clanku.php?co=fotky&clanku=" + fotek;
                  xmlHttp2.open("GET", dotazovaciRetezec, true);
                  xmlHttp2.onreadystatechange = zpracujZmenuStavu2;
                  xmlHttp2.send(null);
}

function zpracujZmenuStavu2() {
    document.getElementById('vice_fotek').innerHTML = "<img src='imgs/titulka/ajax-loader.gif' alt='loading' width='15' height='15' style='position: relative; left: 25px;'>";
    if(xmlHttp2.readyState == 4) {
    if(xmlHttp2.status == 200) {

    titulkafotky = titulkafotky + 180;
    content_podklad = content_podklad + 180;

    document.getElementById('content_podklad').style.height = content_podklad + 'px';
    document.getElementById('titulkafotky').style.height = titulkafotky + 'px';
    document.getElementById('titulkafotky').innerHTML = document.getElementById('titulkafotky').innerHTML + xmlHttp2.responseText;

    document.getElementById('vice_fotek').innerHTML = "<input type='image' src='imgs/titulka/dalsi_clanky.gif' class='titulka_dalsiclanky' onclick='vice_fotek();'>";

    fotek = fotek +2;

    }
  } 
}

// prepinani veci tydne

var tyden_global = 1;
var tyden_pocet = 0;
var tyden_rotate = 1;

var tyden2 = 1;

function tyden(tyden) 
{

	if (tyden_pocet<14) {


		if (tyden>5){
			tyden=1;
		}

		tyden_global = tyden;
		tyden_pocet = tyden_pocet +1;
                tyden2 = tyden;

		if (!isNaN(tyden) && tyden > 0 && tyden < 6) {
	 		vytvorXMLHttpRequest_tyden();
 			var dotazovaciRetezec_tyden = "ajax/tyden.php?tyden=" + tyden2;
 			xmlHttp1_tyden.open("GET", dotazovaciRetezec_tyden, true);
 			xmlHttp1_tyden.onreadystatechange = zpracujZmenuStavu1_tyden;
 			xmlHttp1_tyden.send(null);
		}

	}
}


function vytvorXMLHttpRequest_tyden() {
  if (window.ActiveXObject) {
    xmlHttp1_tyden = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
    xmlHttp1_tyden = new XMLHttpRequest();
  }
}

function zpracujZmenuStavu1_tyden() {

    if(xmlHttp1_tyden.readyState == 4) {	
    if(xmlHttp1_tyden.status == 200) {
	 tyden_vymaz()
         if (tyden2 == 1) {
         document.getElementById("prep1").src='imgs/titulka/tyden-on.gif';
         }
         if (tyden2 == 2) {
         document.getElementById("prep2").src='imgs/titulka/tyden-on.gif';
         }
         if (tyden2 == 3) {
         document.getElementById("prep3").src='imgs/titulka/tyden-on.gif';
         }
         if (tyden2 == 4) {
         document.getElementById("prep4").src='imgs/titulka/tyden-on.gif';
         }
         if (tyden2 == 5) {
         document.getElementById("prep5").src='imgs/titulka/tyden-on.gif';
         }

         document.getElementById("tyden").innerHTML = xmlHttp1_tyden.responseText;

        if (tyden_rotate==1){
		tyden_global = tyden_global +1;
		setTimeout("tyden(tyden_global)", 15 * 1000);
        }
    }
  }
}

function tyden_vymaz() {
    document.getElementById("prep1").src='imgs/titulka/tyden-off.gif';
    document.getElementById("prep2").src='imgs/titulka/tyden-off.gif';
    document.getElementById("prep3").src='imgs/titulka/tyden-off.gif';
    document.getElementById("prep4").src='imgs/titulka/tyden-off.gif';
    document.getElementById("prep5").src='imgs/titulka/tyden-off.gif';
}

// prepinani kalendare

var d = new Date();
var month = d.getMonth();


var month_nazev=new Array(12);
month_nazev[0]="leden";
month_nazev[1]="únor";
month_nazev[2]="březen";
month_nazev[3]="duben";
month_nazev[4]="květen";
month_nazev[5]="červen";
month_nazev[6]="červenec";
month_nazev[7]="srpen";
month_nazev[8]="září";
month_nazev[9]="říjen";
month_nazev[10]="listopad";
month_nazev[11]="prosinec";

function prepni(akce) {
	zobrazeny_kalendar = '';
	zobrazeny_kalendar_typ = '';
	if (akce == 'next') {month = month + 1;}
	if (akce == 'prew') {month = month - 1;}

	if (month<0) {month = 11;}
	else if (month>11) {month = 0;}

	document.getElementById("mesic").innerHTML = month_nazev[month];
	
	prepni_kalendar(month+1);
}


function prepni_kalendar(month2)
{
	 		vytvorXMLHttpRequest_kalendar();
 			var dotazovaciRetezec_kalendar = "ajax/calendar.php?mesic=" + month2;
 			xmlHttp1_kalendar.open("GET", dotazovaciRetezec_kalendar, true);
 			xmlHttp1_kalendar.onreadystatechange = zpracujZmenuStavu1_kalendar;
 			xmlHttp1_kalendar.send(null);

}


function vytvorXMLHttpRequest_kalendar() {
  if (window.ActiveXObject) {
    xmlHttp1_kalendar = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
    xmlHttp1_kalendar = new XMLHttpRequest();
  }
}

function zpracujZmenuStavu1_kalendar() {

    if(xmlHttp1_kalendar.readyState == 4) {
		document.getElementById('kalendar_podklad').innerHTML = "<img src='imgs/titulka/ajax-loader.gif' alt='loading' width='15' height='15' style='position: relative; left: 25px;'>";
    if(xmlHttp1_kalendar.status == 200) {
		document.getElementById("kalendar_podklad").innerHTML = xmlHttp1_kalendar.responseText;
	 
    }
  }
}


function vypis_festivaly(typvypisu, razeni)
{                       vytvorXMLHttpRequest_festivaly();
 			var dotazovaciRetezec_festivaly = "ajax/vypis_festivalu.php?typvypisu=" + typvypisu + "&razeni=" + razeni;
 			xmlHttp1_festivaly.open("GET", dotazovaciRetezec_festivaly, true);
 			xmlHttp1_festivaly.onreadystatechange = zpracujZmenuStavu1_festivaly;
 			xmlHttp1_festivaly.send(null);

}


function vytvorXMLHttpRequest_festivaly() {
  if (window.ActiveXObject) {
    xmlHttp1_festivaly = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
    xmlHttp1_festivaly = new XMLHttpRequest();
  }
}

function zpracujZmenuStavu1_festivaly() {

    if(xmlHttp1_festivaly.readyState == 4) {
		document.getElementById('vypis_festivalu').innerHTML = "<img src='imgs/titulka/ajax-loader.gif' alt='loading' width='15' height='15' style='position: relative; left: 25px;'>";
    if(xmlHttp1_festivaly.status == 200) {
		document.getElementById("vypis_festivalu").innerHTML = xmlHttp1_festivaly.responseText;
	 
    }
  }
}

function nacti_mapu(){
   var jake = document.getElementById('jake').value;
   var cr = document.getElementById('cr').checked;
   var dotazovaciRetezec_iframe = "googlemapa.php?jake=" + jake + "&cr=" + cr;
   var iframe = document.getElementById("googleiframe");
   iframe.setAttribute("src", dotazovaciRetezec_iframe);
}



function pridat_festival() {
   var pridatfestival_nazev = document.getElementById('pridatfestival_nazev').value;
   var pridatfestival_url = document.getElementById('pridatfestival_url').value;
   var pridatfestival_ucinkujici = document.getElementById('pridatfestival_ucinkujici').value;
   var pridatfestival_dalsiinfo = document.getElementById('pridatfestival_dalsiinfo').value;

   if (pridatfestival_nazev=='' | pridatfestival_url=='' | pridatfestival_url=='http://'){
   alert('Nezadali jste potřebné informace Název festivalu a jeho webovou adresu.');
   }
   else{
			vytvorXMLHttpRequest_pridat_festival();
 			var dotazovaciRetezec_pridat_festival = "ajax/pridat-festival.php?pridatfestival_nazev=" + pridatfestival_nazev + "&pridatfestival_url=" + pridatfestival_url + "&pridatfestival_ucinkujici=" +pridatfestival_ucinkujici+ "&pridatfestival_dalsiinfo=" +pridatfestival_dalsiinfo;
 			xmlHttp1_pridat_festival.open("GET", dotazovaciRetezec_pridat_festival, true);
 			xmlHttp1_pridat_festival.onreadystatechange = zpracujZmenuStavu1_pridat_festival;
 			xmlHttp1_pridat_festival.send(null);
   }
}


function vytvorXMLHttpRequest_pridat_festival() {
  if (window.ActiveXObject) {
    xmlHttp1_pridat_festival = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
    xmlHttp1_pridat_festival = new XMLHttpRequest();
  }
}

function zpracujZmenuStavu1_pridat_festival() {

    if(xmlHttp1_pridat_festival.readyState == 4) {		
    if(xmlHttp1_pridat_festival.status == 200) {
         if (xmlHttp1_pridat_festival.responseText == 'zprava_odeslana'){
	 alert('Požadavek byl úspěšně odeslán, festival bude zařazen do naší databáze do dvou pracovních dnů.\n\nDěkujeme za spolupráci.');
         window.location.href='reklama.html';
	 }
         else {
	 alert('Někde se stala chyba, tým speciálně vycvičených opic už pracuje na jejím odstranění.\n\nPro přidání festivalu prosím využijte sekci kontakty.');
         window.location.href='kontakt.html';
	}
    }
  }
}



function planujtrasu(sirka,delka,sirka2){

	sirka2 = bezdiak(sirka2);

	var retezec='http://maps.google.com/maps?f=d&hl=en&geocode=13883973314677992738,50.130923,14.427924&saddr=' + sirka2 + '&daddr=' + sirka + ',' + delka + '&sll=50.112323,14.425564&sspn=0.045355,0.159302&ie=UTF8&ll=' + sirka + ',' + delka + '&spn=0.045356,0.159302&z=9';
	if (sirka2 !='naplánuj trasu z:' && sirka2!='Město, Czech Republic'){
										window.open(retezec);
	}
}


function festival_soutez(id_akce) {   
			vytvorXMLHttpRequest_festival_soutez();
 			var dotazovaciRetezec_festival_soutez = "ajax/soutez.php?id_akce=" + id_akce;
 			xmlHttp1_festival_soutez.open("GET", dotazovaciRetezec_festival_soutez, true);
 			xmlHttp1_festival_soutez.onreadystatechange = zpracujZmenuStavu1_festival_soutez;
 			xmlHttp1_festival_soutez.send(null);
}


function vytvorXMLHttpRequest_festival_soutez() {
  if (window.ActiveXObject) {
    xmlHttp1_festival_soutez = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
    xmlHttp1_festival_soutez = new XMLHttpRequest();
  }
}

function zpracujZmenuStavu1_festival_soutez() {
    if(xmlHttp1_festival_soutez.readyState == 4) {		
    if(xmlHttp1_festival_soutez.status == 200) {
	document.getElementById("festival_soutez0").innerHTML = xmlHttp1_festival_soutez.responseText;
	}
    }
}



function clanek_komentare(id_bmc_postu, limit) {
			vytvorXMLHttpRequest_clanek_komentare();
 			var dotazovaciRetezec_clanek_komentare = "ajax/clanek_komentare.php?id_bmc_postu=" +id_bmc_postu+ "&limit=" + limit;
 			xmlHttp1_clanek_komentare.open("GET", dotazovaciRetezec_clanek_komentare, true);
 			xmlHttp1_clanek_komentare.onreadystatechange = zpracujZmenuStavu1_clanek_komentare;
 			xmlHttp1_clanek_komentare.send(null);
}


function vytvorXMLHttpRequest_clanek_komentare() {
  if (window.ActiveXObject) {
    xmlHttp1_clanek_komentare = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
    xmlHttp1_clanek_komentare = new XMLHttpRequest();
  }
}

function zpracujZmenuStavu1_clanek_komentare() {
    if(xmlHttp1_clanek_komentare.readyState == 4) {
    if(xmlHttp1_clanek_komentare.status == 200) {
	document.getElementById("festivaly_diskuze_starsi").innerHTML = xmlHttp1_clanek_komentare.responseText;
	}
    }
}

function komentuj(){

	var komentar_jmeno = document.getElementById("komentar_jmeno").value;
	var komentar_nadpis = document.getElementById("komentar_nadpis").value;
	var komentar_text = document.getElementById("komentar_text").value;
	var typ_diskuze = document.getElementById("typ_diskuze").value;
	var id_bmc_postu = document.getElementById("id_bmc_postu").value;
	var maps = document.getElementById("maps").value;

	komentar_jmeno = Url.encode(komentar_jmeno);
	komentar_nadpis = Url.encode(komentar_nadpis);
	komentar_text = Url.encode(komentar_text);

	if ( komentar_jmeno =='' | komentar_text ==''){
	alert('Musíte zadat povinné položky: vaše jméno nebo přezdívku a text komentáře');
	}
	else if ( maps = 144 && typ_diskuze !='' && id_bmc_postu!='' ) {
			vytvorXMLHttpRequest_clanek_komentare_save();
 			var dotazovaciRetezec_clanek_komentare_save = "ajax/clanek_komentare_save.php?id_bmc_postu=" + id_bmc_postu + "&typ_diskuze=" + typ_diskuze + "&komentar_jmeno=" + komentar_jmeno + "&komentar_nadpis=" + komentar_nadpis + "&komentar_text=" + komentar_text;
			document.getElementById("festivaly_diskuze_starsi").innerHTML = "<img src='imgs/titulka/ajax-loader.gif' alt='loading' width='15' height='15' style='position: relative; left: 25px; top: -10px;'>";
 			xmlHttp1_clanek_komentare_save.open("GET", dotazovaciRetezec_clanek_komentare_save, true);
 			xmlHttp1_clanek_komentare_save.onreadystatechange = zpracujZmenuStavu1_clanek_komentare_save;
 			xmlHttp1_clanek_komentare_save.send(null);
	}
}

function vytvorXMLHttpRequest_clanek_komentare_save() {	
  if (window.ActiveXObject) {
    xmlHttp1_clanek_komentare_save = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
    xmlHttp1_clanek_komentare_save = new XMLHttpRequest();
  }
}

function zpracujZmenuStavu1_clanek_komentare_save() {			
    if(xmlHttp1_clanek_komentare_save.readyState == 4) {
    if(xmlHttp1_clanek_komentare_save.status == 200) {
	if (xmlHttp1_clanek_komentare_save.responseText!=''){
	clanek_komentare(xmlHttp1_clanek_komentare_save.responseText, 50);
	}}
    }
}


function soutez(id){

var soutez_mail = document.getElementById("soutez_mail").value;
soutez_mail = soutez_mail.toLowerCase();
var soutez_jmeno = document.getElementById("soutez_jmeno").value;
var soutez_prijmeni = document.getElementById("soutez_prijmeni").value;

mejl = new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$");
	if (!mejl.test(soutez_mail))
	{
		alert("Zadaná e-mailová adresa není správnou adresou elektronické pošty!\nZadejte jí ve tvaru jmeno@domena.tld\nAdresa bude automaticky chráněna proti spamu.");
		return;
	}

	if (soutez_jmeno=='' | soutez_prijmeni == '') {
		alert("Nejsou zadány povinné údaje - jméno nebo příjmení.");
		return;
	}
	var jmeno = soutez_jmeno +  " " + soutez_prijmeni;

	if (document.getElementById('soutez_tip') != null) {
	var tip = document.getElementById("soutez_tip").value;
	if (tip ==''){
			alert("Není zadána odpověď na soutěžní otázku.");
			return;
	}
	}
	else {
		if (document.getElementById('soutez_tipa').checked==true){
		var tip = 'a';}
		else if (document.getElementById('soutez_tipb').checked==true){
		var tip = 'b';}
		else if (document.getElementById('soutez_tipc').checked==true){
		var tip = 'c';}
		else {
		alert("Není zvolena odpověď na soutěžní otázku.");
		return;
		}
	}

	if (document.getElementById('soutez_adresa') != null) {
		var soutez_adresa = document.getElementById("soutez_adresa").value;
		var soutez_telefon = document.getElementById("soutez_telefon").value;

		if (soutez_adresa=='' | soutez_telefon == '') {
			alert("Nejsou zadány povinné údaje - adresa a telefon.");
			return;
		}
		else if (!confirm("Souhlasíte, aby byly v případě výhry informace poskytnuty pořadateli?")) {
		return;
		}
		jmeno = jmeno + " Adresa: " + soutez_adresa + " Telefon: " + soutez_telefon;
	}

			jmeno = Url.encode(jmeno);
			soutez_mail = Url.encode(soutez_mail);
			tip = Url.encode(tip);

			vytvorXMLHttpRequest_soutez_save();
 			var dotazovaciRetezec_soutez_save = "ajax/soutez_save.php?jmeno=" +jmeno+ "&soutez_mail=" +soutez_mail+ "&tip=" +tip+ "&id=" +id;
 			xmlHttp1_soutez_save.open("GET", dotazovaciRetezec_soutez_save, true);
 			xmlHttp1_soutez_save.onreadystatechange = zpracujZmenuStavu1_soutez_save;
 			xmlHttp1_soutez_save.send(null);
}

function vytvorXMLHttpRequest_soutez_save() {
  if (window.ActiveXObject) {
    xmlHttp1_soutez_save = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else if (window.XMLHttpRequest) {
    xmlHttp1_soutez_save = new XMLHttpRequest();
  }
}

function zpracujZmenuStavu1_soutez_save() { 
    if(xmlHttp1_soutez_save.readyState == 4) {	
    if(xmlHttp1_soutez_save.status == 200) {
	if (xmlHttp1_soutez_save.responseText!=''){
	alert("Váš hlas byl úspěšně uložen, v případě výhry budete kontaktováni na zadaný e-mail.");
	festival_soutez(xmlHttp1_soutez_save.responseText);
	}}
    }
}


/**
*
*  URL encode / decode
*  http://www.webtoolkit.info/
*
**/
 
var Url = {
 
	// public method for url encoding
	encode : function (string) {
		return escape(this._utf8_encode(string));
	},
 
	// public method for url decoding
	decode : function (string) {
		return this._utf8_decode(unescape(string));
	},
 
	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	},
 
	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
 
		}
 
		return string;
	}
 
}





//-->

