var google_afs_client = 'pub-2957901339608046'; // substitute your client ID
var google_afs_adsafe = 'medium'; // specify level for filtering non-family-safe ads
var googleAdNewWindow = 1;

function utf8_encode ( string ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: sowberry
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman
    // +   improved by: Yves Sucaet
    // +   bugfixed by: Onno Marsman
    // *     example 1: utf8_encode('Kevin van Zonneveld');
    // *     returns 1: 'Kevin van Zonneveld'
 
    string = (string+'').replace(/\r\n/g, "\n").replace(/\r/g, "\n");
 
    var utftext = "";
    var start, end;
    var stringl = 0;
 
    start = end = 0;
    stringl = string.length;
    for (var n = 0; n < stringl; n++) {
        var c1 = string.charCodeAt(n);
        var enc = null;
 
        if (c1 < 128) {
            end++;
        } else if((c1 > 127) && (c1 < 2048)) {
            enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
        } else {
            enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
        }
        if (enc != null) {
            if (end > start) {
                utftext += string.substring(start, end);
            }
            utftext += enc;
            start = end = n+1;
        }
    }
 
    if (end > start) {
        utftext += string.substring(start, string.length);
    }
 
    return utftext;
}

function google_afs_request_done(google_ads) {
        if (google_ads.length < 2 ) {
                document.write('<script language="JavaScript">'+
                        'google_ad_client = "pub-2957901339608046";'+
                        'google_ad_channel ="4973829181";'+
                        'google_kw = null;'+
                        'google_max_num_ads = 5;'+
                        'google_ad_output = "js";'+
                        'google_encoding = "latin1";'+
                        'google_feedback = "on";'+
                        'google_kw_type = "broad";'+
                        'google_language = "de";'+
                        '</script>'+
                        '<script language="JavaScript" src="/javascript/google_adsense.js">'+
                        '</script>'+
                        '<script language="JavaScript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">'+
                        '</script>');
                return;
        }
        google_oben = '<div class="googlebox contentbox rahmen">';
        google_oben += '<h2 class="anzeigen_titel"><a target="_blank" style="color:#ffffff;" href="http://services.google.com/feedback/online_hws_feedback">Google-Anzeigen</a></h2>';
        google_oben += '<table cellpadding="5" width="100%" align="center">';
        kw += " ";
        Ergebnis = kw.match(/([^ ]*) /g);
        for(i = 0; i < anzahl; ++i) {
//              if (google_ads[i].type == 'text/wide') {
                        if (google_ads[i] && google_ads[i].line1 && google_ads[i].line2) {
                                line1 = google_ads[i].line1;
                                line2 = google_ads[i].line2;
                                if (google_ads[i].line3)
                                        line3 = google_ads[i].line3;
                                else
                                        line3 = '';
                                if (Ergebnis)
                                        for (var j = 0; j < Ergebnis.length; ++j) {
                                                Ergebnis[j] = Ergebnis[j].replace(' ','');
                                                myregexp = new RegExp(Ergebnis[j],'ig');
                                                line1 = line1.replace(myregexp,'<b>'+Ergebnis[j]+'</b>');
                                                myregexp = new RegExp(Ergebnis[j],'ig');
                                                line2 = line2.replace(myregexp,'<b>'+Ergebnis[j]+'</b>');
                                                myregexp = new RegExp(Ergebnis[j],'ig');
                                                line3 = line3.replace(myregexp,'<b>'+Ergebnis[j]+'</b>');
                                        }
                                google_oben += '<tr>' +
                                        '<td width=100% class="googletd" onmouseover="this.style.backgroundColor=\'#E6F2CA\';"'+
                                        ' onmouseout="this.style.backgroundColor=\'#FFFFFF\';">' +
                                                '<a target="_blank" class="titelline" id=\'gtd'+i+'\' href="' + google_ads[i].url + '" onmouseover="'+
                                                'return window.status = \''+google_ads[i].visible_url+'\';" style="height:100%;text-decoration:none; '+
                                                'cursor:pointer;" onclick="return report_outclick(0,'+(-10-i)+',fk_suchcache_id);"> '+
                                                        '<span style="height:100%;margin-right:8px; text-decoration:underline; cursor:pointer;'+
                                                        'vertical-align:middle;">' + line1 + '</span>'+
                                                '</a> ' +
                                                '<span class="descriptionline" style="height:auto;margin-right:8px; text-decoration:none;'+
                                                'vertical-align:middle;">' +
                                                        line2 + '&nbsp;' + line3 +
                                                '</span>'+
                                                '<a target="_blank" class="titelline" id="gtdl'+i+'" href="' + google_ads[i].url + '" onmouseover="'+
                                                'return window.status = \''+google_ads[i].visible_url+'\';" style="height:100%;text-decoration:none; '+
                                                'cursor:pointer;" onclick="return report_outclick(0,'+(-10-i)+',fk_suchcache_id);"> ' +
                                                        '<span class="linkurlline"'+
                                                        ' style="height:auto;text-decoration:none; cursor:pointer; vertical-align:middle;">' +
                                                                google_ads[i].visible_url +
                                                        '</span>' +
                                                '</a>'+
                                        '</td>' +
                                        '</tr>';
                        }
//              }
        }
        google_oben += '</table></div>';
        return;
}

