/* ads.js -- JavaScript file implementing support for ads (currently
   Google AdSense).  */

/*
 * Copyright (C) 2003-2009 Tudor Hulubei <tudor@hulubei.net>.
 * Distributed under the GNU General Public License.
 */


function ConfigureAds(channel)
{
    google_ad_client = "pub-4036224197250044";
    google_ad_channel = channel;

    var url = location.href;

    // Avoid setting the alternate ad when testing the website in a
    // local directory.
    if (url.indexOf(g_hostName) != -1)
        google_alternate_ad_url =
            "http://" + g_hostName + "/google_adsense_script.html";
}


function ConfigureAdColors()
{
    google_alternate_color = "161817";
    google_color_border = "444444";
    google_color_bg = "161817";
    google_color_line = "0000ff";
    google_color_link = "red";
    google_color_url = "red";
    google_color_text = "d6d6d6";
}


function ConfigureAdUnit(type)
{
    /* Use "text_image" for the google_ad_type if you want to activate
       images, but they can be very distracting and make the site ugly.  */
    ConfigureAdColors();

    if (type == "Links")
    {
        google_ad_width = 160;
        google_ad_height = 90;
        google_ad_format = "160x90_0ads_al_s";
    }
    else if (type == "SkyScraper")
    {
        google_ad_width = 160;
        google_ad_height = 600;
        google_ad_format = "160x600_as";
        google_ad_type = "text";
    }
    else if (type == "LetterBoard")
    {
	/* The problem with LetterBoard is that I can't seem to find a
           way to make it do overflow: hidden.  Maybe Google implements
           some magic in JavaScript to disable that, and as a result the
           page doesn't resize properly (the Content div cannot be
           shrinked beyond the width of the ad).  */
        google_ad_width = 728;
        google_ad_height = 90;
        google_ad_format = "728x90_as";
        google_ad_type = "text";
    }
    else if (type == "HalfBanner")
    {
        google_ad_width = 234;
        google_ad_height = 60;
        google_ad_format = "234x60_as";
        google_ad_type = "text";
    }
}

