$(document).ready(function(){
	if($(".autoform").size()>0){
		$(".autoform").validate();
	}
	if($('#portfolio_menu a#menu_18').hasClass('selected')){
		$('#content_top').css('background-image', 'url(/images/bg_content_top_2.jpg)');
	}

	if ($("#back_next_array").is('*')){
		var pathname = window.location.pathname;
		var current_item = pathname.substr(pathname.lastIndexOf('/') + 1);

		var last = '';
		var lastlink = '';
		var takenext = false;

		$("#back_next_array a").each(function(item){
			if(takenext){
				$('#content_but_right a').attr('href', $(this).attr('href'));
				$('#content_but_right img').attr('alt', $(this).value);
				$('#content_but_right').css("display", "block");
				takenext = false;
			}

			ititem = $(this).attr("href").substr($(this).attr("href").lastIndexOf('/') + 1);

			if(ititem == current_item){
				if(lastlink != ''){
					$('#content_but_left a').attr('href', lastlink);
					$('#content_but_left img').attr('alt', last);
					$('#content_but_left').css("display", "block");
				}
				takenext = true;
			}
			last = $(this).html();
			lastlink = $(this).attr("href");
		});

		
	}
});
