position = 0


ac2 = function(){
	if($('#procects .active').next().html()){
		$('#btn_right').fadeIn()
	} else {
		$('#btn_right').fadeOut()
	}
	if($('#procects .active').prev().html()){
		$('#btn_left').fadeIn()
	} else {
		$('#btn_left').fadeOut()
	}
}

activate = function() {
	ac2()
	$('#procects ul').fadeOut()
	$('#procects .active').fadeIn()
}


$(document).ready(function() {
	$('#procects ul:first').addClass('active').fadeIn()
	ac2();
	$('#btn_right').click(function(){
		next = $('#procects .active').next()
		if(next.html()) {
			$('#procects .active').removeClass('active')
			next.addClass('active')
			activate()
		}
	})
	$('#btn_left').click(function(){
		prev = $('#procects .active').prev()
		if(prev.html()) {
			$('#procects .active').removeClass('active')
			prev.addClass('active')
			activate()
		}
	})
	
	$('.bw').each(function(){
		$(this).css({'background':'url('+$(this).children('a').children('img').attr('src')+') no-repeat center -155px'}).fadeIn()
		$(this).hover(function(){
			$(this).children('a').children('img').fadeIn()
		}, function() {
			$(this).children('a').children('img').fadeOut()
		})
	})

})

