﻿//Don't do anything until the page is ready
$(document).ready(
    function () {

        //call function that sets the pop up black out to max 
        popUpBlackOut();
        //Call the function that will listen for the rollover
        topBttnRoll();
        //Call to resize the images on the blog to a manageable size 
        resizeBlogImg();
    }
);

//Function called when a button is hoverd
    this.topBttnRoll = function () {
       $("div.TopPnlBttnOff").hover(
            function () {
               $(this).removeClass("TopPnlBttnOff");
                $(this).addClass("TopPnlBttnOn");
            },
            function () {
                $(this).removeClass("TopPnlBttnOn");
                $(this).addClass("TopPnlBttnOff");
        });
    };


        //Function to expand the pop up background to 100% of the document height
        this.popUpBlackOut = function () {
            $("div.PopContain").height($(document).height());
            $("div.PopContain").width($(document).width());
        };


        this.resizeBlogImg = function () {
            var max_size = 300;
            $("img.ResizeImg").each(function (i) {
                if ($(this).width() > max_size) {
                    if ($(this).height() > $(this).width()) {
                        var h = max_size;
                        var w = Math.ceil($(this).width() / $(this).height() * max_size);
                    } else {
                        var w = max_size;
                        var h = Math.ceil($(this).height() / $(this).width() * max_size);
                    }
                    $(this).css({ height: h, width: w });
                };
            });
        };
