/* google_ad_request_done() */

function google_ad_request_done(google_ads) {
  /**
   * This function is required and is used to display
   * the ads that are returned from the JavaScript
   * request. You should modify the document.write
   * commands so that the HTML they write out fits
   * with your desired ad layout.
   */
  var cnt;
  var gads_string = '';

  /**
   * Verify that there are actually ads to display.
   */
  if (google_ads.length <= 0) {
    return;
  }

  /**
   * For text ads, append each ad to the string.
   */
  cnt=0;
  for (cnt = 0; cnt < google_ads.length; cnt++) {
    if (cnt == 0) gads_string = getOKUtilAdSenseHeader();
    gads_string += getOKUtilAdSenseItem(google_ads[cnt]);
  }
  setOKUtilAdSense(gads_string); // 
  return;
}

function getOKUtilAdSenseItem(item){
  var s = '';
  s = '<div style="margin:2px 0px 5px 15px;">'
    + '  <a style="text-decoration:none;font-size:10pt;" href="' + item.url + '" onmouseout="window.status=\'\'; this.style.backgroundColor=\'\'" onmouseover="window.status=\'go to ' + item.visible_url + '\'; this.style.backgroundColor=\'#FFE5B2\'; return true">'
    + '    <span style="text-decoration:underline;font-size:11pt"><b>' + item.line1 + '</b></span>&nbsp;&nbsp;&nbsp;'
    + '    <span style="color:#008000;text-decoration:none;font-size:10pt">' + item.visible_url + '</span>'
    + '  </a><br />'
    + '  <span style="color:#000000;font-size:9pt">' + item.line2 + '&nbsp;' + item.line3 + '</span>'
    + '</div>';

  return s;
}

function getOKUtilAdSenseHeader(){
  return '<div style="margin:0 0 8px 15px;"><a href="' + google_info.feedback_url + '" style="color:#000000; font-size:9pt; text-decoration:none;">Ads by Google</a></div>';
}

function setOKUtilAdSense(gads_string){
  if (google_ad_position == 2) gads_top_s = gads_string;     // pos top   =2
  else if (google_ad_position == 3) gads_bot_s = gads_string; // pos bottom=3
}

