// (c) Unusual Publishing Ltd 2005-2009 for IT Reviews


function showHeader() {
    
    var headerbust, headerOutput;
    
    // for cache-busting
    headerbust = Math.floor(10000 * Math.random());

    // next one required by VM ads
    headerOutput = '<img src="http://itreviews.uk.intellitxt.com/SetURLCookie.asp?ipid=2" width="1" height="1" border="0" alt="" style="display:none" />\n';
    
    // next one for stats
    headerOutput += '<img src="/cgi-bin/houseads.pl?count=' + headerbust + '" width="1" height="1" border="0" alt="" style="display:none" />\n';

    document.write(headerOutput);
}


function serveTopright() {
    // note: this is hard-coded in the home page

    var toprightOutput;

    toprightOutput = '<div align="center">\n';
    toprightOutput += '<a target="_blank" href="http://www.phoneslimited.co.uk/Nokia/N900.html">Nokia N900</a>\n';
    toprightOutput += '<br />- &nbsp;- &nbsp;- &nbsp;- &nbsp;- &nbsp;- &nbsp;- &nbsp;- &nbsp;- &nbsp;-<br />\n';
    toprightOutput += '<a target="_blank" href="http://www.pctools.com/spyware-doctor/?ref=itreviews&amp;utm_source=itreviews&amp;utm_medium=cpc&amp;utm_campaign=sd">Spyware Doctor</a>\n';
    toprightOutput += '<br />- &nbsp;- &nbsp;- &nbsp;- &nbsp;- &nbsp;- &nbsp;- &nbsp;- &nbsp;- &nbsp;-<br />\n';

    // some pages may have different text links here; see CMS for details
    if ((document.URL !== "http://www.itreviews.co.uk/hardware/hardware.htm") && (document.URL !== "http://www.itreviews.co.uk/hardware/hard1.htm") && (document.URL !== "http://www.itreviews.co.uk/hardware/hard17.htm") && (document.URL !== "http://www.itreviews.co.uk/index.htm")) {
        toprightOutput += '<a href="/misc/adverts.htm">Your link here?</a>\n';
    }

    toprightOutput += '</div>\n';

    document.write(toprightOutput);
}


