/* * * * * * * * * * * * * * * * * *
 *  Author: roman.maler@gmail.com  *
 *  All rights reserved!           *
 *                                 *
 *  Creation date: 2005-05-01      *
 * * * * * * * * * * * * * * * * * */


var nom = navigator.appName.toLowerCase();
var agt = navigator.userAgent.toLowerCase();

var is_major   = parseInt(navigator.appVersion);
var is_minor   = parseFloat(navigator.appVersion);
var is_ie      = (agt.indexOf("msie") != -1);
var is_ie4up   = (is_ie && (is_major >= 4));
var is_not_moz = (agt.indexOf('netscape')!=-1)
var is_nav     = (nom.indexOf('netscape')!=-1);
var is_nav4    = (is_nav && (is_major  ==  4));
var is_mac     = (agt.indexOf("mac")!=-1);
var is_gecko   = (agt.indexOf('gecko') != -1);
var is_opera   = (agt.indexOf("opera") != -1);


// vyhledavani na strance
var n = 0;

function search_on_page(q)
{
	if (q == '') return false;

	if (is_opera) return;

	if (is_ie) {
		text = document.body.createTextRange();
		for(i=0; i <= n && (found = text.findText(q)); i++) text.moveStart("character", 1);

		if (found) {
			text.moveStart("character", -1);
			text.findText(q);
			text.select();
			text.scrollIntoView();
			n++;
		}
		else {
			if (n>0){ n=0; ffc_hledej(q); }
			else{ window.alert(q+' se na stránce nenchachází.'); }
		}
	}
	else {
		if (!this.find(q)) while(this.find(q, false, true)) n++;
		else n++;

		if (n == 0) window.alert(q+' se na stránce nenchachází.');
	}
}


var okno = '';
var url  = self.location.hostname;


// FOTKY Z FOTOGALERIE
function open_window_photos(title, photo, width, height)
{
	if (typeof(okno.document) == "object") okno.close();

	okno = window.open('http://'+url+'/fotogalerie/fotka.php?photo='+photo+'&title='+ title, 'fotka', 'left=50, top=50, width='+ width+
                     	   ', height='+height+', toolbar=no, location=no, directories=no, status=no, menubar=no, '+
			   'scrollbars=no, resizable=no, copyhistory=no');
}


// FOTKY Z CLANKU, LISTARNY, INZERCE
// FOTKY PSU A FEN
function open_window(title, path, width, height)
{
	if (typeof(okno.document) == "object") okno.close();

	okno = window.open('http://'+url+'/fotka.php?path='+path+'&title='+ escape(title), 'fotka', 'left=50, top=50, width='+ width+
                     	   ', height='+height+', toolbar=no, location=no, directories=no, status=no, menubar=no, '+
			   'scrollbars=no, resizable=no, copyhistory=no');
}


// OBRAZKY ZE SOUTEZE
function open_window_race(image, zaslal, pridano, width, height)
{
	height += 50;
	if (typeof(okno.document) == "object") okno.close();

	okno = window.open('http://'+url+'/soutez/obrazek.php?image='+image+'&zaslal='+zaslal+'&pridano='+pridano, 'obrazek', 'left=50, '+
                     	   'top=50, width='+width+', height='+height+', toolbar=no, location=no, directories=no, status=no, menubar=no, '+
			   'scrollbars=no, resizable=no, copyhistory=no');
}


// MAPA S CHS
function open_window_map(id, rasa, allchs)
{
	if (typeof(okno.document) == "object") okno.close();

	okno = window.open('http://'+url+'/ch-stanice/mapa.php?rasa='+rasa+'&id='+id+'&allchs='+allchs, 'Mapa', 'toolbar=no, location=no, '+
                     	   'directores=no, status=no, menubar=no, scrollbars=no, width=354, height=219, left=200, top=240');
}


// VYSVETLENI BONITACNIHO KODU
function open_window_bonitacni_kod(kod, jmeno)
{
	if (typeof(okno.document) == "object") okno.close();

	okno = window.open('http://'+url+'/chov/bonitacni-kod/bonitacni-kod.php?kod='+kod+'&jmeno='+jmeno, 'Bonitacni_kod', 'toolbar=no, '+
                     	   'location=no, directores=no, status=no, menubar=no, scrollbars=no, width=456, height=400, left=100, top=100');
}


// TISK
function open_window_print(page, id)
{
	if (typeof(okno.document) == "object") okno.close();

	okno = window.open('http://'+url+'/'+page+'/print.php?id='+id, 'print', 'toolbar=no, location=no, directores=no, status=no, '+
                     	   'menubar=no, scrollbars=yes');
}

function ffc_zpet(){ history.back(); }

function ffc_dalsi(){ history.forward(); }

