﻿/// <reference path="Scripts/jquery-1.2.6.js" />
var loginURL = '<%# ResolveUrl("~/Login.aspx") + "?ReturnUrl=" + Server.UrlEncode(this.Page.Request.Url.AbsolutePath) %>';
$(document).ready(function() {
    /* Rounded Corners */
    $(".Box3").corner("keep bottom");
    $(".Heading5").corner("tr 20px");
    $("#MenuWrapper").corner();

    /* Login Button Default Action */
    $('#divLogin').defaultButton('.Login');

    /* Add hover and current location styles to the main menu items */
    $(".MainMenu").mouseover(function() {
        if ($(this).attr('class') != 'MainMenuSelected') {
            $(this).attr('class', "MainMenuOver");
        }
    });
    $(".MainMenu").mouseout(function() {
        if ($(this).attr('class') != 'MainMenuSelected') {
            $(this).attr('class', "MainMenu");
        }
    });
    $.each($(".MainMenu"), function(t) {
        if (location.pathname == $(this).attr('href')) {
            $(this).attr('class', "MainMenuSelected");
        }
    });
    $('.MainMenu:last').attr('style', 'border: none;');

    /* Universal Alert Container */
    $('#divAlert').jqm({ onShow: showAlert });
});

function showAlert() {
    $('#divAlert').fadeIn('fast');
    $('#btnAlertClose').focus();
    $(document).keypress(function(e) {
    alert(e);
        var key = e.charCode || e.keyCode || 0;
        if (key == 13 || key == 27)
            $('#divAlert').jqmHide();
    });
}

function jqmAlert(msg, fromServer) {
    if (fromServer)
        $('#divAlert').jqm();
    $('#spanAlertMessage').text(msg);
    $('#divAlert').jqmShow();
}