/**
 * Visit Lancashire Site Scripts
 * @author mjames
 */
//var NewMind = window.NewMind || {};
NewMind.registerNameSpace("NewMind.Site");




NewMind.Site.HomeContentSwitcher = function() {
    //private vars

    return {
        init: function() {

            $('div.homeProducts').hide(); //hide homeProducts then let the custom event show them

            NewMind.platform.introContent.wrapupElements({
                contentSelector: '#homeContent',
                wrapperClass: 'homeContentWrapper'
            });

            NewMind.platform.introContent.wrapupElements({
                contentSelector: 'div.homeContentWrapper, div.homeBanners',
                wrapperClass: 'introWrapper'
            });


            //some dodgy custom event hackery - these go before the init as the init uses them

            NewMind.platform.introContent.addcustomevent(function() {
                clearTimeout(NewMind.env.introcontent.autoclosetimer); //clear introcontent timer
                var homeprod = $('div.homeProducts:not(:animated)');
                if (homeprod !== "undefined") {
                    if (homeprod.is(':visible')) {
                        $('div.homeProducts').slideUp();
                    }
                    else {
                        $('div.homeProducts').slideDown();
                    }
                }
            }, true);

            NewMind.platform.introContent.init({
                contentSelector: '.introWrapper',
                showhidecontainer: 'div.ctl_PageTitle',
                pageturncontainer: '#homeContent',
                closecontainer: '#homeContent',
                cookiename: 'homeintro',
                autoclose: 4000 /* 4 secs */
            });
        }
    };
} ();

NewMind.Site.ImageSwitcher = function() {
	var swapImages = function(args) {
		$(args.selector).attr('src', args.newimage);
	};
	return {
		init: function(args) {
			swapImages(args);
		}
	};
} ();

NewMind.Site.HideEmptyContent = function(strSelector) {
	$(strSelector).each(function() {
		if ($(this).children().length === 0) {
			$(this).addClass('hidden');
		}
	});
}
