﻿/// <reference path="xtn-1.0.js" />
/// <reference path="jquery-1.4.3.min.js" />
(function ($) {

    xtn.extend({
        layout: {
            autoAjust: function (settings) {
                var config = {
                    offsetX: 0,
                    width: 1000,
                    selector: '',
                    css: ''
                };

                if (settings) $.extend(config, settings);

                var fn = {
                    ajust: function () {
                        var space = ($(window).width() - config.width + config.offsetX) / 2;

                        if (space < -1) space = 0;

                        $(config.selector).css(config.css, space + 'px');
                    }
                };

                $(window).resize(fn.ajust);

                // first kick
                fn.ajust.call(window, undefined);
            }
        }
    }, xtn.fn);


    $(document).ready(function () {
        // init execute    

        xtn.fn.layout.autoAjust({
            offsetX: -68,
            selector: '#ui-wrapper-logos',
            css: 'margin-left'
        });

        xtn.fn.layout.autoAjust({
            offsetX: -210,
            selector: '#ui-wrapper-auth',
            css: 'margin-right'
        });

    });

})(jQuery);
