// Přehraje videosoubor, jehož název je předán parametrem
function PrehrajVideoFLV(video) {
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='534' height='574' id='video' align='middle'>");
	document.write("<param name='allowScriptAccess' value='sameDomain'>");
	document.write("<param name='movie' value='video.swf'>");
	document.write("<param name='quality' value='high'>");
	document.write("<param name='bgcolor' value='#ffffff'>");
	document.write("<param name='flashvars' value='videosoubor=" + video + "'>");
	document.write("<embed src='video.swf' quality='high' bgcolor='#ffffff' flashvars='videosoubor=" + video + "' width='534' height='574' name='video' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='https://www.macromedia.com/go/getflashplayer'>");
	document.write("</object>");
}


function ZobrazLetak() {
	var i = 1;  // Počítadlo

	var jmeno = "firemni_novinky"; 
			
	document.write("<table cellspacing='8' style='margin:6px 0 0 -6px'><tr>");
	
	while (i <= pocet_stranek) {
		if (i == 9) document.write("</tr><tr>");  // Druhý řádek
		if (i == 17) document.write("</tr><tr>");  // Druhý řádek
		document.write("<td><img id='strana_" + i + "_m' src='" + nazev + "_" + i + "_m.jpg' style='cursor:pointer;	border:#444444 solid 1px; margin:1px 1px 1px 1px;' alt='Strana " + i + "' onmouseover='document.getElementById(\"strana_" + i + "_m\").style.border=\"#E42E2F solid 2px\"; document.getElementById(\"strana_" + i + "_m\").style.margin=\"0px 0px 0px 0px\";'  onmouseout='document.getElementById(\"strana_" + i + "_m\").style.border=\"#444444 solid 1px\"; document.getElementById(\"strana_" + i + "_m\").style.margin=\"1px 1px 1px 1px\"; ZvyrazniZobrazenouStranu();' onclick='ZnevyrazniNezobrazenouStranu(); document.getElementById(\"letak\").src=\"" + nazev + "_" + i + "_v.jpg\"; TestPrvniPosledni();'></td>");		i++;
	}
	
	document.write("</tr></table>");
	
	document.write("<table align='center'><tr>"); 
	document.write("<td width='60' align='center'><img id='sipka_vlevo' src='sipka_vlevo.jpg' alt='Předchozí strana' style='cursor:pointer; border:0px;' onmouseover='this.src=\"sipka_vlevo_aktivni.jpg\"' onmouseout='this.src=\"sipka_vlevo.jpg\"' onclick='ZobrazPredchoziStranu();'></td>");
	document.write("<td><img id='letak' src='" + nazev + "_1_v.jpg' style='border:1px solid #444444; margin-top:15px;' onload='NactiDalsiStranu();'></td>");
	document.write("<td width='60' align='center'><img id='sipka_vpravo' src='sipka_vpravo.jpg' alt='Následující strana' style='cursor:pointer; border:0px;' onmouseover='this.src=\"sipka_vpravo_aktivni.jpg\"' onmouseout='this.src=\"sipka_vpravo.jpg\"' onclick='ZobrazDalsiStranu();'></td>");
	document.write("</tr></table>");

	ZvyrazniZobrazenouStranu();
	TestPrvniPosledni();
}

function ZvyrazniZobrazenouStranu() {
	document.getElementById("strana_" + ZobrazenaStranaLetaku() + "_m").style.border = "#E42E2F solid 2px";
	document.getElementById("strana_" + ZobrazenaStranaLetaku() + "_m").style.margin = "0px 0px 0px 0px";
}

function ZnevyrazniNezobrazenouStranu() {
	document.getElementById("strana_" + ZobrazenaStranaLetaku() + "_m").style.border = "#444444 solid 1px";
	document.getElementById("strana_" + ZobrazenaStranaLetaku() + "_m").style.margin = "1px 1px 1px 1px";
}