function serveLeaderboard() {
    
    var leaderboardbust, leaderboardchoice, leaderboardOutput;
    
    // for cache-busting
    leaderboardbust = Math.floor(10000 * Math.random());

    // for random ad rotation: leaderboardchoice will be a value between 0 and 10, so can adjust weighting of each tag. use less than 0 to disable
    leaderboardchoice = leaderboardbust / 1000;

    if (leaderboardchoice < 3) {
        // VM leaderboards, redirecting on fail to ITR house code (less than 4)
        // these need the cookie that's loaded in each page (currently in showHeader): DON'T load it here, as it messes up formatting with IE7
        leaderboardOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScript" src="http://itreviews.uk.intellitxt.com/smartad.asp?ipid=2&amp;scid=0&amp;size=468x60&amp;type=rm&amp;time=' + leaderboardbust + '">\n';
        leaderboardOutput += '<\/scr' + 'ipt>\n';
    }

    else if (leaderboardchoice > 11) {
        // IDGtechnet leaderboards, redirecting on fail to ITR house code
        leaderboardOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScript" src="http://a.collective-media.net/adj/idgt.itreviews/;sz=728x90;ord=' + leaderboardbust + '">\n';
        leaderboardOutput += '<\/scr' + 'ipt>\n';
    }

    else if (leaderboardchoice > 11) {
        // VCmedia leaderboards/banners, redirecting on fail to ITR house code (enable only when required)        
        leaderboardOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScript" src="http://media.fastclick.net/w/get.media?sid=34654&amp;m=1&amp;tp=5&amp;d=j&amp;t=n&amp;c=' + leaderboardbust + '">\n';
        leaderboardOutput += '<\/scr' + 'ipt>\n';
    }

    else if (leaderboardchoice > 11) {
        // AdJug leaderboards, redirecting on fail to ITR house code (enable only when required - test first, as code is new)
        leaderboardOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" src="http://hosting.adjug.com/AdJugSearch/PageBuilder.aspx?ivi=V3.0+JS&amp;aid=447&amp;slid=42915&amp;height=90&amp;width=728&amp;HTMLOP=False&amp;ShowIFrame=True&amp;CacheBuster=' + leaderboardbust + '">\n<\/scr' + 'ipt>\n';
    }

    else if (leaderboardchoice > 9) {
        // Techsmith leaderboards served locally
        var techsmithTag, whichTag;
        techsmithTag = [];
        techsmithTag[0] = '<a target=\"_blank\" href=\"http://www.techsmith.com/snagit.asp?utm_source=ITReviews_SI91UK&utm_medium=728x90_PowerPoint&utm_campaign=SI91UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/PowerPoint728x90_15K.gif\" width=\"728\" height=\"90\" border=\"0\" alt=\"TechSmith\" /></a>';
        techsmithTag[1] = '<a target=\"_blank\" href=\"http://www.techsmith.com/snagit.asp?utm_source=ITReviews_SI91UK&utm_medium=728x90_Chicken&utm_campaign=SI91UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/Chicken728x90.gif\" width=\"728\" height=\"90\" border=\"0\" alt=\"TechSmith\" /></a>';
        techsmithTag[2] = '<a target=\"_blank\" href=\"http://www.techsmith.com/camtasia.asp?utm_source=ITReviews_CS6UK&utm_medium=728x90_BoredRoom&utm_campaign=CS6UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/728x90-boredroom-anim40k.gif\" width=\"728\" height=\"90\" border=\"0\" alt=\"TechSmith\" /></a>';
        techsmithTag[3] = '<a target=\"_blank\" href=\"http://www.techsmith.com/camtasia.asp?utm_source=ITReviews_CS6UK&utm_medium=728x90_Sheep&utm_campaign=CS6UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/sheep_728X90_anim.gif\" width=\"728\" height=\"90\" border=\"0\" alt=\"TechSmith\" /></a>';
        techsmithTag[4] = '<a target=\"_blank\" href=\"http://www.techsmith.com/camtasia/screencasting/?utm_source=ITReviews_CS6UK&utm_medium=728x90_Phonetic&utm_campaign=CS6UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/CS_Progressive_728_90.gif\" width=\"728\" height=\"90\" border=\"0\" alt=\"TechSmith\" /></a>';
        whichTag = Math.round(Math.random() * (techsmithTag.length - 1));
        leaderboardOutput = (techsmithTag[whichTag]);
    }

    else {
        // Google leaderboards
        leaderboardOutput = '<scr' + 'ipt language="javascr' + 'ipt" type="text/javascr' + 'ipt">\n<!--\ngoogle_ad_client = "pub-6475420980328138";\n';
        leaderboardOutput += 'google_ad_slot = "3427483340";\n';
        leaderboardOutput += 'google_ad_width = 728;\ngoogle_ad_height = 90;\n';
        leaderboardOutput += '//-->\n<\/scr' + 'ipt>\n';
        leaderboardOutput += '<scr' + 'ipt type="text/javascr' + 'ipt" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\n<\/scr' + 'ipt>\n';
    }

    document.write(leaderboardOutput);
}


