var autoSlide = true;
var autoSlideSecs = 10;
var proj = 0;
var interval = null;

function textSlideIn(proj) {
	jQuery('ul.text').children('li:eq('+proj+')').animate({ right: "-1px" }, 3000);
}
function textSlideOut(proj) {
	jQuery('ul.text').children('li:eq('+proj+')').animate({ right: "-280px" }, 3000);
}
function photoFadeIn(proj) {
	jQuery('ul.photo').children('li:eq('+proj+')').fadeIn(3000);
}
function photoFadeOut(proj) {
	jQuery('ul.photo').children('li:eq('+proj+')').fadeOut(3000);
}
function photoPutBehind(proj) {
	jQuery('ul.photo').children('li:eq('+proj+')').css('z-index', 0);
}
function nextSlide() {
	jQuery('ul.photo').children('li:eq('+proj+')').css("z-index", 2);
	//setTimeout('photoFadeOut('+proj+')', 1000);
	//setTimeout('photoPutBehind('+proj+')', 1500);
	photoFadeOut(proj);
	photoPutBehind(proj);
	textSlideOut(proj);
	proj++;
	var i = jQuery('ul.text li').size() - 1;
	if (proj>i) proj = 0;
	//setTimeout('photoFadeIn('+proj+')', 1000);
	//setTimeout('textSlideIn('+proj+')', 1500);
	photoFadeIn(proj);
	textSlideIn(proj);
}

jQuery(function() {
	if (autoSlide) interval = setInterval('nextSlide()', autoSlideSecs*1000);
	jQuery('.next').click(function() {
		clearInterval(interval);
		nextSlide();
		if (autoSlide) interval = setInterval('nextSlide()', autoSlideSecs*1000);
		return false;
	});

	jQuery('#menu').find('li').each(function() {
		jQuery(this).mouseover(function() {
			if (!jQuery(this).hasClass('hover'))
				jQuery(this).addClass('hover');
		});

		jQuery(this).mouseout(function() {
			jQuery(this).removeClass('hover');
		});

	});
});
