var $j = jQuery.noConflict();

$j(document).ready(function($) {

    //Banner
    $j('.TopBanner').cycle({ fx: 'fade', speed: 1500, delay: -5000, timeout: 2000, autostop: 1 });

    //Menu Banner
    $j('.menubanner').cycle({ fx: 'fade', speed: 3500 });

    //Footer Round Corner.
    $j('.footer').corner("8px;");

    /* NAV 1 */
    jQuery.preLoadImages("/img/menu.gif", "/img/menu-aboutus.gif", "/img/menu-become.gif", "/img/menu-students.gif", "/img/menu-members.gif");

    $('#navBar li#navAboutus').mouseenter(function() {
        $(this).parent().css('background-image', 'url(/img/menu-aboutus.gif)');
    });
    $('#navBar li#navAboutus').mouseleave(function() {
        $(this).parent().css('background-image', 'url(/img/menu.gif)');
    });

    $('#navBar li#navBACGA').mouseenter(function() {
        $(this).parent().css('background-image', 'url(/img/menu-become.gif)');
    });
    $('#navBar li#navBACGA').mouseleave(function() {
        $(this).parent().css('background-image', 'url(/img/menu.gif)');
    });

    $('#navBar li#navStudents').mouseenter(function() {
        $(this).parent().css('background-image', 'url(/img/menu-students.gif)');
    });
    $('#navBar li#navStudents').mouseleave(function() {
        $(this).parent().css('background-image', 'url(/img/menu.gif)');
    });

    $('#navBar li#navMembers').mouseenter(function() {
        $(this).parent().css('background-image', 'url(/img/menu-members.gif)');
    });
    $('#navBar li#navMembers').mouseleave(function() {
        $(this).parent().css('background-image', 'url(/img/menu.gif)');
    });

    /* do not select hyperlink cuz hover cannot apply */
    $j('.menubanner-link img').click(function() { window.location.href = $j(this).attr('lnk'); });

});

//usage javascript:showDialog('4908','Testing', width, height);
function showDialog(ID, Title, Width, Height) {
    if (jQuery(".CGADialog").length > 0) {
        jQuery(".CGADialog").dialog("open");
        if ($.browser.msie && $.browser.version < 8) { jQuery('.ui-dialog-titlebar-close').css('margin-top', '1px'); }
    } else {
        jQuery('body').append('<div class="CGADialog"></div>');
        Width = (Width != null && Width != '') ? Width : 640;
        Height = (Height != null && Height != '') ? Height : 480;
        jQuery(".CGADialog").dialog({ autoOpen: true, height: Height, width: Width, modal: true, draggable: false, resizable: false, position: 'center', title: Title });
    }

    jQuery.ajax({
        url: '/cgadialogbox.aspx?id=' + ID,
        async: false,
        success: function (data) {
            jQuery(".CGADialog").html(data);
        }
    });
}
