      /*
      * This function retrieves the search query from the URL.
      */

      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 <i>must</i> be <b>google_afs_request_done</b>. 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)
          {
          

          var wideAdsUp = "";   // wide ad unit html text
          var wideAdsDown = "";

          for(i = 0; i < Math.min(google_num_ads,2); i++)
          {
              if (google_ads[i].type=="text/wide")
              {
                  // render a wide ad
                  
                  	
                  wideAdsUp+='<dt><a onmouseover="javascript:window.status=\'' +
                          google_ads[i].url + '\';return true;" ' +
                          'onmouseout="javascript:window.status=\'\';return true;" ' +
                          'href="' + google_ads[i].url + '">' + google_ads[i].line1 + '</a></dt>' +
                          '<dd>' + '<a onmouseover="javascript:window.status=\'' +
                          google_ads[i].url + '\';return true;" ' +
                          'onmouseout="javascript:window.status=\'\';return true;" ' +
                          'href="' + google_ads[i].url + '">' + google_ads[i].visible_url + '</a>&nbsp;' +
                          '<span>' + google_ads[i].line2 + '</span>' +
                          '</dd>';
              }
          }
          
          if (wideAdsUp != "")
          {
              wideAdsUp = '<a style="text-decoration:none" ' +
                        'href="http://services.google.com/feedback/online_hws_feedback">' +
                        '<p class="ad_header">' + google_header_text + '</p></a><dl>' + wideAdsUp + '</dl>';
          }
         
         // Write HTML for wide and narrow ads to the proper <div> elements
         document.getElementById("wide_ad_unit_up").innerHTML = wideAdsUp;
         toggleVisibility("wide_ad_unit_up");
          
          if (google_num_ads  >= 2) {
	          for(i = 2; i < Math.min(google_num_ads,5); i++)
	          {
	              if (google_ads[i].type=="text/wide")
	              {
	                  // render a wide ad
                  wideAdsDown+='<dt><a onmouseover="javascript:window.status=\'' +
                          google_ads[i].url + '\';return true;" ' +
                          'onmouseout="javascript:window.status=\'\';return true;" ' +
                          'href="' + google_ads[i].url + '">' + google_ads[i].line1 + '</a></dt>' +
                          '<dd>' + '<a onmouseover="javascript:window.status=\'' +
                          google_ads[i].url + '\';return true;" ' +
                          'onmouseout="javascript:window.status=\'\';return true;" ' +
                          'href="' + google_ads[i].url + '">' + google_ads[i].visible_url + '</a>&nbsp;' +
                          '<span>' + google_ads[i].line2 + '</span>' +
                          '</dd>';
	              }
	          }
	          
	            if (wideAdsDown != "")
		          {
		              wideAdsDown = '<a style="text-decoration:none" ' +
		                        'href="http://services.google.com/feedback/online_hws_feedback">' +
		                        '<p class="ad_header">' + google_header_text + '</p></a><dl>' + wideAdsDown + '</dl>';
		          	// Write HTML for wide and narrow ads to the proper <div> elements
			        document.getElementById("wide_ad_unit_down").innerHTML = wideAdsDown;
			        toggleVisibility("wide_ad_unit_down");
		          }
	      } 
	  }
      // Enviamos una petición a Google con el numero de Adsense que se han recibido de Google.
      stats('/adsense/' + google_num_ads); 
      }


      //google_afs_query = 'cursos de java';
      
      google_afs_client = 'pub-8748362868131070'; // substitute your client ID
      //google_afs_client = 'partner-pub-8748362868131070:73b2jc-s0b7'; // substitute your client ID
      //google_afs_client = 'partner-pub-8748362868131070'; // substitute your client ID
      google_ad_test = 'off';

      google_afs_ie = 'utf8'; // select input encoding scheme
      google_afs_oe = 'utf8'; // select output encoding scheme
      


      /*
       * The JavaScript returned from the following page uses
       * the parameter values assigned above to populate an array
       * of ad objects. Once that array has been populated,
       * the JavaScript will call the google_afs_request_done
       * function to display the ads.
       */

    
