﻿/*
 * Edge Management
 * Copyright Steve Watson.
 *
 *
 *
 *
*/

var browserWidth = 0;           // Calculated via edgeStartup function
var contentWidth = 1000;        // This is the width of the main content
var edgeWidth = 0;              // This is the size of each left & right edges in pixels

function edgeStartup() {
    browserWidth = document.documentElement.clientWidth;
    edgeWidth = (browserWidth - contentWidth) / 2;

    var ew = $('#_ledge').css('width');     // Get required edge width
    ew = parseInt(ew, 10);

    //alert("ew+4="+ew+4+" - edgeWidth="+edgeWidth);

    if (ew+4 <= edgeWidth) {

        // Change the position of the contact information panel
        $('#_contactpanel').css({ 'left': '967px' });

        var x = (edgeWidth-ew)-4;

        $('#_ledge').css({ 'display': 'inline',
            'left': x,
            'background-color': '#62b1da'
        });

        x = (edgeWidth+contentWidth+6);
        $('#_redge').css({ 'display': 'inline',
            'left': x,
            'background-color': '#62b1da'
        });

    } // edgeWidth comparision to see if we have room on screen
    else {
        // Change the position of the contact information panel
        $('#_contactpanel').css({ 'left': '830px' });
        // Hide the left & right edges
        $('#_ledge').css({ 'display': 'none' });    
        $('#_redge').css({ 'display': 'none' });
    }
}