function NactiDalsiStranu() {
	var aktualni = ZobrazenaStranaLetaku();
	var dalsi = aktualni + 1;
	if (aktualni != pocet_stranek) dalsi_stranka.src = nazev + "_" + dalsi + "_v.jpg";
}

function ZobrazDalsiStranu() {
	ZobrazStranu(ZobrazenaStranaLetaku()+1);
}

function ZobrazPredchoziStranu() {		
	ZobrazStranu(ZobrazenaStranaLetaku()-1);
}

function ZobrazStranu(strana) {

	ZnevyrazniNezobrazenouStranu();
	document.getElementById("letak").src = nazev + "_" + strana + "_v.jpg";
	ZvyrazniZobrazenouStranu();
	
	TestPrvniPosledni();
}

function ZobrazenaStranaLetaku() {
	var pole = document.getElementById("letak").src.split("_");
	return(parseInt(pole[pole.length - 2]));  // Zjisťuje se číslo aktuálně zobrazené stránky. jde se od konce, protože v názvu letáku může být také znak "_"
}

function TestPrvniPosledni() {
	var aktualni = ZobrazenaStranaLetaku();
	
	if (aktualni == 1) document.getElementById("sipka_vlevo").style.display="none";
		else document.getElementById("sipka_vlevo").style.display="inline";
		
	if (aktualni == pocet_stranek) document.getElementById("sipka_vpravo").style.display="none";
		else document.getElementById("sipka_vpravo").style.display="inline";
}


function VlozitHlavicku() {
	document.write("	<span class='hlavicka_odkazy'>	");
	document.write("		<a href='./dodavky_sluzby.html'>dodávky a služby</a> |	");
	document.write("		<a href='./vop.html'>obchodní podmínky</a>	");	
	document.write("	</span>	");
}

function VlozitFlash(videosoubor, sirka, vyska, pozadi) {
	document.write("	<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" + sirka + "' height='" + vyska + "' id='video' align='middle'>	");
	document.write("	<param name='allowScriptAccess' value='sameDomain'>	");
	document.write("	<param name='movie' value='" + videosoubor + "'>	");
	document.write("	<param name='quality' value='high'>	");
	document.write("	<param name='bgcolor' value='" + pozadi + "'>	");
	document.write("	<embed src='" + videosoubor + "' quality='high' bgcolor='" + pozadi + "' width='" + sirka + "' height='" + vyska + "' name='video' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='https://www.macromedia.com/go/getflashplayer'>	");
	document.write("	</object>	");
}

function VlozitHlavniMenu() {
	document.write("	<a href='./index.html'>Domů</a>	");
	document.write("	<a href='./novinky.html'>Novinky</a>	");
	document.write("	<a href='./sortiment.html'>Sortiment</a>	");
	document.write("	<a href='./ceniky.html'>Ceníky</a>	");
	document.write("	<a href='./skoleni.html'>Školení</a>	");
	document.write("	<a href='./servis.html'>Servis</a>	");
	document.write("	<a href='./kontakty.html'>Kontakty</a>	");
	document.write("	<a href='./onas.html'>O nás</a>	");
}

function WebZeme(kod) {
 	switch(kod) {
		case "de-DE": return("http://www.adi-gardiner.com/de-DE/");
		case "es-es": return("http://www.adi-gardiner.com/es-es/");
		case "ex-CZ": return("http://www.olympo.cz");
		case "ex-IT": return("http://www.adi-gardiner.com/it-IT/");
		case "ex-NL": return("http://www.alarmsystem.dk");
		case "ex-PL": return("http://www.adi-intl.pl");
		case "ex-SL": return("http://www.olympo.sk");
		case "fr-FR": return("http://www.adi-gardiner.com/fr-FR/");
		case "ie-ie": return("http://www.adi-gardiner.com/ie-ie/");
		case "it-IT": return("http://www.adi-gardiner.com/it-IT/");
		case "nl-NL": return("http://www.adi-gardiner.com/nl-NL/");
		case "pt-PT": return("http://www.adi-gardiner.com/pt-PT/");
		case "ru-RU": return("http://www.adi-gardiner.com/ru-RU/");
		case "uk-uk": return("http://www.adi-gardiner.com/uk-uk/");
		case "za-ZA": return("http://www.adi-gardiner.com/za-ZA/");
		break;		
	};
}

