function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 3000, function() {
            $active.removeClass('active last-active');
        });
}

$(document).ready(function() {
    setInterval( "slideSwitch()", 7000 );
	$("a[rel=gallery]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">Obrázok ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' - ' + title + '</span>';
		}
	});
	if ($('#contactmap').length != 0) {
		var map = new GMap2(document.getElementById('contactmap'));
		var jenisejska = new GLatLng(48.68495422430645, 21.291825771331787);
		map.setCenter(jenisejska, 15);
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		var point = new GLatLng(48.68495422430645, 21.291825771331787);
		marker = new GMarker(point);
		map.addOverlay(marker);
	}
		
	$(function() {
			   var v = $("#gallery-paginator").val();
			   if(v == "") { //je tam
			   		//$("#actuality-paginator").depagination();
				    itemsPerPage = 5;
			    	$("#gallery-paginator").pagination();
			   }
			   
			   var v = $("#actuality-paginator").val();
			   if(v == "") { //je tam
			   		//$("#gallery-paginator").depagination();
				    itemsPerPage = 3;
			    	$("#actuality-paginator").pagination();
			   }
			   
			   var v = $("#activity-paginator").val();
			   if(v == "") { //je tam
			   		//$("#gallery-paginator").depagination();
				    itemsPerPage = 5;
			    	$("#activity-paginator").pagination();
			   }
			   });
	
	$(function(){
		$('a.new-window').click(function(){
			window.open(this.href);
			return false;
		});
	});
});


