
function showBox(show, hide){		
	var s = document.getElementById(show);
	var h = document.getElementById(hide); 
	
	// pokud je show nezobrazen tak ho zobraz ...
	
	if(s.style.display == 'none'){ 
		s.style.display = 'block';
		// ... a pokud je hide viditelny tak ho skryj.
		if(h.style.display == 'block'){ h.style.display = 'none'; }
	}
	else{ s.style.display = 'none'; }
					
}

function AddFavorite(linkObj,addUrl,addTitle) 
{ 
	if (document.all && !window.opera) { 
		window.external.AddFavorite(addUrl,addTitle); 
		return false; 
	} 
	else if (window.opera && window.print) { 
		linkObj.title = addTitle;
		return true; 
	} 
	else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')) { 
		if (window.confirm('Přidat oblíbenou stránku jako nový panel?')) { 
			window.sidebar.addPanel(addTitle,addUrl,''); 
			return false; 
		} 
	} 
	window.alert('Po potvrzení stiskněte CTRL-D,\nstránka bude přidána k vašim oblíbeným odkazům.'); 
	return false; 
}

function changeText(id, text){	
	var t = document.getElementById(id);
	
	if(t.value == text){ t.value = ''; }
	else{ }
}

function kontrolaKatalog(form){

	if(form.jmeno.value == ""){
		alert("Zadejte prosím Váše jméno");
		form.jmeno.focus();
		return false;
	}
	else if(form.ulice.value == ""){
		alert("Zadejte prosím Váši ulici");
		form.ulice.focus();
		return false;
	}
	else if(form.mesto.value == ""){
		alert("Zadejte prosím Váše město");
		form.mesto.focus();
		return false;
	}
	else if(form.psc.value == ""){
		alert("Zadejte prosím Vaše PSČ");
		form.psc.focus();
		return false;
	}
	
}

function GenerateCustomFckGallery(files_array)
{
		var result="";
		result+="<div class='gallery-env'>";		
		
		for (var a=0;a<files_array.length;a++){
			result+="<a class='body-gallery fancybox' href=\""+files_array[a].path+"\"><img alt=\"\" src=\""+files_array[a].thumb+"\" /></a>";
		}
		
		result+="<div class='cleaner'></div></div>";
		return result;
}

function rotate(){

	var current = ($("#advert .item.active")?  $("#advert .item.active") : $("#advert .item:first"));
	if ( current.length == 0 ) current = $('#advert .item:first');

	var next = ( (current.next().length) ? ( (current.next().hasClass("active")) ? $("#advert .item:first") : current.next() ) : $("#advert .item:first") );

	next.css({opacity: 0.0}).addClass("active").animate({opacity: 1.0}, 1000);
	//Hide the current image
	current.animate({opacity: 0.0}, 1000).removeClass('active');
			
}

$(document).ready(function() {  
	
	$("a.fancybox, a.lightbox, a.body-gallery").fancybox({type: "image"});
	
	$("#advert .item").css({opacity: 0.0});
	$("#advert .item:first").css({opacity: 1});
	
	$("#advert").click(function(){
		var advertLink = $("#advert").attr("rel");
		window.location = advertLink;
	});
	
	if( $("#advert").length > 0 ){
		setInterval('rotate()',4500);
	}
	
	$("#domy .item .photo").click(function() {
		var thisHref = $(this).closest(".item").find("h3 a").attr("href");
		window.location.href = thisHref;
	});
					
});

$(window).load(function(){
	$("#mcs_container").mCustomScrollbar("vertical",0,"easeOutCirc",1.05,"auto","yes","no",0);
});
