var siteWidth, screenWidth, screenHeight, hMargin;

textRegEx = /\s+/; 

siteWidth = 1014;
hMargin = 0;

function getDimensions()
{    
    if (screen.availWidth) {
        screenWidth = screen.availWidth; 
    } else if (screen.width) {
        screenWidth = screen.width;
    } else {
        screenWidth = 1024;
    }

    if (screen.availHeight) {
        screenHeight = screen.availHeight;
    } else if (screen.height) {
        screenWidth = screen.height;
    } else {
        screenHeight = 768;
    }

    if (screenWidth > siteWidth) {
        hMargin = parseInt((screenWidth  - siteWidth)  / 2);
    } else {
        hMargin = 5;
    }
    
    return;
}

function adjustDimensions()
{
    getDimensions();
    
    document.body.style.marginLeft  = hMargin + 'px';
    document.body.style.marginRight = hMargin + 'px';
    
    return;
}

function showPic(thumbObj, picName)
{
    rxPic = /\.jpg$/;

    if (!picName.match(rxPic)) {
        return false;
    }

    document.getElementById('picDiv').innerHTML = '<input id="closeBtn" style="float: right;" type="button" onclick="javascript: hidePic();" value=" X " /><br /><br />';
    document.getElementById('picDiv').innerHTML += '<img style="cursor: pointer;" onclick="hidePic();" class="picture" src="/images/pictures/phpconfbr08/' + picName + '" />';
    document.getElementById('picDiv').style.visibility = 'visible';
    document.getElementById('picDiv').style.display = 'inline';
    document.getElementById('closeBtn').focus();
}


function showBeach()
{
    document.getElementById('beachDiv').style.visibility = 'visible';
    document.getElementById('beachDiv').style.display = 'inline';
    document.getElementById('closeBtn').focus();
}

function hidePic()
{
    document.getElementById('picDiv').style.visibility = 'hidden';
    document.getElementById('picDiv').style.display = 'none';
    document.getElementById('picDiv').innerHTML = '';
}

function hideBeach()
{
    document.getElementById('beachDiv').style.visibility = 'hidden';
    document.getElementById('beachDiv').style.display = 'none';
}

function openGrid()
{
    window.open('/grid/index/day/1', 'grid', 'width=' + screenWidth + ', height=' + screenHeight + ', menubar=no, status=no, scrollbars=yes, resizable=yes');
}

function openList()
{
    window.open('/presentations/approved/act/print', 'grid', 'width=' + screenWidth + ', height=' + screenHeight + ', menubar=no, status=no, scrollbars=yes, resizable=yes');
}
