﻿// Call all basic functions in site

function defaultFunction() {
    navigationBarAccordion();
    fontSizeControl();
    activeHeaderSubmenu();
}

// Run the Accordion Effect

function navigationBarAccordion() {
    $('H5').click(
		function() {
		    if ($("*").index($(this).next()[0]) != $("*").index($('LI.navArea UL:visible')[0]))
		        $('LI.navArea UL:visible').slideUp();

		    $(this).next().slideDown();
		},
		function() {
		}
	);
}

// Run the Control of Size Font

function fontSizeControl() {
    $('A#aMore').click(function() {
        iDefaultFontSize = iDefaultFontSize + 2;

        $('.text').css('font-size', iDefaultFontSize + 'px');
        $('.text').css('line-height', iDefaultFontSize + (iDefaultFontSize / 2) + 'px');

        $('.textBold').css('font-size', iDefaultFontSize + 'px');
        $('.textBold').css('line-height', iDefaultFontSize + (iDefaultFontSize / 2) + 'px');
    });

    $('A#aLess').click(function() {
        if (iDefaultFontSize >= 14) {
            iDefaultFontSize = iDefaultFontSize - 2;

            $('.text').css('font-size', iDefaultFontSize + 'px');
            $('.text').css('line-height', iDefaultFontSize + (iDefaultFontSize / 2) + 'px');

            $('.textBold').css('font-size', iDefaultFontSize + 'px');
            $('.textBold').css('line-height', iDefaultFontSize + (iDefaultFontSize / 2) + 'px');
        }
    });
}

// Run the Sub Menu Options in Header Main Menu

function activeHeaderSubmenu() {
    $('#topMenu A').hover(
		function() {
		    $('#topMenu A').css('color', '#b2c0d3');
		    $('#topMenu LI.last A').css('color', '#c1b2b3');

		    if ($('#topMenu A').index(this) != 6)
		        $(this).css('color', '#036');
		    else
		        $(this).css('color', '#aa1f2f');

		    $('.topSubmenu').hide();

		    var subMenuName = '#sm' + ($(this).attr('id')).substring(3);
		    $(subMenuName).fadeIn('3000');
		},
		function() {
		}
	);

    $('.topSubmenu').hover(
		function() {
		},
		function() {
		    $('#topMenu A').css('color', '#b2c0d3');
		    $('#topMenu LI.last A').css('color', '#c1b2b3');
		    //$('.topSubmenu').fadeOut('3000');
		}
	);
}

// Run the controls of Events calendar

function calendarEvents() {
    $.jMonthCalendar.Initialize(options, events);
}

function datePickerInputForm(inputID) {
    $(inputID).DatePicker(
    {
        format: 'm/d/Y',
        date: $(inputID).val(),
        current: $(inputID).val(),
        starts: 0,
        position: 'bottom',
        onBeforeShow: function() {
            $(inputID).DatePickerSetDate($(inputID).val(), true);
        },
        onChange: function(formated, dates) {
            $(inputID).val(formated);
        }
    });
}