﻿var tabs = new Array('tab_programs','tab_subjects');
var tabs_programs = new Array('<li><a target="_top" href="http://www.polskieradio.pl/jedynka/">JEDYNKA</a></li>','<li><a target="_top" href="http://www.polskieradio.pl/dwojka/">DWÓJKA</a></li>','<li><a target="_top" href="http://www.polskieradio.pl/trojka/">TRÓJKA</a></li>','<li><a target="_top" href="http://czworka.polskieradio.pl/">CZWÓRKA</a></li>','<li><a target="_top" href="http://www.polskieradio.pl/zagranica/">PR DLA ZAGRANICY</a></li>','<li><a target="_top" href="http://www.polskieradio.pl/iar/">IAR</a></li>','<li><a target="_top" class="last" href="http://www.polskieradio.pl/radioparlament/">RADIO PARLAMENT</a></li>'); 
var tabs_subjects = new Array('<li><a target="_top" href="http://www.polskieradio.pl/gospodarka/">GOSPODARKA</a></li>','<li><a target="_top" href="http://www.polskieradio.pl/historia/">HISTORIA</a></li>','<li><a target="_top" href="http://www.polskieradio.pl/kultura/">KULTURA</a></li>','<li><a target="_top" href="http://www.polskieradio.pl/muzyka/">MUZYKA</a></li>','<li><a target="_top" href="http://www.polskieradio.pl/nauka/">NAUKA</a></li>','<li><a target="_top" href="http://www.polskieradio.pl/sport/">SPORT</a></li>');
var active = null;
var tabs_count = 0;
var interval = 100;

function switchTab(tab, name)
{
	if (active) active.className = "off"
	active = tab;
	active.className = "on";
	tabs_count = 0;
	for(i = 0; i < tabs.length; i++)
	{
		obj = document.getElementById(tabs[i]);
		obj.style.display = (name == tabs[i]) ? 'block':'none';
	}
	if (name == "tab_programs") show_elements("tab_programs",tabs_programs);
	if (name == "tab_subjects") show_elements("tab_subjects",tabs_subjects);
	return false;
}

function show_elements(tabname,table)
{
	if (tabs_count == 0) document.getElementById(tabname).innerHTML = "";
	document.getElementById(tabname).innerHTML +=  table[tabs_count];
	if (tabs_count < table.length-1)
	{
		tabs_count++;
		setTimeout(function(){show_elements(tabname,table)},interval);
	}	
}

function show_elements_show(tabname,table)
{
	for(i = 0; i < table.length; i++) document.getElementById(tabname).innerHTML +=  table[i];
	document.getElementById(tabname).style.display = 'block';
}