var ads = "";

var min_three_ads_width = 0;

function findParam(param, def)
{
    param += "=";
    var res = def;
    URL = self.location.href;
    var p = URL.indexOf(param);
    if (p == -1)
        {
	    return res;
        } else
        {
	    var temp = URL.substring(p + param.length);
	    pe = temp.indexOf("&");
	    if (pe == -1) pe = temp.length;
	    res = temp.substring(0, pe);
        }
    return Number(res);
}

function findWidth()
{
	var width = 1200;
	if (typeof(window.innerWidth) == 'number')
		width = window.innerWidth;
	else if (document.documentElement &&
		 (document.documentElement.clientWidth)) 
		width = document.documentElement.clientWidth;
	else if (document.body && (document.body.clientWidth))
		width = document.body.clientWidth;
	return width;
}

function google_afs_request_done(google_ads) {
    wstyle = "";
    if (findWidth() > min_three_ads_width) {
	wstyle = " style='width:30%'";
    }
    if (google_ads.length > 0) {
	ads += "<p id='googleAdsenseLink'><a href='https://www.google.com/adsense/support/bin/request.py?contact=afs_violation'>" + adsText + "</a></p>\n"
	    for(i = 0; i < google_ads.length; i++) {
		ads += "<div class='googleAdsenseAd'" + wstyle + ">\n";
		ads += "<span><a href='" + google_ads[i].url + "'>" + google_ads[i].line1 + "</a></span>\n";
		ads += "<a href='" + google_ads[i].url + "'>" + "</a> " + google_ads[i].line2 + " " + google_ads[i].line3;
		ads += "\n<br><a href='" + google_ads[i].url + "'>" + google_ads[i].visible_url + "</a> " ;
		ads += "</div>\n";
	    }
		
	ads += "<div class='clear'></div>\n";
	
	$("p#googleAdsense").html(ads);
	$("p#googleAdsense").css("padding", "0 0");
    }
}

google_afs_adtest = 'off';
google_afs_ad = 'n2'; // specify the number of ads you are requesting
if (findWidth() > min_three_ads_width) {
    google_afs_ad = 'n3'; // specify the number of ads you are requesting
}
google_afs_client = 'pub-2751238045634895'; // substitute your client ID
google_afs_ie = 'utf8';;
google_afs_oe = 'utf8';