$(document).ready(function() {

    SetMinDocHeight();

    SetDisclaimer();

    $('.ErrorText').css('color', 'Black');
    $('.ErrorText font').css('color', 'Black');
    $("#column2 input[type='text']").css('background-color', 'white');
});

function searchText(e, searchBoxClientID) {
    var keynum = 0;
    if (window.event) //IE
    {
        keynum = window.event.keyCode;
    } else if (e.which) //Netscape/FF/Opera
    {
        keynum = e.which;
    }
    if (keynum == 13) {
        doSearch(searchBoxClientID);
        return false;
    }
}

function doSearch(searchBoxClientID) {
    var searchUrl = "http://www.kpmg.com/Global/Pages/Results.aspx";
    var query = document.getElementById(searchBoxClientID).value;
    document.location.href = searchUrl + "?k=" + query;
}

/// set the space under the left nav menu to be white
function SetLeftNavSpace() {
    var column1 = $('div#column1').height();
    var column2 = $('div#column2').height();
    var column3 = $('div#column3').height();
    var max = 0;
    var newHeight = 24;

    if (column1 > max)
    { max = column1; }

    if (column2 > max)
    { max = column2; }

    if (column3 > max)
    { max = column3; }

    newHeight = max - $('table.menu-width').height() + $('td.leftNavFooterCell').height();

    $('td.leftNavFooterCell').height(newHeight);
}

function SetMinDocHeight() {
    var pageHeight, windowHeight, col2Height;
    pageHeight = parseInt($('#mainwrapper').height());
    windowHeight = parseInt($(window).height());
    col2Height = parseInt($('#column2').height());

    if (pageHeight < windowHeight) {
        $('#column2').height(col2Height + windowHeight - pageHeight);

        SetLeftNavSpace();
    }
}

function SetDisclaimer() {
    if (!jQuery.support.boxModel) {
        $('#txtDisclaimer').css('margin-left', '2');
    } else {
        $('#txtDisclaimer').css('margin-left', '-2');
    }
}
