function zpet(){
	document.getElementById('wait').style.visibility ='visible';
	history.go(-1);
	return false;
}
function vpred(){
	document.getElementById('wait').style.visibility ='visible';
	history.go(1);
	return false;
}
function link(url){
	document.getElementById('wait').style.visibility ='visible';
	document.location.href=url;
	return false;
}
function form(url){
	document.getElementById('wait').style.visibility ='visible';
	document.formular.submit()
	return false;
}
function addFiltrOn(){
	document.getElementById('addfiltr').style.visibility ='visible';
	document.getElementById('vypFiltrOn').style.visibility ='hidden';
	return false;
}
function addFiltrOff(){
	document.getElementById('addfiltr').style.visibility ='hidden';
	document.getElementById('vypFiltrOn').style.visibility ='visible';
	return false;
}

function addHelpOn(){
	document.getElementById('addhelp').style.visibility ='visible';
	document.getElementById('vypHelpOn').style.visibility ='hidden';
	return false;
}
function addHelpOff(){
	document.getElementById('addhelp').style.visibility ='hidden';
	document.getElementById('vypHelpOn').style.visibility ='visible';
	return false;
}

function addFotoOn(foto,id){

        var ofoto = document.images['FotoBig'];

        //iimg = new Image();
        //iimg.src = foto;
        //var w = iimg.width;
        //var h = iimg.height;
        //var max = (w > h)? "w" : "h";
        //var koef = 0;
        //if (max == "w" && w < 410) {
        //    koef = 410 / w;
        //    ofoto.width = w * koef;
        //    ofoto.height = h * koef;
        //}
        //else if (max == "h" && h < 410) {
        //      koef = 410 / h;
        //      ofoto.width = w * koef;
        //      ofoto.height = h * koef;
        //}
        
        document.getElementById('addfoto').style.visibility ='visible';
	document.getElementById("popiskaobr").src =id;
	ofoto.src = foto;
	document.location.href = '#all';




	return false;
}
function addFotoOff(){
	document.getElementById('addfoto').style.visibility ='hidden';
	document.images['FotoBig'].src ='img/progressbar.gif';
	return false;
}
function addFotoNext(foto,id){
	parent.document.images['FotoBig'].src ='img/progressbar.gif';
	parent.document.getElementById("popiskaobr").src =id;
	parent.document.images['FotoBig'].src =foto;
	return false;
}

function previewSidebar(preview_name, preview_url) {
  var sidebar = window.open(preview_url,"sidebar","width=162,height=450,scrollbars=yes,resizable=yes");
      sidebar.focus();
      return false;
} 
function addSidebar(add_name, add_url, config_url) {
  if (config_url == null) config_url = "";

  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) {
    window.sidebar.addPanel(add_name, add_url, config_url);
  } else {
    window.alert("You will need a browser which supports Sherlock to install this plugin.");
  }
}


// VRACI OBJEKT OBSAHUJICI PROMENNE .TOP A .LEFT, KTERE OBSAHUJI SPRAVNE INFORMACE O POZICI PRVKU NA STRANCE (I V IE :)
function getElementPosition(elemID) {
    var offsetTrail = getElementWithId(elemID);
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 &&
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {left:offsetLeft, top:offsetTop};
}


// FCE VRACI OBJEKT PODLE ZADANEHO ID
var getElementWithId;
if(document.getElementById){
	getElementWithId = function(id){
		return document.getElementById(id);
	}
}else if(document.all){
	getElementWithId = function(id){
		return document.all[id];
	}
}else{
	getElementWithId = function(id){
		return false;
	}
}


function getFlashMovieObject(movieName) {
	if (window.document[movieName]) {
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1) {
		if (document.embeds && document.embeds[movieName])
		return document.embeds[movieName];
	}
	else { // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
		return document.getElementById(movieName);
	}
}

function mp3_play(invoker, data) {
	var o = document.getElementById('mp3playerbox');
	o.style.visibility = 'visible';

	var playerPosition = getElementPosition(invoker);
	//alert(playerPosition.left+' - '+playerPosition.top);
	var newxpos = playerPosition.left+25;
	if ( (newxpos+418) > 770 ) {
		newxpos = playerPosition.left-419;
		if (newxpos < 0 ) newxpos = 770-418;
	}
	o.style.top = (playerPosition.top-50)+"px";
	o.style.left = (newxpos-160)+"px";

	var flashMovie=getFlashMovieObject('mp3player');
	flashMovie.SetVariable("/:url", data);
}

function mp3_close_player() {
	var o = document.getElementById('mp3playerbox');
	o.style.visibility = 'hidden';
	var flashMovie=getFlashMovieObject('mp3player');
	flashMovie.SetVariable("/:url", '');
}


