﻿var googlePT="";
function GetParam(name) {
    var match = new RegExp(name + "=([^&]+)","i").exec(location.search);
    if (match==null)
      match = new RegExp(name + "=(.+)","i").exec(location.search);
    if (match==null)
      return null;
    match = match + "";
    result = match.split(",");
    return result[1];
}
function google_afs_request_done(google_ads) {
    var google_num_ads = google_ads.length;
    if (google_num_ads <= 0) 
      return;

    var wideAds = "";   //wide ad unit html text
    var narrowAds = "";   //narrow ad unit html text
 
    for(i = 0; i < google_num_ads; i++){
      if (google_ads[i].type=="text/wide"){  
      //** render a wide ad  
        if(googlePT.length==2)wideAds+='<div style="margin-left:6px;">';
        
        wideAds+='<a href="' + google_ads[i].url + '" target="_blank"' +
          'onmouseout="window.status=\'\';return true" ' +
          'onmouseover="window.status=\'go to ' +
          google_ads[i].visible_url + '\';return true" ' + 
          'style="font-size:14px;font-weight:bold;">' + google_ads[i].line1 +
          '</a><br>' +
          '<span style="color:#000000">' +
          google_ads[i].line2 + '<br></span>' +
          '<span style="color:#008000"><a href="'+google_ads[i].url+'" target="_blank" style="text-decoration:none;font-weight:normal;">' +
          google_ads[i].visible_url +
          '</a></span>';
          
          wideAds+='<BR>';
          if(i<google_num_ads -1)wideAds+='<BR>';
          
        if(googlePT.length==2)wideAds+='</div>';
      } else {
        //render a narrow ad
        narrowAds+='<a href="' + google_ads[i].url + '"' +
          'onmouseout="window.status=\'\';return true" ' +
          'onmouseover="window.status=\'go to ' +
          google_ads[i].visible_url + '\';return true" ' + 
          'style="text-decoration:none;">' +
          '<span style="text-decoration:underline;">' +
          '<b>' + google_ads[i].line1 +
          '</b><br></span>' +
          '<span style="color:#000000">' +
          google_ads[i].line2 + '<br></span>' +
          '<span style="color:#000000">' +
          google_ads[i].line3 + '<br></span>' +
          '<span style="color:#008000">' +
          google_ads[i].visible_url +
          '</span></a><BR><BR>';
      }
    }
    if (narrowAds != "") {
      narrowAds = '<div class="ad_header" style="text-align:left">' +
          'Sponsored Links</div>' + narrowAds;
    }
    if (wideAds != "") {
      wideAds = '<div class="ad_header" style="text-align:left;font-size:12px;background:#eeeeee;'+(googlePT.length==2 ? "" : "margin-top:5px;")+'margin-bottom:3px;padding:2px;">' +
          '<a href="https://www.google.com/adsense/support/bin/answer.py?answer=44511&sourceid=aso&subid=ww-ww-et-asui&medium=link" target="_blank" style="text-decoration:none;color:#000000;">Google提供的广告</a></div>' + wideAds;
      wideAds+='<div class="ad_header" style="'+(googlePT.length==2 ? "" : "background:#eeeeee;")+'height:5px;margin-top:3px;"></div>';
    }

    //** Write HTML for wide and narrow ads to the proper <div> elements
    document.getElementById("wide_ad_unit").innerHTML = wideAds;//alert(wideAds)
    //document.getElementById("narrow_ad_unit").innerHTML = narrowAds;
} 

google_afs_query = '北京+艺术娱乐,';
google_afs_ad = 'w3'; // specify the number of ads you are requesting
google_afs_client = 'pub-5114532200342862'; // substitute your client ID

google_afs_channel = '6449597805'; // enter your comma-separated channel IDs
google_afs_ie = 'utf8'; // select input encoding scheme
google_afs_oe = 'utf8'; // select output encoding scheme
google_afs_adsafe = 'medium'; // specify level for filtering non-family-safe ads
google_afs_adtest = 'off'; // ** set parameter to off before launch to production
google_afs_hl = 'zh-CN'; // enter your interface language if not English
google_afs_gl = 'cn';
