
$(document).ready(function() {
	
	$('.slideshow').cycle({
			fx: 'scrollDown',
			random:  1 
		})
		.hide();
	$('#news').jScrollPane({scrollbarWidth:2, scrollbarMargin:20});			
	$('div', '.navi').hide();
	$('.footer').hide();	
	$("#mcs5_container").css('visibility','hidden');				

	var colours = ['#333333', '#888888'];
	var currIndex = 0;
	var elem = $('.dragger');	
	var loop = setInterval(function() {
		elem.animate({
			backgroundColor: colours[currIndex++]
		}, {duration: 999});
		currIndex = currIndex == colours.length ? 0 : currIndex;
	}, 1000);
	
	

});

/* function to fix the -10000 pixel limit of jquery.animate */		
$.fx.prototype.cur = function(){
	if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
	  return this.elem[ this.prop ];
	}
	var r = parseFloat( jQuery.css( this.elem, this.prop ) );
	return typeof r == 'undefined' ? 0 : r;
}	

$(window).load(function() {
	$("img.reflect").reflect({/* Put custom options here */});
      mCustomScrollbars();
});
	
function mCustomScrollbars(){

   $("#mcs5_container").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",10); 
	
	$('.logo').delay(300).fadeIn(200, function(){
		
		$('.navi').delay(100).fadeIn(200, function(){
			
			$('div', '.navi').fadeIn(200);
			
			$('#mcs5_container').css('visibility','visible').hide();
			$('#mcs5_container').delay(200).fadeIn(800, function(){
				
				$('.footer').fadeIn(400);
			});
			$('.item.captionfull').hover(function(){
				$(".cover", this).stop().animate({top:'-205px'},{queue:false,duration:150});
				}, function() {
				$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:150});
			});			
			
		});
	});
	$('.slideshow').delay(1500).fadeIn(500);
} 

function effectFadeIn(classname) {
	$("."+classname).fadeOut(800).fadeIn(800, effectFadeOut(classname))
}
function effectFadeOut(classname) {
	$("."+classname).fadeIn(800).fadeOut(800, effectFadeIn(classname));
}
	
