﻿

var myApp = {

    maxTabs: 4,
    maxTabsItems: 4,

    init: function() {
        for (var i = 1; i <= this.maxTabs; i++) {
            var sName = 'tab' + i;
            if ($('#' + sName + 'On').length === 1) {
                /* Events for the tab */
                $('#' + sName).bind('mouseover', function() { $(this).attr('className', 'tabOn'); $('#' + this.id + 'On').show(); });
                $('#' + sName).bind('mouseout', function() { $(this).attr('className', 'tabOff'); $('#' + this.id + 'On').hide(); });

                /* Events for the open window linked to the tab */
                $('#' + sName + 'On').bind('mouseover', function() { $('#' + this.id.rright(2)).attr('className', 'tabOn'); $(this).show(); });
                $('#' + sName + 'On').bind('mouseout', function() { $('#' + this.id.rright(2)).attr('className', 'tabOff'); $(this).hide(); });

                for (var j = 1; j <= this.maxTabsItems; j++) {
                    var iName = 'stmenu' + i + j;
                    if ($('#' + iName).length === 1 && $('#' + iName + 'a').length === 1) {
                        $('#' + iName).bind('click', function() { document.location.href = $('#' + this.id + 'a').attr('href'); /*$('#' + this.id + 'a').click();*/ });
                    }
                }
            }
        }
    }
};



$(document).ready(function() {
    $(document).pngFix();
    myApp.init();
});
