﻿/// <reference path="../jQuery/jquery-1.4.1-vsdoc.js" />
var debug = false;

var jQueryFileLocation = debug ? "jquery-1.5.1.js" : "http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js";

majestic.tools.loader.loadAll({
    'init.js': {
        'cycle.js': jQueryFileLocation,
        'jquery.marquee.js': jQueryFileLocation
    },
    'initDetail.js': {
        'carousel.js': {
            'lightbox.js': {
                'tabs.js': jQueryFileLocation
            }
        }
    },
    'productScroll.js': jQueryFileLocation,
    'jquery.youtubeplaylist.js': jQueryFileLocation
}, "/scripts/hs");


majestic.tools.loader.waitForjQuery(function () {
    window.majestic.tools.loader.loadAll({
        'init.js': {
            'cycle.js': null,
            'jquery.marquee.js': null,
            'jquery.textareaCounter.plugin.js': null
        },
        'initDetail.js': {
            'carousel.js': {
                'lightbox.js': 'tabs.js',
                'productScroll.js': null
            },
            'jquery.belowfold.js': null,
            'jquery.youtubeplaylist.js': null                
        },
        'faqs.js': null,
        'basket.delivery.js' : ['validation.errors.js', 'validation.expressions.js'],
        'basket.address.js' : null
    }, "/scripts/hs");
    
    window.jQuery(function () {
        if ((window.jQuery('#branchFinder').length > 0) || (window.jQuery('#pageContent').find('.foundBranchResults').length > 0))
        {
            window.majestic.tools.loader.waitFor('google.maps.LatLngBounds', function () {
                //Info bubble is add-on for Google Map API V3 - info tabs that were part of the core of Google Map API V2 are not part of the core of Google Map API V3
                window.majestic.tools.loader.loadAll({ "/scripts/hs/branchfinder.js": "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src/infobubble-compiled.js" });
            });
        }
    });
});
