﻿xAddLoadEvent(OnResizePage);
window.onresize = OnResizePage;

/*
jQuery(document).ready(function() {
    $().mousemove(function(e) {
        window.status = e.pageX + 'x' + e.pageY;
    });
})
*/

var blnHeightResizeEnabled = false;
function OnResizePage() {
    var intWidth = $(window).width();
    var intHeight = $(window).height();
    var intScrollTop = $(window).scrollTop();
    xHeight(el('LeftTruss'), intHeight - xPageY(el('LeftTruss')));

    if (!IE()) {
        var intNewHeight = intHeight - xPageY(el('divPageContentSizeHandle')) - 20;
        if (blnHeightResizeEnabled || xHeight(el('divPageContentSizeHandle')) < intNewHeight) {
            blnHeightResizeEnabled = true;
            xHeight(el('divPageContentSizeHandle'), intNewHeight);
        }
    }
    
    if ($('.PageContentBackground').css('background-image') != 'none') {
        if (intWidth > 1060)
            $('.PageContentBackground').css('background-image', "url('Images/Products/JBLVertecArrayCropped_Wide.jpg')");
        else
            $('.PageContentBackground').css('background-image', "url('Images/Products/JBLVertecArrayCropped.jpg')");
    }
}

function PositionDepartments() {
    xTop(el('hotspot_ConcertSound'), xPageY(el('dept_ConcertSound')));
    xLeft(el('hotspot_ConcertSound'), xPageX(el('dept_ConcertSound')));
    xTop(el('link_ConcertSound'), xPageY(el('dept_ConcertSound')) + xHeight(el('dept_ConcertSound')) - 45);
    xLeft(el('link_ConcertSound'), xPageX(el('dept_ConcertSound')));
    
    xTop(el('hotspot_StageLighting'), xPageY(el('dept_StageLighting')));
    xLeft(el('hotspot_StageLighting'), xPageX(el('dept_StageLighting')));
    xTop(el('link_StageLighting'), xPageY(el('dept_StageLighting')) + xHeight(el('dept_StageLighting')) - 45);
    xLeft(el('link_StageLighting'), xPageX(el('dept_StageLighting')));
    
    xTop(el('hotspot_Backline'), xPageY(el('dept_Backline')));
    xLeft(el('hotspot_Backline'), xPageX(el('dept_Backline')));
    xTop(el('link_Backline'), xPageY(el('dept_Backline')) + xHeight(el('dept_Backline')) - 45);
    xLeft(el('link_Backline'), xPageX(el('dept_Backline')));

    xTop(el('hotspot_AV'), xPageY(el('dept_AV')));
    xLeft(el('hotspot_AV'), xPageX(el('dept_AV')));
    xTop(el('link_AV'), xPageY(el('dept_AV')) + xHeight(el('dept_AV')) - 45);
    xLeft(el('link_AV'), xPageX(el('dept_AV')));
}


function PositionTiles(aryTiles) {
    for (var i in aryTiles) {
        var strTileName = aryTiles[i];
        xTop(el('hotspot_' + strTileName), xPageY(el('dept_' + strTileName)));
        xLeft(el('hotspot_' + strTileName), xPageX(el('dept_' + strTileName)));
        xTop(el('link_' + strTileName), xPageY(el('dept_' + strTileName)) + xHeight(el('dept_' + strTileName)) - 45);
        xLeft(el('link_' + strTileName), xPageX(el('dept_' + strTileName)));
    }
}
