$(document).ready(function(){
	$('.infoBoxMenuItem').click(function() {
		$("#infoBoxMenuCurrentItem").removeAttr("id");
		$(this).attr("id", "infoBoxMenuCurrentItem");
		if ( ($(document).height() - $(window).height()) < ($(this).offset().top) ) {
			scrollToHere = ($(document).height() - $(window).height());
		} else {
			scrollToHere = ($(this).offset().top) - 5;
		}
		if ( ( $('html').scrollTop() != scrollToHere ) && ( $('body').scrollTop() != scrollToHere ) ) {
			$('html,body').animate({scrollTop: scrollToHere}, {duration: 500, easing: 'easeInOutQuint' });
		}
	});
	$('.ibmi1').click(function() {
		$("#currentInfoItem").removeAttr("id");
		$('.infoItem1').attr("id", "currentInfoItem");
	});
	$('.ibmi2').click(function() {
		$("#currentInfoItem").removeAttr("id");
		$('.infoItem2').attr("id", "currentInfoItem");
	});
	$('.ibmi3').click(function() {
		$("#currentInfoItem").removeAttr("id");
		$('.infoItem3').attr("id", "currentInfoItem");
	});
	$('.ibmi4').click(function() {
		$("#currentInfoItem").removeAttr("id");
		$('.infoItem4').attr("id", "currentInfoItem");
	});
});

$(window).load(function(){
	$('#slides')
		.after('<div id="nav">')
		.cycle({ 
			fx:     'fade', 
			speed:  'fast',
			speed:    300,
			timeout:  6500,
			pager:  '#nav',
			pause: true
	});
	$('#slides').hover(function(){
		$('.pauseStatus').animate({
			opacity: 0.5
		}, 200);
	},function(){
		$('.pauseStatus').animate({
			opacity: 0
		}, 200);
	});
});