function serveSkyscraper() {

    var skyscraperbust, skyscraperchoice, skyscraperOutput;

    // for cache-busting
    skyscraperbust = Math.floor(10000 * Math.random());

    // for random ad rotation - skyscraperchoice will be a value between 0 and 10, so can adjust weighting of each tag. use less than 0 to disable
    skyscraperchoice = skyscraperbust / 1000;

    if (skyscraperchoice < 3) {
        // VM skyscrapers, redirecting on fail to ITR house code (less than 3)
        // these need the cookie that's loaded in each page (currently in showHeader): DON'T load it here, as it messes up formatting with IE7
        skyscraperOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScript" src="http://itreviews.uk.intellitxt.com/smartad.asp?ipid=2&amp;scid=0&amp;size=120x600&amp;type=rm&amp;time=' + skyscraperbust + '">\n';
        skyscraperOutput += '<\/scr' + 'ipt>\n';
    }

    else if (skyscraperchoice > 11) {
        // IDGtechnet skyscrapers, redirecting on fail to ITR house code
        skyscraperOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScript" src="http://a.collective-media.net/adj/idgt.itreviews/;sz=160x600;ord=' + skyscraperbust + '">\n';
        skyscraperOutput += '<\/scr' + 'ipt>\n';
    }

    else if (skyscraperchoice > 9) {
        // Techsmith skyscrapers served locally
        var techsmithTag, whichTag;
        techsmithTag = [];
        techsmithTag[0] = '<a target=\"_blank\" href=\"http://www.techsmith.com/snagit.asp?utm_source=ITReviews_SI91UK&utm_medium=160x600_PowerPoint&utm_campaign=SI91UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/PowerPoint160x600.gif\" width=\"160\" height=\"600\" border=\"0\" alt=\"TechSmith\" /></a>';
        techsmithTag[1] = '<a target=\"_blank\" href=\"http://www.techsmith.com/snagit.asp?utm_source=ITReviews_SI91UK&utm_medium=160x600_Millions&utm_campaign=SI91UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/Google Millions_160_600.gif\" width=\"160\" height=\"600\" border=\"0\" alt=\"TechSmith\" /></a>';
        techsmithTag[2] = '<a target=\"_blank\" href=\"http://www.techsmith.com/camtasia.asp?utm_source=ITReviews_CS6UK&utm_medium=160x600_BoredRoom&utm_campaign=CS6UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/160x600-boredroom-50k.gif\" width=\"160\" height=\"600\" border=\"0\" alt=\"TechSmith\" /></a>';
        techsmithTag[3] = '<a target=\"_blank\" href=\"http://www.techsmith.com/camtasia.asp?utm_source=ITReviews_CS6UK&utm_medium=160x600_Sheep&utm_campaign=CS6UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/sheep-160x600-anim.gif\" width=\"160\" height=\"600\" border=\"0\" alt=\"TechSmith\" /></a>';
        techsmithTag[4] = '<a target=\"_blank\" href=\"http://www.techsmith.com/camtasia/screencasting/?utm_source=ITReviews_CS6UK&utm_medium=160x600_Phonetic&utm_campaign=CS6UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/CS_Progressive_160x600.gif\" width=\"160\" height=\"600\" border=\"0\" alt=\"TechSmith\" /></a>';
        whichTag = Math.round(Math.random() * (techsmithTag.length - 1));
        skyscraperOutput = (techsmithTag[whichTag]);
    }

    else if (skyscraperchoice > 11) {
        // VCmedia skyscrapers, redirecting on fail to ITR house code (enable only when required)        
        skyscraperOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScript" src="http://media.fastclick.net/w/get.media?sid=34654&amp;m=3&amp;tp=7&amp;d=j&amp;t=n&amp;c=' + skyscraperbust + '">\n';
        skyscraperOutput += '<\/scr' + 'ipt>\n';
    }

    else if (skyscraperchoice > 11) {
        // AdJug skyscrapers, redirecting on fail to ITR house code (enable only when required - test first, as code is new)
        skyscraperOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" src="http://hosting.adjug.com/AdJugSearch/PageBuilder.aspx?ivi=V3.0+JS&amp;aid=447&amp;slid=48678&amp;height=600&amp;width=160&amp;HTMLOP=False&amp;ShowIFrame=True&amp;CacheBuster=' + skyscraperbust + '">\n<\/scr' + 'ipt>\n';
    }
    
    else {
        // Google skyscrapers
        skyscraperOutput = '<scr' + 'ipt language="javascr' + 'ipt" type="text/javascr' + 'ipt">\n<!--\ngoogle_ad_client = "pub-6475420980328138";\n';
        skyscraperOutput += 'google_ad_width = 160;\ngoogle_ad_height = 600;\n';
        skyscraperOutput += 'google_ad_slot = "3315901508";\n';
        skyscraperOutput += '//-->\n<\/scr' + 'ipt>\n';
        skyscraperOutput += '<scr' + 'ipt type="text/javascr' + 'ipt" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\n<\/scr' + 'ipt>\n';
    }

    document.write(skyscraperOutput);
}


