Phx.Afc = new function ()
{
    var me = this;
    if(typeof google_afs_request_response != 'undefined') {
        me.deliverGoogleAdSenseForContent(google_afs_request_response.google_ads);
    } else {
        $().bind('GoogleAdsReceived', function (ev, data) {me.deliverGoogleAdSenseForContent(data.google_ads);});
    }
    this.deliverGoogleAdSenseForContent = function(google_ads) {
        var s = ''; var i;
        if (google_ads.length == 0) return;
        if (google_ads[0].type == "image") {
            s += '<a href="' + google_ads[0].url +
            '" target="_top" title="go to ' + google_ads[0].visible_url +
            '"><img border="0" src="' + google_ads[0].image_url +
            '"width="' + google_ads[0].image_width +
            '"height="' + google_ads[0].image_height + '"></a>';
        }
        else if (google_ads[0].type == "flash") {

            s += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
            ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"' +
            ' WIDTH="' + google_ad.image_width +
            '" HEIGHT="' + google_ad.image_height + '">' +
            '<PARAM NAME="movie" VALUE="' + google_ad.image_url +
            '">' +
            '<PARAM NAME="quality" VALUE="high">' +
            '<PARAM NAME="AllowScriptAccess" VALUE="never">' +
            '<EMBED src="' + google_ad.image_url +
            '" WIDTH="' + google_ad.image_width +
            '" HEIGHT="' + google_ad.image_height +
            '" TYPE="application/x-shockwave-flash"' +
            ' AllowScriptAccess="never" ' +
            ' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
        }
        else if (google_ads[0].type == "html") {
            s += google_ads[0].snippet;
        }
        else if (google_ads[0].type == "text") {
            if (google_afc_style == '1') {
                s += '<h2 style="margin-bottom: 10px;"><a target="_blank" href="' + google_info.feedback_url + '" style="color: inherit;">Google Anzeigen</a></h2>';
                for(i=0; i < google_ads.length; ++i) {
                    s += '<div style="margin-bottom: 10px;">' +
                    '<a target="_blank" href="' + google_ads[i].url + '" style="text-decoration:none" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\';return true;">' +
                    google_ads[i].line1 + 
                    '</a><br />' +
                    '<span style=\'color: black;\'>' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</span><br />' +
                    '<a target="_blank" href="' + google_ads[i].url + '" style="text-decoration:none" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\';return true;">' +
                    google_ads[i].visible_url +
                    '</a></div>';
                }
                s += '<br />';
            }
            else if (google_afc_style == '2') {
                s += '<div><a target="_blank" href="' + google_info.feedback_url + '" style="color: inherit;">Google Anzeigen</a></div><br />';
                for(i=0; i < google_ads.length; ++i) {
                    s += '<div style="margin-bottom: 10px;">' +
                    '<a target="_blank" href="' + google_ads[i].url + '" style="text-decoration:none" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\';return true;">' +
                    google_ads[i].line1 + 
                    '</a><br />' +
                    '<span style=\'color: black;\'>' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</span><br />' +
                    '<a target="_blank" href="' + google_ads[i].url + '" style="text-decoration:none" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\';return true;">' +
                    google_ads[i].visible_url + '</a></div>';
                }
                s += '<br />';
            }
            else if (google_afc_style == '3') {
                s += '<ul class="obj-comment-list" style="margin-bottom: 0px; padding-bottom: 0px;"><li style="margin-bottom: 0px; padding-bottom: 0px;">';
                s += '<div class="comment-metainfo"><a target="_blank" href="' + google_info.feedback_url + '" style="color: inherit;">Google Anzeigen</a></div><div class="comment-content">';
                for(i=0; i < google_ads.length; ++i) {
                    s += '<div style="margin-bottom: 10px;">' +
                    '<a target="_blank" href="' + google_ads[i].url + '" style="text-decoration:none" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\';return true;">' +
                    google_ads[i].line1 +
                    '</a><br />' +
                    '<span style=\'color: black;\'>' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</span><br />' +
                    '<a target="_blank" href="' + google_ads[i].url + '" style="text-decoration:none" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\';return true;">' +
                    google_ads[i].visible_url + '</a></div>';
                }
                s += '</div></li></ul>';
            }
            else if (google_afc_style == '4') {
                s += '<ul class="obj-comment-list" style="margin-bottom: 0px; padding-bottom: 0px;"><li style="margin-bottom: 0px; padding: 0px 0px 0px 60px;">';
                s += '<div class="comment-metainfo"><a target="_blank" href="' + google_info.feedback_url + '" style="color: inherit;">Google Anzeigen</a></div><div class="comment-content">';
                for(i=0; i < google_ads.length; ++i) {
                    s += '<div style="margin-bottom: 10px;">' +
                    '<a target="_blank" href="' + google_ads[i].url + '" style="text-decoration:none" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\';return true;">' +
                    google_ads[i].line1 +
                    '</a><br />' +
                    '<span style=\'color: black;\'>' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</span><br />' +
                    '<a target="_blank" href="' + google_ads[i].url + '" style="text-decoration:none" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\';return true;">' +
                    google_ads[i].visible_url + '</a></div>';
                }
                s += '</div></li></ul>';
            }
        }
        $('#afc_container').html(s);
        return;
    }
}();
var google_afs_request_response = null;
function google_ad_request_done(google_ads) {
    google_afs_request_response = {google_ads: google_ads}
    $().trigger('GoogleAdsReceived', google_afs_request_response);
}
if (typeof google_afc_load != 'undefined' && google_afc_load === true) {
    document.write('<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>');
}