function VlozitVolbuZeme() {
	document.write("	<form name='formular_volba_zeme' class='formular_volba_zeme'>	");
	document.write("		<select name='kod_zeme' class='kod_zeme' onChange='location.href=WebZeme(document.formular_volba_zeme.kod_zeme.value);'>");
	document.write("			<option selected='selected' value=''>Zvolte zemi</option>	");
	document.write("			<option value='za-ZA'>Africa</option>	");
	document.write("			<option value='ex-IT'>Albania</option>	");
	document.write("			<option value='ex-IT'>Algeria</option>	");
	document.write("			<option value='ru-RU'>Armenia</option>	");
	document.write("			<option value='de-DE'>Austria</option>	");
	document.write("			<option value='ru-RU'>Azerbaijan</option>	");
	document.write("			<option value='ru-RU'>Belarus</option>	");
	document.write("			<option value='ex-NL'>Belgium</option>	");
	document.write("			<option value='ex-IT'>Bosnia & Herz.</option>	");
	document.write("			<option value='ex-NL'>Bulgaria</option>	");
	document.write("			<option value='ex-IT'>Croatia</option>	");
	document.write("			<option value='ex-IT'>Cyprus</option>	");
	document.write("			<option value='ex-CZ'>Czech Republic</option>	");
	document.write("			<option value='ex-NL'>Denmark</option>	");
	document.write("			<option value='ex-NL'>Estonia</option>	");
	document.write("			<option value='ex-NL'>Finland</option>	");
	document.write("			<option value='fr-FR'>France</option>	");
	document.write("			<option value='ru-RU'>Georgia</option>	");
	document.write("			<option value='de-DE'>Germany</option>	");
	document.write("			<option value='ex-IT'>Greece</option>	");
	document.write("			<option value='ex-NL'>Hungary</option>	");
	document.write("			<option value='ex-NL'>Iceland</option>	");
	document.write("			<option value='ie-ie'>Ireland</option>	");
	document.write("			<option value='it-IT'>Italy</option>	");
	document.write("			<option value='ru-RU'>Kazakhstan</option>	");
	document.write("			<option value='ru-RU'>Kyrgyzstan</option>	");
	document.write("			<option value='ex-NL'>Latvia</option>	");
	document.write("			<option value='ex-NL'>Liechtenstein</option>	");
	document.write("			<option value='ex-NL'>Lithuania</option>	");
	document.write("			<option value='ex-NL'>Luxembourg</option>	");
	document.write("			<option value='ex-IT'>Macedonia</option>	");
	document.write("			<option value='za-ZA'>Madagascar</option>	");
	document.write("			<option value='ex-IT'>Malta</option>	");
	document.write("			<option value='za-ZA'>Mauritius</option>	");
	document.write("			<option value='ex-NL'>Middle East</option>	");
	document.write("			<option value='ru-RU'>Moldova</option>	");
	document.write("			<option value='ex-IT'>Montenegro</option>	");	
	document.write("			<option value='ex-IT'>Morocco</option>	");
	document.write("			<option value='nl-NL'>Netherlands</option>	");
	document.write("			<option value='ex-NL'>Norway</option>	");
	document.write("			<option value='ex-PL'>Poland</option>	");
	document.write("			<option value='pt-PT'>Portugal</option>	");
	document.write("			<option value='fr-FR'>Reunion</option>	");
	document.write("			<option value='ex-NL'>Romania</option>	");
	document.write("			<option value='ru-RU'>Russia</option>	");
	document.write("			<option value='ex-IT'>Serbia</option>	");
	document.write("			<option value='za-ZA'>Seychelles</option>	");
	document.write("			<option value='ex-SL'>Slovakia</option>	");
	document.write("			<option value='ex-IT'>Slovenia</option>	");
	document.write("			<option value='za-ZA'>South Africa</option>	");
	document.write("			<option value='es-es'>Spain</option>	");
	document.write("			<option value='ex-NL'>Sweden</option>	");
	document.write("			<option value='fr-FR'>Switzerland</option>	");
	document.write("			<option value='ru-RU'>Tajikistan</option>	");
	document.write("			<option value='ex-IT'>Tunisia</option>	");
	document.write("			<option value='ru-RU'>Turkmenistan</option>	");
	document.write("			<option value='ru-RU'>Ukraine</option>	");
	document.write("			<option value='uk-uk'>United Kingdom</option>	");
	document.write("			<option value='ru-RU'>Uzbekistan</option>	");
	document.write("		</select>	");
	document.write("	</form>	");
}

