$(function()
{
	var a_width = 145+5+2;
	var a_height = 99+13;
	
	var pos_x = 43;
	var pic_nr = 0;
	var pics = 0;
	var left = 43;
	
	var from = 0;
	var to = 6;
	
	
	if( ($.browser.msie = true)&& ($.browser.version < 8) )
	{
		$(".three").css({ "margin" : "0" });
	}
	
	
	$("#pictures a:not(.prev, .next)").each(function(br)
		{
			$(this).css({ "position" : "absolute" , "top" : "0" , "left" : pos_x});
			pos_x += a_width;
			pic_nr+=1;
			
			if(pic_nr == 6)
			{
				pos_x += 43;
				pic_nr = 0;
			}
			pics = br;
		} 
	)
	
	rows = Math.ceil( (pics+1) / 6 );
	
	$("#pictures a.next").click(function()
	{
		
		$("#pictures a:not(.prev, .next)").slice(from, to).animate({ "left" : "-200" }, 900);
		
		from = from + 6;
		to = to+6;
		left = 43;
		
		if(from >= pics)
		{
			from = 0;
			to = 6;
		}
		
		
		$("#pictures a:not(.prev, .next)").slice(from, to).each(function()
			{ 
				$(this).animate({ "left" : left }, 900);
				left = left + a_width;
			})

		return false;
	})
	
	
	
	$("#pictures a.prev").click(function()
	{
		
		$("#pictures a:not(.prev, .next)").slice(from, to).animate({ "left" : "1000" }, 900);
		
		from = from - 6;
		to = to-6;
		left = 43;
		
		if(from < 0)
		{
			from = (rows*6)-6;
			to = rows*6;
		}
		
		$("#pictures a:not(.prev, .next)").slice(from, to).each(function()
			{ 
				$(this).animate({ "left" : left }, 900);
				left = left + a_width;
			})
		
		return false;
	})
	



})
