﻿$(document).ready(function () {
    // CONTENT SIZES
    var winH = $(window).height();
    var winW = $(window).width();
    var GlblcontSize = winH - 170;
    var selectsrollH = GlblcontSize - 80;
    var contSize = winW - 50;

    var screen = contSize / 221;
    var roundOff = Math.floor(screen);
    var resW = (roundOff * 221) + 26;

    $(".Glblcontent").css("height", GlblcontSize + "px");
    $(".content").css("height", GlblcontSize + "px");
    $(".resultsContent").css("height", GlblcontSize + "px");
    $(".selectionContent").css("height", GlblcontSize + "px");
    $("div.selectionContent div.scroll-pane-split").css("height", selectsrollH + "px");



    $(".content").css("width", contSize + "px");
    if (winW > 961) {
        $(".resultsContent").css("width", resW + "px");
        $(".selectionContent").css("width", resW + "px");
        $(".selectOption").css("width", resW + "px");
        $(".content").css("width", contSize + "px");
        $("div.content div.scroll-pane-split").css("width", resW + "px");

    }
    else {
        $(".resultsContent").css("width", "910px");
        $(".selectionContent").css("width", "910px");
        $(".selectOption").css("width", "910px");
        $(".content").css("width", "910px");
        $("div.content div.scroll-pane-split").css("width", "910px");

    }

// Details img Size
    if (winH >= 789) {
        $("#dtlHold").attr("class", "imgLarge");
    } else if (winH >= 678 && winH < 789) {
        $("#dtlHold").attr("class", "imgMedium");
    } else {
        $("#dtlHold").attr("class", "imgSmall");
    };

// Results mdl hover
    $(".mdlHold").hoverIntent(
    function () {
        $(this).children("div.mdlNme").fadeIn("fast");
        $(this).children("div.mdlbg").fadeIn("fast");

    },
    function () {
        $(this).children("div.mdlNme").fadeOut("fast");
        $(this).children("div.mdlbg").fadeOut("fast");
    }
    );

    

    //navigation dropdown

    function mainmenu() {
        $(" .nav ul li ul").css({ display: "none" }); // Opera Fix
        $(" .nav ul li").hover(function () {
            $(this).find('ul:first').css({ visibility: "visible", display: "none" }).show(0);
        }, function () {
            $(this).find('ul:first').css({ visibility: "hidden" });
        });
    }

    $(document).ready(function () {
        mainmenu();
    });

});                   // .ready end

$(window).load(function () {
    //Results & Selection img scale
    $('div.mdlImg img').each(function (index) {

        var width, height
        width = $(this).width();
        height = 450; //large image

        if (width <= 325) {//narrow portrait
            //alert("1");
            $(this).css('width', 218 + 'px');
        } else if (width > height) {//landscape
            //alert("2");
            $(this).css('height', 295 + 'px');
        } else if (width <= height || width > 350) { //square
            //alert("3");
            $(this).css('height', 295 + 'px');
        } else {
            //alert("4");
            $(this).css('width', 218 + 'px');
        }
    });
});

$(window).resize(function () {
    // CONTENT SIZES
    var winH = $(window).height();
    var winW = $(window).width();
    var GlblcontSize = winH - 170;
    var selectsrollH = GlblcontSize - 80;
    var contSize = winW - 50;

    var screen = contSize / 221;
    var roundOff = Math.floor(screen);
    var resW = (roundOff * 221) + 26;

    $(".Glblcontent").css("height", GlblcontSize + "px");
    $(".content").css("height", GlblcontSize + "px");
    $(".resultsContent").css("height", GlblcontSize + "px");
    $(".selectionContent").css("height", GlblcontSize + "px");
    $("div.selectionContent div.scroll-pane-split").css("height", selectsrollH + "px");



    $(".content").css("width", contSize + "px");
    if (winW > 961) {
        $(".resultsContent").css("width", resW + "px");
        $(".selectionContent").css("width", resW + "px");
        $(".selectOption").css("width", resW + "px");
        $(".content").css("width", contSize + "px");
        $("div.content div.scroll-pane-split").css("width", resW + "px");

    }
    else {
        $(".resultsContent").css("width", "910px");
        $(".selectionContent").css("width", "910px");
        $(".selectOption").css("width", "910px");
        $(".content").css("width", "910px");
        $("div.content div.scroll-pane-split").css("width", "910px");

    }



    // Details img Size
    if (winH >= 789) {
        $("#dtlHold").attr("class", "imgLarge");
    } else if (winH >= 678 && winH < 789) {
        $("#dtlHold").attr("class", "imgMedium");
    } else {
        $("#dtlHold").attr("class", "imgSmall");
    };


}); // .resize end
