<!--

  /*
   * This function is used to retrieve the value in the search box on the page
   */
  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];
  }

  
  /*
   * This function is required. It processes the google_ads JavaScript object,
   * which contains AFS ads relevant to the user's search query. The name of
   * this function must be google_afs_request_done. If this 
   * function is not named correctly, your page will not display AFS ads.
   */

  function google_afs_request_done(google_ads) {

    /*
     * Verify that there are actually ads to display.
     */
    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
    var headerText = '<div class="pnr_ad_header">Sponsored Links</div>';
 
    for(i = 0; i < google_num_ads; i++){
      if (google_ads[i].type=="text/wide"){  
      //** render a wide ad  
        wideAds+='<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 class="pnr_w_ad_line1" style="text-decoration:underline">' +
		  '<b>' + google_ads[i].line1 + '</b><br></span>' +
		  '<span class="pnr_w_ad_text" style="color:#000000">' +
		  google_ads[i].line2 + '<br></span>' +
		  '<span class="pnr_w_ad_url" style="color:#008000">' +
		  google_ads[i].visible_url + '</span></a><BR><BR>';
      } 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 class="pnr_n_ad_line1" style="text-decoration:underline">' +
		  '<b>' + google_ads[i].line1 + '</b><br></span>' +
		  '<span class="pnr_n_ad_text" style="color:#000000">' +
		  google_ads[i].line2 + '<br></span>' +
		  '<span class="pnr_n_ad_line1" style="color:#000000">' +
		  google_ads[i].line3 + '<br></span>' +
		  '<span class="pnr_n_ad_url" style="color:#008000">' +
		  google_ads[i].visible_url + '</span></a><BR><BR>';
      } //end Else
    }	//end For
    if (narrowAds != "") {
      narrowAds = '<div class="pnr_w_ad_header" style="text-align:left">' +
                  'Sponsored Links</div>' + narrowAds + '</div>';
    }
    if (wideAds != "") {
      wideAds = '<div class="pnr_w_ad_header" style="text-align:left">' +
                  'Sponsored Links</div>' + wideAds + '</div>';
    }

    //** Write HTML for wide and narrow ads to the proper <div> elements
    document.getElementById("wide_ad_unit").innerHTML = wideAds;
    document.getElementById("narrow_ad_unit").innerHTML = narrowAds;
  } //end google_afs_request_done()

//google_afs_query = decodeURI(GetParam('q'));
//alert (searchQuery);
google_afs_query = decodeURI(searchQuery);
google_afs_ad = 'w3n3'; // specify the number of ads you are requesting
google_afs_client = 'cris'; // substitute your client ID

google_afs_channel = 'Trainenquiry,te_RunningStatus,Right,Runningstatus_right'; // 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 = 'high'; // specify level for filtering non-family-safe ads
google_afs_adtest = 'off'; // ** set parameter to off before launch to production
// google_afs_hl = 'en'; // enter your interface language if not English

-->
