(function($) {
    $.fn.customFadeIn = function(speed, callback) {
        $(this).fadeIn(speed, function() {
                if(jQuery.browser.msie)
                        $(this).get(0).style.removeAttribute('filter');
                if(callback != undefined)
                        callback();
        });
    };
    $.fn.customFadeOut = function(speed, callback) {
        $(this).fadeOut(speed, function() {
                if(jQuery.browser.msie)
                        $(this).get(0).style.removeAttribute('filter');
                if(callback != undefined)
                        callback();
        });
    };
})(jQuery);

$(window).ready(function() {
	$('#cycle').cycle({
		fx:      'scrollHorz', 
		speed:   600, 
		timeout: 5000,
		pause:   1,
		auto:    1,
		next:    '#next', 
		prev:    '#prev',
		before:  function() { $(".photographer").fadeOut('fast'); },
		after:   function() { $("#photographer").html($(this).attr('alt')); $(".photographer").customFadeIn('fast'); }
	});

	$('#pause').click(function(){
		$('.pause').hide();
		$('.play').show();
		$('#cycle').cycle('pause');
		return false;
	});
	
	$('#play').click(function(){
		$('.play').hide();
		$('.pause').show();
		$('#cycle').cycle('resume');
		return false;
	});
});
