/**
 * Paul Smith JavaScript manifest.
 */
/*JS.Packages(function() { with(this) {
    var sitePath = function(path) {
        return Helium.SITE_JS_PATH + (Helium.USE_MINIFIED_FILES ? path + '-min.js' : path + '.js');
    };
    
    file(sitePath('utilities'))
        .provides('setControlWidth',
                  'verticallyCentre',
                  'labelInField',
                  'fixWidows',
                  'makeHoverable',
                  'showLinksInOverlay')
        .requires('Ojay',
                  'Ojay.Forms');
    
    file(sitePath('basket_counter'))
        .provides('BasketCounter')
        .requires('JS.Singleton',
                  'Ojay',
                  'Ojay.HTML',
                  'YAHOO.util.Cookie');
    
    file(sitePath('tabbed_paginator'))
        .provides('TabbedPaginator')
        .requires('Ojay.Paginator',
                  'Ojay.Tabs',
                  'setControlWidth');
    
    file(sitePath('thumbnail_tabs'))
        .provides('ThumbnailTabs')
        .requires('Ojay.Tabs');
    
    file(sitePath('multi_link_promo'))
        .provides('MultiLinkPromo')
        .requires('Ojay',
                  'YAHOO.util.Event._createMouseDelegate');
    
    file(sitePath('product_form'))
        .provides('ProductForm')
        .requires('Ojay',
                  'BasketCounter')
            .uses('Ojay.HTML',
                  'Ojay.HTTP',
                  'Ojay.Forms');
    
    file(sitePath('product_gallery'))
        .provides('ProductGallery')
        .requires('Ojay',
                  'JS.State',
                  'Ojay.HTML',
                  'YAHOO.util.DD');
    
    file(sitePath('mixed_media_gallery'))
        .provides('MixedMediaGallery')
        .requires('Ojay',
                  'Ojay.HTML');
    
    file(sitePath('checkout'))
        .provides('Checkout',
                  'Checkout.Address',
                  'Checkout.AddressHelper',
                  'Checkout.AccountLookup')
        .requires('Ojay',
                  'Ojay.Observable',
                  'Ojay.Keyboard',
                  'Ojay.Forms',
                  'Ojay.HTTP',
                  'Ojay.URI');
    
    file(sitePath('paged_overlay'))
        .provides('PagedOverlay')
        .requires('JS.Singleton',
                  'JS.State',
                  'Ojay',
                  'Ojay.HTML',
                  'Ojay.Keyboard')
            .uses('Ojay.PageMask',
                  'Ojay.ContentOverlay',
                  'Ojay.HTTP');
    
    file(sitePath('cardhelp'))
        .provides('CardHelp')
        .requires('Ojay');
}});*/

/**
 * Vertically centre the main navbars
 */
require('verticallyCentre', function() {
    Ojay.onDOMReady(function() {  
        verticallyCentre('#nav-wrapper');
    });
});

/**
 * Place their labels in these fields.
 */
require('labelInField', function() {
    Ojay.onDOMReady(function() {
        ['#searchField'].forEach(labelInField);
    });
});

/**
 * Correctly centre paging controls.
 */
require('setControlWidth', function() {
    Ojay.onDOMReady(function() {
        Ojay('.paging .controls').forEach(setControlWidth);
    });
});

/**
 * Create hover states in IE for submit buttons.
 */
require('makeHoverable', function() {
    Ojay.onDOMReady(function() {
        makeHoverable('input[type=submit]');
    });
});

/**
 * Show Terms & Conditions links in an overlay.
 */
require('showLinksInOverlay', function() {
    Ojay.onDOMReady(function() {
        showLinksInOverlay('#bd a[href$="/terms.html"], #bd a[href$="/terms-conditions-popup.html"]');
    });
});

