// JavaScript Document


$(document).ready(function () {

    // set and show the layout of intro text and area listing
    // jquery.easyListSplitter.js plugin is required
    var areasLi = $('.spIntroAreaListingInsider li').length;
    var areasLiCols = 1;
    if (areasLi > 1){
        switch (true)
            {
                case ((areasLi >= 1) && (areasLi <= 6)):
                        areasLiCols = 1;
                        $('.spIntroLt').css('width','600px');
                        break;
                case ((areasLi >= 7) && (areasLi <= 18)):
                        areasLiCols = 2;
                        $('.spIntroLt').css('width','380px');
                        break;
                case ((areasLi >= 19) && (areasLi <= 40)):
                        areasLiCols = 2;
                        $('.spIntroLt').css('width','380px');
                        break;
                case (areasLi > 41):
                        areasLiCols = 4;
			$('.spIntroAreaListing').addClass('spIntroAreaListing4Cols');
                        $('.spIntroLt').css('width','220px');
                        break;
            };
        $('.spIntroAreaListingInsider ul').easyListSplitter({
                colNumber: areasLiCols,
                direction: 'horizontal'
        });
        $('.spIntro .loading').hide();
        $('.spIntroAreaListingInsider').css({'height':'auto'});
        $('.spIntroAreaListingInsider').fadeIn(500);
    }
    else {
        $('.spIntroAreaListing').fadeOut();
        $('.spIntroLt').css({'width':'880px'});
        $('.spIntroLt').css({'border':'none'})
    ;}
   

    // carousel articles
    // jquery.jCarouselLite.js plugin is required
    $('.slidingArticlesHorizontal').jCarouselLite({
        visible: 4,
        circular: true,
        btnNext: ".spArticlesInsider .btnNext",
        btnPrev: ".spArticlesInsider .btnPrev"
    });
    /*
    $('.slidingArticlesVertical').jCarouselLite({
        visible: 4,
        circular: false,
        btnNext: ".spArticlesInsider .btnNext",
        btnPrev: ".spArticlesInsider .btnPrev",
        vertical: true
    });
    */
    $('.spArticles .loading').hide();
    $('.spArticlesInsider').hide();
    $('.spArticlesInsider, .spArticlesInsider ul').css({'visibility':'visible', 'height':'auto'});
    $('.spArticlesInsider').fadeIn(500);
	
});
