jQuery.fn.simpleImageRollover = function(preload) {
    if (preload) {
        this.each(function() {
            var i = new Image;
            i.src = this.src;
        });
    }
    this.hover(
        function() { this.src = this.src.replace(/\.(\w+)$/, 'h.$1'); },
        function() { this.src = this.src.replace(/h\.(\w+)$/, '.$1'); }
    );
};
var slideSwitch = function() {
    var active = jQuery('#slideshow img.active');
    if ( active.length == 0 )
        active = jQuery('#slideshow img:last');
    var next =  active.next().length ? active.next() : jQuery('#slideshow img:first');
            active.addClass('last-active');
            next.css({opacity: 0.0})
                .addClass('active')
                .animate({opacity: 1.0}, 1000, function() {
            active.removeClass('active last-active');
        });
}

;(function($) {

        $(document).ready(function() {
        // put all your jQuery goodness in here.

        $("#comments").hide();

        setInterval(slideSwitch, 5000 );

        $('.rollover').simpleImageRollover('preload');

        $('#ticker').bxSlider({
            mode: 'ticker',
            speed: 7000,
            width: 260,
            wrapper_class: 'ticker_container'
        });

        $("#addFast").click(function() {
           $('#comments').modal({
                    opacity:80,
                    overlayCss: {backgroundColor:"#fff"}
            });
            return false;
        });

        $("h3.accord").next().hide();

        $("h3.accord").click(function() {
           $(this).next().slideToggle();
        });

        $("ul.celb-slide").bxSlider({
            mode: 'ticker',
            speed: 9000,
            auto: true,
            controls: true,
            width: 400,
            auto_direction: 'right',
            wrapper_class: 'celeb_container'
        });

        $("div.celeb-detail").hide();

        $("a.celeb-link").click(function() {
            $("div.celeb-detail").hide();
            var text = $(this).attr('id');
            $("div#" + text + "-text").fadeIn();
            return false;
        });
		$("div.a2z").hide();
		$("a.a2z-link").click(function() {
			$("div.a2z").hide();
			var letter = $(this).attr("id");
			$("div#"+ letter +"-content").fadeIn();
			return false;
		});
    });
})(jQuery);