var __lang='cs';
var __baseURL='';
var __DOM=(document.getElementById)?true:false;
var __MSIE=/*@cc_on!@*/false;

function openImage(file,gid) {
	window.open('image.php?file='+file+'&gid='+gid,'detail',' width=200, height=200, toolbar=no, location=no, directories=no, status=yes, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=no');
}

function prodejci_otevri(typ, id_okresu) {
	window.open(__baseURL+'/prodejci_' + typ + '.detail.php?id=' + id_okresu, 'detail',' width=525, height=235, toolbar=no, location=no, directories=no, status=yes, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=no');
}

function objectAttachEvent(obj,ev,fn) {
	if (window.addEventListener) { // Modern browsers
		obj.addEventListener(ev,fn,false);
	}
	else { // IE
		obj.attachEvent('on'+ev,fn);
	}
}

var slideshow=new Array();
function slideshowPreload() {
	slideshow[0]='img/top-foto-home8.jpg'
	slideshow[1]='img/top-foto-home2.jpg'
	slideshow[2]='img/top-foto-home3.jpg'
	slideshow[3]='img/top-foto-home6.jpg'
	slideshow[4]='img/top-foto-home9.jpg'
	slideshow[5]='img/top-foto-home5.jpg'
	slideshow[6]='img/top-foto-home7.jpg'
	slideshow[7]='img/top-foto-home4.jpg'
	slideshow[8]='img/top-foto-home10.jpg'
	slideshow[9]='img/top-foto-home10.jpg'
}

shuffle = function(o){ //v1.0
	for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
	return o;
};

function slideshowStart() {
	if (!document.getElementById('header-anim-container')) return false;
	var slideshowHTML='';
	slideshow=shuffle(slideshow);
	for (i=0;i<slideshow.length;i++) {
		slideshowHTML+='<img src="'+slideshow[i]+'" alt="" width="311" height="127"/>';
	}
	document.getElementById('header-anim-container').innerHTML=slideshowHTML;
	Slideshow.Control.Container = $('header-anim-container');
	Slideshow.Control.Images.All = $$('div#header-anim-container img');
//	Slideshow.Control.Titlebar = $('slideshow-title');
		
	Slideshow.Control.Images.All.each(function(i) {
		if(!Slideshow.Control.Images.Widest || Slideshow.Control.Images.Widest.getWidth() < i.getWidth())
			Slideshow.Control.Images.Widest = i;
		if(!Slideshow.Control.Images.Tallest || Slideshow.Control.Images.Tallest.getHeight() < i.getHeight())
			Slideshow.Control.Images.Tallest = i;
		if(i != Slideshow.Control.Images.All.first())
			i.hide();
	});
	
	Slideshow.Methods.start();

//	new Effect.SlideShow($('anim',[shuffle(slideshow)]));
}

// ================== ukaze odpovidajici promenne v kalkulacce ========================
var otevrena_promenna = '';
function ukaz_promenne() {	
	
	prvek = document.getElementById('form-typ-vypoctu-typ-vypoctu');
	
	if (prvek) {
		hodnota = document.getElementById('form-typ-vypoctu-typ-vypoctu').value;
		//alert(hodnota);
		
		if (otevrena_promenna) document.getElementById('promenne-'+otevrena_promenna).style.display = 'none';
		if (hodnota) {
			document.getElementById('promenne-'+hodnota).style.display = 'block';
			otevrena_promenna = hodnota;
		}
	}
}
