﻿(function() {

    if (!window.Manipal)
        window['Manipal'] = {};

    function __validateControls(controlIDs) {

    }

    function __validateForm() {

    }

    function __loadRequiredFiles(URLs, type) {
        if (scriptsURL.length > 0) {
            var headRef = document.forms[0].getElementsByTagName('head')[0];
            var tag;
            for (var URLIndex; URLIndex < URLs.length; URLIndex++) {
                if (type == 'text/css') {
                    tag = document.createElement('link');
                    tag.setAttribute('rel', 'stylesheet');
                    tag.setAttribute('type', type);
                    tag.setAttribute('href', URLs[URLIndex]);
                }
                else {
                    tag = document.createElement('script');
                    tag.setAttribute('type', type);
                    tag.setAttribute('src', URLs[URLIndex]);
                }
                headRef.appendChild(tag);
            }
        }
    }

    function __initializeDatePickers(ids) {
        for (var index = 0; index < ids.length; index++) {
            $("#" + ids[index]).datepicker({
                altField: '#' + ids[index],
                dateFormat: 'dd/mm/yy',
                altFormat: 'dd/mm/yy',
                closeText: 'X',
                showButtonPanel: true,
                duration: 'fast',
                changeMonth: true,
                changeYear: true,
                constrainInput: true,
                yearRange: '1950:2010'
            });
        }
    }

    //window['Manipal']['LoadRequiredFiles'] = LoadRequiredFiles;
    window['Manipal']['InitDatePickers'] = __initializeDatePickers;

})();