$(document).ready(function()
{	
	
	
	
	
	slide("#sliding-navigation", 90, 100, 150, .8);
	topmenu();
	
	
	$(".sliding-element a").click(function(){
		$('.sel').removeAttr('class');
		$(this).attr('class','sel');
		
      ////$(this).clone(true).insertAfter(this);
    });
	
	
	//$(".sliding-element a").attr("onclick","$('.sel').removeAttr('class');$(this).attr('class','sel');");
	
	$("#loader").remove();
	$("#pages").removeClass('pages');
});

function slidefoto(){
	$('#design_foto').fadeTo('fast', 0.13);
	$('#design_foto').animate({background: "url(img/gal/foto"+(new Date).getTime()%10+".jpg) no-repeat;"}, 1 );
	$('#design_foto').fadeTo('slow', 1);
	}

function topmenu(){
	//slidefoto();
	$(".sliding-element a").click(function(){
		num = $(".sliding-element a").index(this)*375;
		$('.main-content').stop();
		$('.main-content').fadeTo('fast', 0.55);
		$(".main-content").animate({left: "-"+num+"px"}, 1500 );
		$('.main-content').fadeTo('slow', 1);
    	});
	}
	
function command1(){
	//slidefoto();
	
	}

function slide(navigation_id, pad_out, pad_in, time, multiplier)
{
	// creates the target paths
	var list_elements = navigation_id + " li.sliding-element";
	var link_elements = list_elements + " a";
	
	// initiates the timer used for the sliding animation
	var timer = 0;
	
	// creates the slide animation for all list elements 
	$(list_elements).each(function(i)
	{
		// margin left = - ([width of element] + [total vertical padding of element])
		//$(this).css("margin-left","15px");
		// updates timer
		timer = (timer*multiplier + time);
		$(this).animate({ width: "90px" }, timer);
		$(this).animate({ width: "100px" }, timer);
		$(this).animate({ width: "90px" }, timer);
	});

	// creates the hover-slide effect for all link elements 		
	$(link_elements).each(function(i)
	{
		$(this).hover(
		function()
		{
			$(this).animate({ width: pad_in }, 150);
		},function()
		{
			$(this).animate({ width: pad_out }, 150);
		});
	});
}