function VlozitKategorieProduktu() {
	document.write("	<p class='nadpis_produkty'><span class='nadpis_produkty_text'>Produkty</span></p>	");
	document.write("	<table class='kategorie_produktu' cellspacing='0' cellpadding='0'>	");
	document.write("		<tr><td class='ikona_ezs' onClick=\"window.location=('')\">&nbsp;</td><td class='nazev_oddeleni' onClick=\"window.location=('')\"  onMouseMove=\"this.style.background='#ECEAEB'\" onMouseOut=\"this.style.background='#F7F6F6'\">EZS</td></tr>	");
	document.write("		<tr><td class='ikona_ezs' onClick=\"window.location=('')\">&nbsp;</td><td class='nazev_oddeleni' onClick=\"window.location=('')\"  onMouseMove=\"this.style.background='#ECEAEB'\" onMouseOut=\"this.style.background='#F7F6F6'\">Perimetr</td></tr>	");
	document.write("		<tr><td class='ikona_eps' onClick=\"window.location=('')\">&nbsp;</td><td class='nazev_oddeleni' onClick=\"window.location=('')\"  onMouseMove=\"this.style.background='#ECEAEB'\" onMouseOut=\"this.style.background='#F7F6F6'\">EPS</td></tr>	");
	document.write("		<tr><td class='ikona_cctv' onClick=\"window.location=('')\">&nbsp;</td><td class='nazev_oddeleni' onClick=\"window.location=('')\"  onMouseMove=\"this.style.background='#ECEAEB'\" onMouseOut=\"this.style.background='#F7F6F6'\">CCTV</td></tr>	");
	document.write("		<tr><td class='ikona_access' onClick=\"window.location=('')\">&nbsp;</td><td class='nazev_oddeleni' onClick=\"window.location=('')\"  onMouseMove=\"this.style.background='#ECEAEB'\" onMouseOut=\"this.style.background='#F7F6F6'\">Access</td></tr>	");
	document.write("		<tr><td class='ikona_access' onClick=\"window.location=('')\">&nbsp;</td><td class='nazev_oddeleni' onClick=\"window.location=('')\"  onMouseMove=\"this.style.background='#ECEAEB'\" onMouseOut=\"this.style.background='#F7F6F6'\">Interkom/Fermax</td></tr>	");
	document.write("		<tr><td class='ikona_integrace' onClick=\"window.location=('')\">&nbsp;</td><td class='nazev_oddeleni' onClick=\"window.location=('')\"  onMouseMove=\"this.style.background='#ECEAEB'\" onMouseOut=\"this.style.background='#F7F6F6'\">Integrace a projekty</td></tr>	");
	document.write("		<tr><td class='ikona_integrace' onClick=\"window.location=('')\">&nbsp;</td><td class='nazev_oddeleni' onClick=\"window.location=('')\"  onMouseMove=\"this.style.background='#ECEAEB'\" onMouseOut=\"this.style.background='#F7F6F6'\">EZS a EKV MB Series</td></tr>	");
	document.write("		<tr><td class='ikona_integrace' onClick=\"window.location=('')\">&nbsp;</td><td class='nazev_oddeleni' onClick=\"window.location=('')\"  onMouseMove=\"this.style.background='#ECEAEB'\" onMouseOut=\"this.style.background='#F7F6F6'\">Komunikace</td></tr>	");
	document.write("		<tr><td class='ikona_integrace' onClick=\"window.location=('')\">&nbsp;</td><td class='nazev_oddeleni' onClick=\"window.location=('')\"  onMouseMove=\"this.style.background='#ECEAEB'\" onMouseOut=\"this.style.background='#F7F6F6'\">Strukturovaná kabeláž</td></tr>	");
	document.write("	</table>	");
}