function serveMPU() {

    var mpubust, mpuchoice, mpuOutput;
    
    // for cache-busting
    mpubust = Math.floor(10000 * Math.random());

    // for random ad rotation - mpuchoice will be a value between 0 and 10, so can adjust weighting of each tag. use less than 0 to disable
    mpuchoice = mpubust / 1000;

    if (mpuchoice < 4) {
        // VM MPUs, redirecting on fail to ITR house code - higher here because more MPUs are served (less than 5)
        // these need the cookie that's loaded in each page (currently in showHeader): DON'T load it here, as it messes up formatting with IE7
        mpuOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScr' + 'ipt" src="http://itreviews.uk.intellitxt.com/smartad.asp?ipid=2&amp;scid=0&amp;size=336x280&amp;type=rm&amp;time=' + mpubust + '">\n';
        mpuOutput += '<\/scr' + 'ipt>\n';
    }

    else if (mpuchoice > 11) {
        // IDGtechnet MPUs, redirecting on fail to ITR house code
        mpuOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScript" src="http://a.collective-media.net/adj/idgt.itreviews/;sz=300x250;ord=' + mpubust + '">\n';
        mpuOutput += '<\/scr' + 'ipt>\n';
    }

    else if (mpuchoice > 11) {
        // VCmedia MPUs, redirecting on fail to ITR house code (enable only when required)        
        mpuOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScript" src="http://media.fastclick.net/w/get.media?sid=34654&amp;m=6&amp;tp=8&amp;d=j&amp;t=n&amp;c=' + mpubust + '">\n';
        mpuOutput += '<\/scr' + 'ipt>\n';
    }

    else if (mpuchoice > 11) {
        // AdJug MPUs, redirecting on fail to ITR house code (enable only when required - test first, as code is new)
        mpuOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" src="http://hosting.adjug.com/AdJugSearch/PageBuilder.aspx?ivi=V3.0+JS&amp;aid=447&amp;slid=48677&amp;height=250&amp;width=300&amp;HTMLOP=False&amp;ShowIFrame=True&amp;CacheBuster=' + mpubust + '">\n<\/scr' + 'ipt>\n';
    }

    else if (mpuchoice > 9) {
        // Techsmith MPUs served locally
        var techsmithTag, whichTag;
        techsmithTag = [];
        techsmithTag[0] = '<a target=\"_blank\" href=\"http://www.techsmith.com/snagit.asp?utm_source=ITReviews_SI91UK&utm_medium=300x250_Millions&utm_campaign=SI91UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/Google Millions_300_250.gif\" width=\"300\" height=\"250\" border=\"0\" alt=\"TechSmith\" /></a>';
        techsmithTag[1] = '<a target=\"_blank\" href=\"http://www.techsmith.com/snagit.asp?utm_source=ITReviews_SI91UK&utm_medium=300x250_Chicken&utm_campaign=SI91UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/Chicken300x250.gif\" width=\"300\" height=\"250\" border=\"0\" alt=\"TechSmith\" /></a>';
        techsmithTag[2] = '<a target=\"_blank\" href=\"http://www.techsmith.com/camtasia.asp?utm_source=ITReviews_CS6UK&utm_medium=300x250_BoredRoom&utm_campaign=CS6UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/300x250-boredroom-anim50K.gif\" width=\"300\" height=\"250\" border=\"0\" alt=\"TechSmith\" /></a>';
        techsmithTag[3] = '<a target=\"_blank\" href=\"http://www.techsmith.com/camtasia.asp?utm_source=ITReviews_CS6UK&utm_medium=300x250_Sheep&utm_campaign=CS6UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/sheep-300x250-anim.gif\" width=\"300\" height=\"250\" border=\"0\" alt=\"TechSmith\" /></a>';
        techsmithTag[4] = '<a target=\"_blank\" href=\"http://www.techsmith.com/camtasia/screencasting/?utm_source=ITReviews_CS6UK&utm_medium=300x250_Phonetic&utm_campaign=CS6UK\"><img src=\"http://www.itreviews.co.uk/adcodes/techsmith/CS_Progressive_300_250.gif\" width=\"300\" height=\"250\" border=\"0\" alt=\"TechSmith\" /></a>';
        whichTag = Math.round(Math.random() * (techsmithTag.length - 1));
        mpuOutput = (techsmithTag[whichTag]);
    }
    
    else {
        // Google MPUs
        mpuOutput = '<scr' + 'ipt language="javascr' + 'ipt" type="text/javascr' + 'ipt">\n<!--\ngoogle_ad_client = "pub-6475420980328138";\n';
        mpuOutput += 'google_ad_width = 300;\ngoogle_ad_height = 250;\n';
        mpuOutput += 'google_ad_slot = "7234492069";\n';
        mpuOutput += '//-->\n<\/scr' + 'ipt>\n';
        mpuOutput += '<scr' + 'ipt type="text/javascr' + 'ipt" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\n<\/scr' + 'ipt>\n';
    }

    document.write(mpuOutput);
}


