// ------------------------------------------ funkce pro otevirani novych oken
function okno(soubor) {
  window.open(soubor,'','toolbar=yes,scrollbars=yes,location=yes,status=yes,resizable=1,menubar=yes')
}

// ------------------------------------------ funkce pro zaskrtnuti vsech polozek
function CheckAll(f,el) {
	for (var i=0;i<f.elements.length;i++)
	{
		var e=f.elements[i];
		if (e.id==el) e.checked=f.check_all.checked;
	}
}

// ------------------------------------------ funkce pro presun z formularoveho prvku SELECT
function jdi_na() {
	location=document.skoc.go.options[document.skoc.go.selectedIndex].value
}

// ------------------------------------------ funkce pro pridani mezi oblibene
function addBookmark(title,url) {
	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
		return true;
	}
}

// ------------------------------------------ funkce pro pridani smajliku do fora
function insert_smile(type) {
	document.getElementById("cely_text").value=document.getElementById("cely_text").value+" "+type+" ";
	document.getElementById("cely_text").value.focus();
}

// ------------------------------------------ funkce pro emailu pro odeslani clanku
function validate_odeslat(formular)  {
 	if((formular.email.value.indexOf("@") < 1 || formular.email.value.indexOf("@") != formular.email.value.lastIndexOf("@") || formular.email.value.lastIndexOf(".") < formular.email.value.lastIndexOf("@")+2  || formular.email.value.lastIndexOf(".") > (formular.email.value.length-3) || formular.email.value.lastIndexOf(".") < (formular.email.value.length-4))) { 
		alert ("CHYBA: vyplňte prosím správně svůj email!");
		return false;
  }
}

function fotka(soubor,w,h) { window.open(soubor,"","toolbar=no,scrollbars=no,location=no,status=no,width="+w+",height="+h+",resizable=1")}

// ------------------------------------------ funkce pro kontrolu vyberu v ankete
function validate_search(formular)  {
	if (formular.search_input.value=="") {
		alert ("CHYBA: zadejte prosím text, který chcete vyhledat!");
		formular.search_input.focus();
		return false;
  }
}

// ------------------------------------------ zmeni tridu (class) objektu s danym ID
function ZmenTridu(trida,id)  {
  document.getElementById(id).className = trida;
}


function online(id)   {
  window.open('http://www.onlajny.cz/match/index/id/'+id+'','','toolbar=no,scrollbars=yes,location=no,status=yes,width=900,height=600,resizable=1')
}

function online_zap(id) {
  window.open('http://www.onlajny.cz/detail.php?id='+id+'&hra=hokej&zobrazit=vsechno','','toolbar=no,scrollbars=yes,location=no,status=no,width=790,height=590,resizable=1')
}

// ------------------------------------------ fce pro kalendar
function calendar_info(id){
	imax=31;
	for(i=1; i<=imax; i++) {
	  if (document.getElementById('game_'+i)) { document.getElementById('game_'+i).className="hidden";}
	  if (document.getElementById('akce_'+i)) { document.getElementById('akce_'+i).className="hidden";}
	}
	if (document.getElementById('notoday')) { document.getElementById('notoday').className="hidden";}
	document.getElementById(id).className="";
}


// ------------------------------------------ fce pro zobrazeni trasnlate boxu
function ShowTranslate()    {
  document.getElementById('translate').style.visibility="visible";
}

function HideTranslate() {
  document.getElementById('translate').style.visibility="hidden";
}

function show_foto_window(id) {
	window.open('fotogalerie_play_window.asp?id='+id,'','toolbar=no,scrollbars=yes,location=no,status=yes,width=980,height=950,resizable=1')
}
function show_foto_window2(id) {
	window.open('fotogalerie_play_window.asp?id_player='+id,'','toolbar=no,scrollbars=yes,location=no,status=yes,width=980,height=950,resizable=1')
}


// ------------------------------------------ fce pro vysouvaci menu
var PocetMenu = 6;
function Show(CisMenu)    {
  var menu = document.getElementById('submenu'+CisMenu);
  menu.style.visibility="visible";
}

function Hide() {
  var menu, i;
  for(i=1; i<=PocetMenu; i++) {
      menu = document.getElementById('submenu'+i);
      menu.style.visibility="hidden";
  }
}

// ------------------------------------------ fce pro zmenu tabu

function change_tab(tab,idcko){
	//nastaveni vsech tabu na stejny vzhled
	if (tab==1) {imax=3;  tv=" tv";}else{imax=3;   tv="";}
	for(i=1; i<=imax; i++) {
	  document.getElementById('tab_'+tab+'_'+i).className="inactive";
	  document.getElementById('box_'+tab+'_'+i+'').className="tab_body hidden";
	}
	//prepnuti na spravny tab
	  document.getElementById('tab_'+tab+'_'+idcko).className="active";
	  document.getElementById('box_'+tab+'_'+idcko).className="tab_body";
}




// ------------------------------------------ fce zmenu TOP story

  var top_count=4;
	var top_class="ts_content_box";

	function switch_top(id_top){

	 if (document.getElementById("top"+id_top).className!=top_class+" show"){

		 for(i=1; i<=top_count; i++) {
		 	document.getElementById("top"+i).className=top_class;
			document.getElementById("thumb"+i).className="";
		 }
		 document.getElementById("top"+id_top).className=top_class+" show";
		 document.getElementById("thumb"+id_top).className="selected";
	 }
	}






var top;
top=1;
function prepni_top(id,end){
		 var i,id2,id3,id4,id5;

		 if (end!=0) {	stop_top(); }else{
		 	document.getElementById("top_navigace_2_on").className="hidden";
			document.getElementById("top_navigace_2_off").className="button1";
		 }

		 if (end==2) {
			 id=top;
			 if (top<4){ id=id+1; }
			 top=id;
		 }

		 if (end==3) {
			 id=top;
			 if (top>1){ id=id-1; }
			 top=id;
		 }

		 for(i=1; i<=4; i++) {
		 	 id2="top"+i;
			 id3="top_navigace_"+(i+3)+"_on";
			 id4="top_navigace_"+(i+3)+"_off";
		     document.getElementById(id2).className="hidden";
			 document.getElementById(id3).className="hidden";
			 document.getElementById(id4).className="";
		 }
		id2="top"+id;
		id3="top_navigace_"+(id+3)+"_on";
		id4="top_navigace_"+(id+3)+"_off";
		//alert(id)
	 	document.getElementById(id2).className="top_story_box";
		document.getElementById(id3).className="";
		document.getElementById(id4).className="hidden";
	}

	function stop_top(){
		clearTimeout(casovac);
		document.getElementById("top_navigace_2_on").className="button1";
		document.getElementById("top_navigace_2_off").className="hidden";
	}

	function opakovana(id_top,control){
		id_top=id_top+1;
		if (id_top==5) {
			id_top=1;
		}

		if (control!=0) {
			casovac=window.setTimeout("opakovana("+id_top+","+control+")", 4000); // volá sebe samu odloženou o sekundu
			prepni_top(id_top,0);
		}
}


