$(document).ready(function() {  
  
    $("#disableDiv").hide();
    $("#loadingDiv").hide();

    // -------------------------------------------------------------     
    
    // change the image of hoverable images
    $(".imgHoverable").hover( 
        function() {
            var hoverImg = HoverImgOf($(this).attr("src"));
            $(this).attr("src", hoverImg);
        }, 
        function() {
            var normalImg = NormalImgOf($(this).attr("src"));
            $(this).attr("src", normalImg);
        }
    )
    
    // -------------------------------------------------------------
    
    function HoverImgOf(filename){
       var re = new RegExp("(.+)\\.(gif|png|jpg)", "g");
       return filename.replace(re, "$1_hover.$2");
    }

    // -------------------------------------------------------------

    function NormalImgOf(filename){
       var re = new RegExp("(.+)_hover\\.(gif|png|jpg)", "g");
       return filename.replace(re, "$1.$2");
    }

    // -------------------------------------------------------------
    
        $("#TopRibbon_signout_button").click(function () {
              window.location.replace("http://mvc.greenbuyerflyer.com/logout");
              /*  $('#dialog_content').html('<p style="text-align:center; margin-top:10px; font-size:14px;">Process to clear the session and log the user out should be performed here.</p>');
                $('#dialog').dialog({
                  title:"Debugging", autoOpen: true, resizable: false, modal: true, position: "center", buttons: { Ok: function() { $('#dialog').dialog("close"); } }
                })
              return false;*/  
        });

    // -------------------------------------------------------------
    
        $("#TopRibbon_admin_button").click(function () {
              window.location.replace("http://mvc.greenbuyerflyer.com/admin_index");
              /*  $('#dialog_content').html('<p style="text-align:center; margin-top:10px; font-size:14px;">Process to clear the session and log the user out should be performed here.</p>');
                $('#dialog').dialog({
                  title:"Debugging", autoOpen: true, resizable: false, modal: true, position: "center", buttons: { Ok: function() { $('#dialog').dialog("close"); } }
                })
              return false;*/  
        });

    // -------------------------------------------------------------
    
    
    
    
    
})
