/* Parametri del publisher Schede-cellulari.it */
google_ad_client 	= 'pub-6008953257480380';
google_ad_output 	= 'js';
google_max_num_ads 	= '12';
google_adtest 		= 'off';
google_ad_type 		= 'text';
google_feedback 	= 'on';
google_image_size 	= '336x280';
google_encoding 	= "latin1";

function google_ad_request_done(google_ads) {
	var adv1 = '';
	var adv2 = '';
	var adv3 = '';
	var adv_extra = '';
	
    var i=0;
	 
    if (google_ads.length == 0) {
		return;
    }
	if (google_ads[0].type == "image") {
		 img1 = '<a href="' + google_ads[0].url + '" target="_top" title="go to ' + google_ads[0].visible_url + '"><img src="' + google_ads[0].image_url +'"width="' + google_ads[0].image_width + '"height="' + google_ads[0].image_height + '"></a>';
		 document.getElementById("annunci2").innerHTML = adv1;
	} else {
		if (google_ads.length >= 1) {
			adv1 += '<div id="adv1"><div id="ads1bygoogle"><a href="' + google_info.feedback_url + '">Ads by Google</a></div><a href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'"><strong>' + google_ads[i].line1 + '</strong></a><br /><span class="descrizione">' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</span><br /><a class="url" href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'"><em>' + google_ads[i].visible_url + '</em></a></div>';
		}
		if (google_ads.length == 1) {
			if(document.getElementById("annunci1")) {
				document.getElementById("annunci1").innerHTML = adv1;
			}
		} else if (google_ads.length > 1) {
			if(document.getElementById("annunci1")) {
				document.getElementById("annunci1").innerHTML = adv1;
			}

			if(google_ads.length >= 5) {
				adv2 += '<div class="adv2"><div class="ads2bygoogle"><a href="' + google_info.feedback_url + '">Ads by Google</a></div><ul>';
				for(i=1; i < 5; i++) {
					adv2 += '<li><a href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'"><strong>' + google_ads[i].line1 + '</strong></a><br /><span class="descrizione">' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</span><br /><a href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'"><em>' + google_ads[i].visible_url + '</em></a></li>';
				}
				adv2 += '</ul>';
				adv2 += '</div>';
				if(document.getElementById("annunci2")) {
					document.getElementById("annunci2").innerHTML = adv2;
				}
			}
			
			if(google_ads.length >= 7) {
				adv3 += '<div class="adv2"><div class="ads2bygoogle"><a href="' + google_info.feedback_url + '">Ads by Google</a></div><ul>';
				for(i=5; i < 7; i++) {
					adv3 += '<li><a href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'"><strong>' + google_ads[i].line1 + '</strong></a><br /><span class="descrizione">' + google_ads[2].line2 + ' ' + google_ads[i].line3 + '</span><br /><a href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'"><em>' + google_ads[i].visible_url + '</em></a></li>';
				}
				adv3 += '</ul></div>';
				if(document.getElementById("annunci3")){ 	
					document.getElementById("annunci3").innerHTML = adv3;
				}
			}
			
			if(document.getElementById("annunci4") && google_ads.length >= 8) {
				i++;
				document.getElementById("annunci4").innerHTML = '<div class="feedback"><a href="' + google_info.feedback_url + '">Ads by Google</a></div><a href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'"><strong>' + google_ads[i].line1 + '</strong></a><br /><span class="descrizione">' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</span><br /><a class="url" href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'"><em>' + google_ads[i].visible_url + '</em></a>';
			}
			
			if(document.getElementById("annunci5") && google_ads.length >= 9) {
				i++;
				document.getElementById("annunci5").innerHTML = '<div class="feedback"><a href="' + google_info.feedback_url + '">Ads by Google</a></div><a href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'"><strong>' + google_ads[i].line1 + '</strong></a><br /><span class="descrizione">' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</span><br /><a class="url" href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'"><em>' + google_ads[i].visible_url + '</em></a>';
			}
			
			if(document.getElementById("adv_vert") && document.getElementById("annunci2") && google_ads.length >= 10) {
				adv_extra += '<div class="feedback"><a href="' + google_info.feedback_url + '">Ads by Google</a></div>';
				for(i=10;i<google_ads.length;i++) {
					adv_extra += '<div class="adv_extra"><a class="tit_extra" href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'"><strong>' + google_ads[i].line1 + '</strong></a><br /><span class="descrizione">' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</span><br /><a class="url" href="' + google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' + google_ads[i].visible_url + '\'"><em>' + google_ads[i].visible_url + '</em></a></div>';
				}
				document.getElementById("adv_vert").innerHTML = document.getElementById("adv_vert").innerHTML + adv_extra;
			}

		}
	}
	return;
}