function serveVerdictbox() {

    var verdictboxbust, verdictboxchoice, verdictboxOutput;
    
    // for cache-busting
    verdictboxbust = Math.floor(10000 * Math.random());

    // for random ad rotation - verdictboxchoice will be a value between 0 and 10, so can adjust weighting of each tag. use less than 0 to disable
    verdictboxchoice = verdictboxbust / 1000;

    // Uniblue link - if you remove it, need to change first line of *each* of the actual ad entries following it from '+=' to '=', or just uncomment the line below the next one
    // verdictboxOutput = '<a target="_blank" href="http://www.liutilities.com/affcb/?id=DSgen&amp;aff=2752&amp;xat=gen"><img src="/graphics/exclaim.gif" width="22" height="20" alt="update!" class="floatleft" /> <b>We Recommend! Click here to update all your PC\'s outdated drivers</b></a>\n<br /><br />\n';
    verdictboxOutput = '';

    if (verdictboxchoice > 11) {
        // AdJug verdict box medium rectangles, degrading to Tribal Fusion, then nothing (enable only when required - test first, as code is new)
        verdictboxOutput += '<scr' + 'ipt type="text/javascr' + 'ipt" src="http://hosting.adjug.com/AdJugSearch/PageBuilder.aspx?ivi=V3.0+JS&amp;aid=447&amp;slid=59344&amp;height=250&amp;width=300&amp;HTMLOP=False&amp;ShowIFrame=True&amp;CacheBuster=' + verdictboxbust + '">\n<\/scr' + 'ipt>\n';
    }
    
    else if (verdictboxchoice > 11) {
        // VCmedia verdict box medium rectangles (enable only when required)
        verdictboxOutput += '<scr' + 'ipt language="javascr' + 'ipt" type="text/javascr' + 'ipt" src="http://media.fastclick.net/w/get.media?sid=34654&amp;m=6&amp;tp=8&amp;d=j&amp;t=s">\n<\/scr' + 'ipt>\n';
    }

    else if (verdictboxchoice > 11) {
        // ChannelFlip video content (enable only when required)
        verdictboxOutput += '<div align="center">\n';
        verdictboxOutput += '<scr' + 'ipt language="javascr' + 'ipt" type="text/javascr' + 'ipt">\n<!--\n';
        verdictboxOutput += 'sr_adspace_id = 5622307;\n';
        verdictboxOutput += 'sr_adspace_width = 300;\n';
        verdictboxOutput += 'sr_adspace_height = 250;\n';
        verdictboxOutput += 'sr_adspace_type = "graphic";\n';
        verdictboxOutput += 'sr_ad_new_window = true;\n';
        verdictboxOutput += '//-->\n<\/scr' + 'ipt>\n';
        verdictboxOutput += '<scr' + 'ipt type="text/javascr' + 'ipt" src="http://ad.afy11.net/srad.js?azId=5622307">\n<\/scr' + 'ipt>\n';
        verdictboxOutput += '</div>\n';
    }

    else {
        // Tribal Fusion, degrading to nothing
        verdictboxOutput += '<scr' + 'ipt language="javascr' + 'ipt" type="text/javascr' + 'ipt">\n<!--\ne9 = new Object();\n';
        verdictboxOutput += 'e9.size = "300x250";\ne9.noAd = 1;\n';
        verdictboxOutput += '//-->\n<\/scr' + 'ipt>\n';
        verdictboxOutput += '<scr' + 'ipt type="text/javascr' + 'ipt" src="http://tags.expo9.exponential.com/tags/ITReviews/ROS/tags.js">\n<\/scr' + 'ipt>\n';
    }

    document.write(verdictboxOutput);
}


