	//Nav
	function goTo(numar){
		$("#mask ul li").animate({scrollTop: 0}, {duration: 300});
		$("#mask").animate({scrollLeft: 790 * numar}, {duration: 300});
	}

	//Fading pictures
	function slideSwitch() {
	    var $active = $('.slideshow IMG.active');
	
	    if ( $active.length == 0 ) $active = $('.slideshow IMG:last');
	
	    // use this to pull the images in the order they appear in the markup
	    var $next =  $active.next().length ? $active.next()
	        : $('.slideshow IMG:first');
	
	    // uncomment the 3 lines below to pull the images in random order
	    
	    // var $sibs  = $active.siblings();
	    // var rndNum = Math.floor(Math.random() * $sibs.length );
	    // var $next  = $( $sibs[ rndNum ] );
	
	
	    $active.addClass('last-active');
	
	    $next.css({opacity: 0.0})
	        .addClass('active')
	        .animate({opacity: 1.0}, 1000, function() {
	            $active.removeClass('active last-active');
	        });
	}
	
	$(function() {
	    setInterval( "slideSwitch()", 5000 );
	});

$(document).ready(function(){

	//Lightbox
	$("a[rel^='prettyPhoto']").prettyPhoto({theme: 'light_rounded'});

	$("#start").click(function(e){
		e.preventDefault();
		
		$(this).fadeOut("slow");
		$("#content").animate({top: "20px"}, {duration: 700});
	});
	
	$("#close").click(function(e){
		e.preventDefault();
		
		$("#content").animate({top: "-550px"}, {duration: 700});
		$("#start").fadeIn("slow");
	});
	
	$("#content ul.nav li a").click(function(e){
		e.preventDefault();
		$("#content ul.nav li a").removeClass("hover");
		$(this).addClass("hover");
		
		if($("#content").css('top') == '-550px'){
			$("#start").fadeOut("slow");
			$("#content").animate({top: "20px"}, {duration: 700});
		}
		
		var index = $("#content ul.nav li a").index(this);
		goTo(index);
	});
	
	//More
	
	$("a[href='#more']").click(function(e){
		e.preventDefault();
		$("#" + $(this).attr('rel')).slideToggle();
		if ($(this).html() == 'Mai mult') {
			$(this).html('Mai putin');
		}
		else {
			$(this).html('Mai mult');
		}
	});
	
});
