function showMain(){
	$('#main').slideDown('slow', function(){
		$('.navigacija2').fadeIn();
	});
}

function firebugLog(text) {
	if (window.console && console.log) { 
		console.log(text);
	}
}

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}, 1000, function() {
            $active.removeClass('active last-active');
        });
}


$(document).ready(function (){	
	
	/*if ($('.panelgallery').size()) {
		$.getScript("js/jquery.panelgallery-1_1.js");
		firebugLog('Panelgallery loaded!');
	}*/
	
	/*$(window).load(function () {
		$('.panelgallery').each(function(){
			var divContainer = $(this);
			$(divContainer).panelGallery({
				sections:8,
				imageTransitionDelay :3000,
				startDelay:3000,
				sectionTransitionDelay : 250
			});
		});
	});*/
	
	setInterval( "slideSwitch()", 5000 );
	
	$('HTML').addClass('JS');
	setTimeout(showMain,100);
	$('a[class^="id"]').click(function() {
		var toGo = $(this).attr('href');
		$('#main').slideUp('slow');
		$('.navigacija2').fadeOut('slow', function(){
			window.location = toGo;
		});
		return false;
	});
	
	if ($('a[rel*=lightbox]').size()) {
		$.getScript("js/jquery.lightbox-0.5.pack.js", function(){
			/*$('a[rel*=lightbox]').lightBox({
				imageLoading:	'images/lightbox-ico-loading.gif',
				imageBtnPrev:	'images/lightbox-btn-prev.gif',
				imageBtnNext:	'images/lightbox-btn-next.gif',
				imageBtnClose:	'images/lightbox-btn-close.gif',
				imageBlank:		'images/lightbox-blank.gif',
				txtImage:		'Image',
				txtOf:			'of',
			});*/
			$('a[rel$=_1]').lightBox();
			$('a[rel$=_2]').lightBox();
			$('a[rel$=_3]').lightBox();
			$('a[rel$=_4]').lightBox();
			$('a[rel$=_5]').lightBox();
			$('a[rel$=_6]').lightBox();
			$('a[rel$=_7]').lightBox();
			$('a[rel$=_8]').lightBox();
			$('a[rel$=_9]').lightBox();
		});
	}
	
	$("#jquery_jplayer").jPlayer({
		ready: function () {
			$(this).setFile("mp3/de-phazz-un_ange.mp3").play();
		},
		volume: 50
	})
	.jPlayerId("play", "player_play")
	.jPlayerId("pause", "player_pause")
	.onSoundComplete( function() {
		$(this).play();
	});

});