function serveLowerleaderboard() {

    var lowerleaderboardbust, lowerleaderboardchoice, lowerleaderboardOutput;
    
    // for cache-busting
    lowerleaderboardbust = Math.floor(10000 * Math.random());

    // for random ad rotation - lowerleaderboardchoice will be a value between 0 and 10, so can adjust weighting of each tag. use less than 0 to disable
    lowerleaderboardchoice = lowerleaderboardbust / 1000;

    if (lowerleaderboardchoice > 11) {
        // AdJug lower leaderboards, degrading to house text links (enable only when required - test first, as code is new)
        lowerleaderboardOutput = '<scr' + 'ipt type="text/javascr' + 'ipt" src="http://hosting.adjug.com/AdJugSearch/PageBuilder.aspx?ivi=V3.0+JS&amp;aid=447&amp;slid=60981&amp;height=90&amp;width=728&amp;HTMLOP=False&amp;ShowIFrame=True&amp;CacheBuster=' + lowerleaderboardbust + '">\n<\/scr' + 'ipt>\n';
    }

    else if (lowerleaderboardchoice > 0) {
        // large Chitika ads (to search engine traffic in North America only), falling back to house text links
        lowerleaderboardOutput = '<scr' + 'ipt type="text/javascr' + 'ipt">\n<!--\n';
        lowerleaderboardOutput += 'ch_client = "itreviews";\nch_type = "mpu";\nch_width = 550;\nch_height = 250;\nch_color_title = "417E9D";\nch_color_site_link = "417E9D";\nch_color_text = "505050";\n';
        lowerleaderboardOutput += 'ch_non_contextual = 4;\nch_vertical ="premium";\nch_sid = "Chitika Premium";\nch_alternate_ad_url = "http://www.itreviews.co.uk/adcodes/lower_leaderboard_fallback.htm";\n';
        lowerleaderboardOutput += 'var ch_queries = new Array( );\nvar ch_selected=Math.floor((Math.random()*ch_queries.length));\nif ( ch_selected < ch_queries.length ) {\nch_query = ch_queries[ch_selected];\n}\n';
        lowerleaderboardOutput += '//-->\n<\/scr' + 'ipt>\n';
        lowerleaderboardOutput += '<scr' + 'ipt src="http://scripts.chitika.net/eminimalls/amm.js" type="text/javascript">\n<\/scr' + 'ipt>';
    }
    
    else {
        // house text links
        lowerleaderboardOutput = '<a target="_blank" href="http://www.liutilities.com/affcb/?id=RBgen&amp;aff=2752&amp;xat=gen">System Errors? Click here to Fix your PC</a>\n';
    }
    
    document.write(lowerleaderboardOutput);
}


function showFooter() {
    
    var footerbust, footerOutput;
    
    // for cache-busting
    footerbust = Math.floor(10000 * Math.random());

    footerOutput = '<img src="/cgi-bin/houseads.pl?count=' + footerbust + 'end" width="1" height="1" border="0" alt="" />\n';
    document.write(footerOutput);
}


function relocateDeferredContent() {
    
    // Ad relocation to defer ad loading until page has fully loaded (because of problems with slow ad servers)
    // Take content in a div with id="defer-xyz" and move it to a div with id="xyz"

    var divs, replacements, deferredContent, placeHolder, i;

    divs = document.getElementsByTagName("div");
    replacements = [];

    for (i = 0; i < divs.length; i++) {
        deferredContent = divs[i];
        if (deferredContent.id.indexOf("defer-") === 0) {
            placeHolder = document.getElementById(deferredContent.id.slice(6));
            replacements.push([deferredContent, placeHolder]);
        }
    }

    for (i = 0; i < replacements.length; i++) {
        replacements[i][0].parentNode.removeChild(replacements[i][0]);
        replacements[i][1].parentNode.replaceChild(replacements[i][0], replacements[i][1]);
        replacements[i][0].style.display = "block";
    }

    return true;
}
