   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 cont=0;
            for(i = 0; i < google_num_ads; i++)
            {
			
			
			
			
			
			
                if (google_ads[i].type=="text/wide")
                {
				
				
                    // render a wide ad
                    wideAds+='<a target="_blank" style="text-decoration:none" onmouseover="javascript:window.status=\'' +
                            google_ads[i].url + '\';return true;" ' +
                            'onmouseout="javascript:window.status=\'\';return true;" ' +
                            'href="' + google_ads[i].url + '">' +
      
                            '<span class="ad_line1">' + google_ads[i].line1 + '</span></a>&nbsp;' +
                            
                            '<span class="ad_text">' + google_ads[i].line2 + '</span><br>' +
                            
                            '<a target="_blank" style="text-decoration:none" onmouseover="javascript:window.status=\'' +
                            google_ads[i].url + '\';return true;" ' +
                            'onmouseout="javascript:window.status=\'\';return true;" ' +
                            'href="' + google_ads[i].url + '" target="_blank">' +
                            
                            '<span class="ad_url">' + google_ads[i].visible_url + '</span><br><br></a>';
                }
      
                else
                {  
				
				
				
					
					// render a narrow ad
                    narrowAds+='<a target="_blank" style="text-decoration:none" onmouseover="javascript:window.status=\'' +
                            google_ads[i].url + '\';return true;" ' +
                            'onmouseout="javascript:window.status=\'\';return true;" ' +
                            'href="' + google_ads[i].url + '">' +
      
                            '<span class="ad_line1">' + google_ads[i].line1 + '</span></a><br>' +
      
                            '<span class="ad_text">' + google_ads[i].line2 + '</span><br>' +
      
                            '<span class="ad_text">' + google_ads[i].line3 + '</span><br>' +
      
                            '<a target="_blank" style="text-decoration:none" onmouseover="javascript:window.status=\'' +
                            google_ads[i].url + '\';return true;" ' +
                            'onmouseout="javascript:window.status=\'\';return true;" ' +
                            'href="' + google_ads[i].url + '" target="_blank">' +
      
                            '<span class="ad_url">' + google_ads[i].visible_url + '</span><br><br></a>';
							
               }
            }
      
            if (narrowAds != "")
            {
			
                narrowAds = '<a target="_blank" style="text-decoration:none" ' +
                            'href="https://www.google.com/adsense/support/bin/request.py?contact=afs_violation">' +
                            '<span class="ad_header" style="text-align:left">Ads by Google</span><br><br></a>' + narrowAds;
            }
      
            if (wideAds != "")
            {
			
                wideAds = '<a target="_blank" style="text-decoration:none" ' +
                          'href="https://www.google.com/adsense/support/bin/request.py?contact=afs_violation">' +
                          '<span class="ad_header" style="text-align:left">Ads by Google</span><br><br></a>' + wideAds;
            }
			

			
      
            // Write HTML for wide and narrow ads to the proper <div> elements
            if(document.getElementById("wide_ad_unit"))
              document.getElementById("wide_ad_unit").innerHTML = wideAds;
            if(document.getElementById("narrow_ad_unit"))
              document.getElementById("narrow_ad_unit").innerHTML = narrowAds;
			  
			  
			  
			 // alert(wideAds);
	 // alert(narrowAds);

        }
        
        var str_googleQuery = "";
		 var str_leaving= "";
    
       
        
		
		//Vacanze setto il canale e poi setto anche la frase con citta di arrivo 
		
		
		
		   channel="8872227798";
		   
	   
		   
		  //Rotate Vacanze a Dublino and Pacchetti Vacanze a Dublino
	        var zero_one = parseInt(Math.random()*2);
            var str_what = (zero_one == 0 ? 'Vacanze a ' : 'Pacchetti Vacanze a ');
			str_googleQuery = str_what + str_destination;
		   
	       
			
			
       
	   
        google_afs_query = str_googleQuery;
        google_afs_ad = 'w4n5'; // specify the number of ads that you are requesting
        google_afs_client = 'pub-5829145237056409'; // substitute your client ID
        google_afs_channel = channel; // enter your custom channel ID
        google_afs_hl = 'it'; // enter your interface language if not English
        google_afs_gl = 'it';
        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.
         */
		 
		   