﻿var maxHeight;
$(document).ready(start);
window.onresize=function() { AdjustAreaMenuHeight(); }

function start() {


    buildLayout();
    mainMenu();
    

    rowRollover();

  
    $('#divWrapper').removeClass("hide");
}

function mainMenu() {
    if ($('#divMainMenu').css("display") != "none") {
        var arrowimages = { down: ['downarrowclass', 'app_themes/default/images/arrow-down.gif', 0], right: ['rightarrowclass', 'app_themes/default/images/arrow-right.gif'] }
        jquerycssmenu.buildmenu("myjquerymenu", arrowimages)

        $('#ctl00_myMenu_30020 ul').removeClass("hide");


        $('#divMainMenu').scrollFollow({ speed: 500 });
        maxHeight= $('#ctl00_myMenu_30020 ul').height();
        AdjustAreaMenuHeight();

    }
    
}

function AdjustAreaMenuHeight() {
    var menuTop;
    if ($('#ctl00_myMenu_30020').position() != undefined){
    menuTop = $('#ctl00_myMenu_30020').position().top + $('#divMainMenu').position().top;
    var idealHeight = $(window).height() - menuTop
    if (idealHeight < maxHeight) {
        $('#ctl00_myMenu_30020 ul').css("height", parseInt(idealHeight - 10));
    } 
    else {
        $('#ctl00_myMenu_30020 ul').css("height", maxHeight);
    }
    }
    
    

}

function buildLayout() {
    $('#divLayout').removeClass("no-javascript");
   
}



function rowRollover() {
    var rows = $('.tbl-data tr');
    for (var i = 0; i < rows.length; i++) {
        rows[i].onmouseover = function() {
            $(this).addClass('highlight');
                if ($(this).parent().parent().attr("class").match("tbl-width300")) { togglePolygon($(this).children(0).html(), 'show'); }
        }

    

        rows[i].onmouseout = function() {
        $(this).removeClass('highlight');
            if ($(this).parent().parent().attr("class").match("tbl-width300")) { togglePolygon($(this).children(0).html(), 'hide'); } 
    }
    }
}

