function pageLoad(sender,args)
{
    //window.scrollTo(0, 0); //Always scroll to top of page
    
    var d = new Date();
    $get("copyright").innerHTML = "<a href='http://www.c-span.org/About/C-SPAN-Copyright-Policy/' target='_blank'>&copy; " + d.getFullYear() + ", National Cable Satellite Corporation</a>";

    // Distinguish MasterPage - check If it's Sub2ColMaster or MainFrame.
    var tbSearchtextbox;
    if (document.getElementById('ctl00_ctl00_tbSearch') != null) {
        tbSearchtextbox = '#ctl00_ctl00_tbSearch';} // case of Sub2ColMaster [Nested]
    else { tbSearchtextbox = '#ctl00_tbSearch'; } // case of MainFrame

    addWaterMark(tbSearchtextbox, "Search Booknotes.org");
    
    setBackground();
    
    // this initialises the custom scollbars
    $("#ProgramDesc").jScrollPane({ showArrows: true });
    $("#transContent").jScrollPane({ showArrows: true, verticalDragMinHeight: 15 });
    //fullpage doesn't need customized scrollbar
    //$("#fullpageliteral").jScrollPane({ showArrows: true, verticalDragMinHeight: 15 });
}

function setBackground() {
    var filename = window.location.href.substr(window.location.href.lastIndexOf("/") + 1);
    var matchPos = window.location.href.search('/Watch/');    
    // check the mainpage.
    var exist_div = $('div#CatTitle').length;
    
    if (exist_div > 0 || filename == 'AboutUs.aspx' || matchPos > 1) {
        $('div#BNContent').css('height', '1208px');         
    }
    else {
        $('div#BNContent').css('height', '1258px');
    }
}
function addWaterMark(textbox, watermarktext) {
    window.location.href
    $(textbox).addClass("watermark").val(watermarktext);
    $(textbox).focus(function() {
        $(this).filter(function() {
            return $(this).val() == "" || $(this).val() == watermarktext
        }).removeClass("watermark").val("");
    });
    $(textbox).blur(function() {
        $(this).filter(function() {
            return $(this).val() == ""
        }).addClass("watermark").val(watermarktext);
    });
}



