/**********************************************************************************************************************
 Author : Xiu qiang Chu
 slideShow plugin
 *********************************************************************************************************************/
(function($) {
    $.fn.cxqSlideShow = function(options) {

        var defaults = {
            mainImageContainer : '.main_image',
            thumbImageContainer : '.image_thumb'
        };

        var options = $.extend(defaults, options);

        this.each(function() {

            //Click and Hover events for thumbnail list
            $(this).find(options.thumbImageContainer +' ul li:first').addClass('active');
            var _this = $(this);
            $(this).find(options.thumbImageContainer +' ul li').click(function() {
                        //Set Variables
                        var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
                        var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL

                        if ($(this).is(".active")) {  //If it's already active, then...
                            return false; // Don't click through
                        } else {
                            //Animate the Teaser
                            _this.find(options.mainImageContainer).addClass('loading');
                            _this.find(options.mainImageContainer + ' img').animate({opacity:0},250, function(){

                                        _this.find(options.mainImageContainer + ' img').attr({ src: imgTitle , alt: imgAlt}).load(function(){
                                            _this.find(options.mainImageContainer).removeClass('loading');
                                            $(this).animate({ opacity: 1}, 250);
                                        });
                                    })

                        }

                        _this.find(options.thumbImageContainer +' ul li').removeClass('active'); //Remove class of 'active' on all lists
                        $(this).addClass('active');  //add class of 'active' on this list only
                        return false;

                    }).hover(function() {
                        $(this).addClass('hover');
                    }, function() {
                        $(this).removeClass('hover');
                    });
        });
    };
})(jQuery);

$(document).ready(function($) {
    $(".portfolioPost").cxqSlideShow();

//Toggle Teaser
    $('.toggle .bloc-title').click(function() {
        $(this).next('.bloc-content').slideToggle();
        $(this).parent('.toggle').toggleClass('active');
    });
});
/*notifier*/