function VlozitNovinkyTop3() {
	NactiZpravy(); // načtení zprávy ze souboru novinky-zpravy.js 
	document.write("	<table class='novinky-top3_tabulka' cellspacing='0'>	");
	document.write("		<tr><td class='novinky-top3_nadpis' onClick=\"location.href=\'./novinky.html\'\">Novinky</td></tr>	");
	
	for(i=zprava_nadpis.length-1; i>=zprava_nadpis.length-3; i--) {
		document.write("		<tr><td class='novinky-top3_radek'>" + zprava_datum[i] + "<br><a href='./novinky_zpravy.html?zprava=" + i + "'>" + zprava_nadpis[i] + "</a></td></tr>	");
	}	
	document.write("	</table>	");
}

function VlozitSkoleniTop3() {
	document.write('<sc'+'ript');
	document.write(' type="text/javascript"');
	document.write(' src="https://www.cctv.cz/new/skoleni/skoleni_top3.php">');
	document.write('</sc'+'ript>');
}

function VlozitObrazekStranky(nazev, pocet) {	
	do {obrazek = Math.ceil(Math.random()*pocet)}	while (obrazek == GetCookie("adi-olympo_obrazek-stranky"));	
	document.cookie="adi-olympo_obrazek-stranky=" + obrazek;	
	document.write("	<img src='./img/" + nazev + obrazek + ".jpg' style='display: block;'>	");	
}

function VlozitZapati() {
	document.write("	<table class='zapati-tabulka' cellspacing='0' cellpadding='0'>	");
	document.write("		<tr>	");
	document.write("			<td class='zapati-copyright'>&copy; ADI-OLYMPO - 2008</td>	");
	document.write("			<td class='zapati-znacka'>ADI-OLYMPO je obchodní značkou Honeywell, spol. s r.o. - Security Products o.z.</td>	");
	document.write("			<td class='zapati-soukromi'><a href='./ochrana_soukromi.html'>Ochrana soukromí</a></td>	");
	document.write("		</tr>	");
	document.write("	</table>	");
}

function AktivujNovyProdukt(prvek) {
	if (navigator.appName=="Microsoft Internet Explorer") document.getElementById("nove_produkty_obsah").filters("blendTrans").Apply();

	for(i=max; i>max-pocet; i--) {									
		document.getElementById("novy_produkt_zahlavi"+i).style.background = "#9A8F90";
	};							
	prvek.style.background = "#E42E2F";
	//document.getElementById("novy_produkt_zahlavi"+aktivni).href = produkt_odkaz[aktivni];
	document.getElementById("novy_produkt_nazev").innerHTML = produkt_nazev[aktivni];
	document.getElementById("novy_produkt_popis").innerHTML = produkt_popis[aktivni];
	document.getElementById("novy_produkt_obrazek").src = "/iiWWW/cz/Produkty110.nsf/wp/webdata/$file/" + produkt_nazev[aktivni] + ".jpg";
	document.getElementById("novy_produkt_odkaz").href = produkt_odkaz[aktivni];

	if (produkt_nazev[aktivni] == "NEXANS")	{document.cookie="adi-olympo_zprava=6"; if (produkt_odkaz[aktivni].indexOf("/sk/") != -1) document.cookie="adi-olympo_zprava=0";};
	if (produkt_nazev[aktivni] == "GALAXY DIMENSION")	{document.cookie="adi-olympo_zprava=8"; if (produkt_odkaz[aktivni].indexOf("/sk/") != -1) document.cookie="adi-olympo_zprava=4";};


	//	Vyjímka pokud odkaz vede do krátkých zpráv a PDF soubory
	if (produkt_odkaz[aktivni].indexOf("novinky_zpravy.html") != -1) document.getElementById("novy_produkt_odkaz").target = '_self'
		else {
					if (produkt_odkaz[aktivni].indexOf("pdf") != -1) document.getElementById("novy_produkt_odkaz").target = '_blank'
						else document.getElementById("novy_produkt_odkaz").target = '_top';
	};		

	//	Pokud není žádný odkaz 
	if (produkt_odkaz[aktivni] == "") document.getElementById("novy_produkt_odkaz").style.display = 'none'
		else document.getElementById("novy_produkt_odkaz").style.display = 'block';
		
	if (produkt_param[aktivni] != "") {
		var pole = produkt_param[aktivni].split(';');
		var parametry = "";
		for(z = 0; z < pole.length; z++) {parametry+="<li>" + pole[z] + "</li>";};		
		document.getElementById("novy_produkt_parametry").innerHTML = parametry;
		document.getElementById("novy_produkt_parametry").style.display = 'block';	
	} else document.getElementById("novy_produkt_parametry").style.display = 'none';

	if (navigator.appName=="Microsoft Internet Explorer") document.getElementById("nove_produkty_obsah").filters("blendTrans").Play();
}

function NoveProduktyCyklus() {
	AktivujNovyProdukt(document.getElementById("novy_produkt_zahlavi"+aktivni));
	aktivni--;
	if (aktivni==max-pocet) aktivni=max;	
}


function AktivujNoveVideo(cislo_video) {

	for(j=max_video; j>max_video-pocet_video; j--) {									
		document.getElementById("video_zahlavi"+j).style.background = "#9A8F90";
	};							
	document.getElementById("video_zahlavi"+cislo_video).style.background = "#E42E2F";	
	document.getElementById("video_nazev").innerHTML = video_nazev[cislo_video];
	document.getElementById("video_popis").innerHTML = video_popis[cislo_video];
	document.getElementById("video_odkaz").href = video_odkaz[cislo_video];
	if (video_odkaz[cislo_video] == "") document.getElementById("video_odkaz").innerHTML="";
	
	document.getElementById("video_soubor").innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="185" height="170" id="video_small" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="/iiWWW/cz/Produkty110.nsf/wp/video/$file/video_small.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ECEAEB" /><param name="flashvars" value="videosoubor=' + video_soubor[cislo_video] + '_small.flv&snimek=' + video_snimek[cislo_video] + '&cislo=' + cislo_video + '"><embed src="/iiWWW/cz/Produkty110.nsf/wp/video/$file/video_small.swf" flashvars="videosoubor=' + video_soubor[cislo_video] + '_small.flv&snimek=' + video_snimek[cislo_video] + '&cislo=' + cislo_video + '" quality="high" bgcolor="#ECEAEB" width="185" height="170" name="video_small" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" /></object>';
	
}


function PrehrajVideo(videosoubor, sirka, vyska, ramecek) {
	document.write("<object type='video/x-ms-wmv' style='width:" + sirka + "px; height:" + vyska + "px; border:1px solid " + ramecek +";'>");
	document.write("<param name='loop' value='1'>");
	document.write("<param name='autostart' value='1'>");
	document.write("<param name='showcontrols' value='0'>");
	document.write("<param name='src' value='" + videosoubor + "'>");
	document.write("</object>");
}


function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}

function TestIE() {
	if (navigator.appName=="Microsoft Internet Explorer") return true; else return false;
}