var stampa_div=0;
var bloccoTitle;
var bloccoTitle_sx;


function google_ad_request(pos, first, len) {

	if(global_ads_switcher == 'oAds') {
		bloccoTitle = 'SPONSOR';
		bloccoTitle_sx = '';
	} else {
		if(global_ads_switcher == 'gSrc') {
			bloccoTitle = 'COLLEGAMENTI SPONSORIZZATI';
			bloccoTitle_sx = 'COLLEGAMENTI SPONSORIZZATI';
		} else {
			bloccoTitle = 'ANNUNCI GOOGLE';
			bloccoTitle_sx = 'ANNUNCI GOOGLE';
		}
	}

    var s = '';
    var i;

    first = first - 1;
    last = first + len - 1;

    if (global_xgiox_ads.length <= last)
        last = global_xgiox_ads.length - 1;

    if (global_xgiox_ads.length == 0) {
        return;
    }   

	if (first > global_xgiox_ads.length) {
        return;
    }
    
    if (global_xgiox_ads[first].type=='text') {
        if (global_xgiox_ads.length > first) {
            if (global_xgiox_ads.length < last) {
                last = global_xgiox_ads.length;
            }
            switch(pos) {
				case 'SX_SX':
                    var dsc = '';

                    for(i=first; i<= last; ++i) {

                        dsc = global_xgiox_ads[i].line2+' '+global_xgiox_ads[i].line3;
                        vis_url = new String(global_xgiox_ads[i].visible_url);

                        s += '<div class="ris">';
                        s += '<a href="'+global_xgiox_ads[i].url+'" ';
                        s += 'onMouseOut="window.status=\'\'; return true;" ';
                        s += 'onMouseOver="window.status=\'go to http://'+global_xgiox_ads[i].visible_url+'\'; return true;" class="title" rel="nofollow" style="text-decoration:none">';
                        s += '<span class="adsTitle">' + global_xgiox_ads[i].line1 + '</span>';
                        s += ' <span style="display: inline; font-size: 11px; color: #999; font-weight: normal">Annunci Google</span>';
                        s += '<p style="color: #333; font-size: 13px; font-weight: normal">';
                        s += dsc;
                        s += '</p>';
                        s += '<span class="adsLink cat-spot-web" style="font-size: 12px; font-weight: normal">'+ vis_url +'</span></a></div>';
                    }
                    break;
				case 'SX_CAT':
                    
                    var dsc = '';
                    s += '<label class="annunciGoogle">Annunci Google</label>';
                    for(i=first; i<= last; ++i) {

                        dsc = global_xgiox_ads[i].line2+'<br />'+global_xgiox_ads[i].line3;
                        vis_url = new String(global_xgiox_ads[i].visible_url);

                        s += '<div class="cat-spot">';
                        s += '<a href="'+global_xgiox_ads[i].url+'" ';
                        s += 'onMouseOut="window.status=\'\'; return true;" ';
                        s += 'onMouseOver="window.status=\'go to http://'+global_xgiox_ads[i].visible_url+'\'; return true;" class="title" rel="nofollow" style="text-decoration:none">';
                        s += '<span class="adsTitle" style="font-size: 13px; font-weight: bold">' + global_xgiox_ads[i].line1 + '</span>';
                        s += '<p style="color: #333">';
                        s += dsc;
                        s += '</p>';
                        adsL = "adsLinkMaxi";
                        if (vis_url.length > 26)
                            adsL = "adsLink";
                        if (vis_url.length > 30)
                            adsL = "adsLinkMini";
                        s += '<span class="'+ adsL +' cat-spot-web">'+ vis_url +'</span></a></div>';
                    }
                    break;
				case '3SX':
					var dsc = '';
					s += '<div class="b650simple"><div class="b650simple-cont"><label class="annunciGoogle">Annunci Google</label>';


                    for(i=first; i<= last; ++i) {

                        dsc = global_xgiox_ads[i].line2+'<br />'+global_xgiox_ads[i].line3;
                        vis_url = new String(global_xgiox_ads[i].visible_url);

                        s += '<div class="sponsor-h2">';
                        s += '<a href="'+global_xgiox_ads[i].url+'" ';
                        s += 'onMouseOut="window.status=\'\'; return true;" ';
                        s += 'onMouseOver="window.status=\'go to http://'+global_xgiox_ads[i].visible_url+'\'; return true;" class="title" rel="nofollow" style="text-decoration:none">';
                        s += '<span class="adsTitle" style="font-size: 13px; font-weight: bold">' + global_xgiox_ads[i].line1 + '</span>';
                        s += '<p style="color: #333; font-weight: normal">';
                        s += dsc;
                        s += '</p>';
                        if (vis_url.length > 30)
                            adsL = "adsLink";
                        else
                            adsL = "adsLinkMaxi";
                        s += '<span class="'+ adsL +' cat-spot-web" style="font-weight: normal">'+ vis_url +'</span></a></div>';
                    }
					s += '</div> <div class="clear"><!-- --></div> <div class="b650simple-end"><!-- --></div> </div>';
                    break;
				case '3SC':
                    var dsc = '';

					s += '<label class="annunciGoogle">Annunci Google</label>';

                    for(i=first; i<= last; ++i) {

                        dsc = global_xgiox_ads[i].line2+'<br />'+global_xgiox_ads[i].line3;
                        vis_url = new String(global_xgiox_ads[i].visible_url);

                        s += '<div class="cat-spot">';
                        s += '<a href="'+global_xgiox_ads[i].url+'" ';
                        s += 'onMouseOut="window.status=\'\'; return true;" ';
                        s += 'onMouseOver="window.status=\'go to http://'+global_xgiox_ads[i].visible_url+'\'; return true;" class="title" rel="nofollow" style="text-decoration:none">';
                        s += '<span class="adsTitle" style="font-size: 13px; font-weight: bold">' + global_xgiox_ads[i].line1 + '</span>';
                        s += '<p style="color: #333">';
                        s += dsc;
                        s += '</p>';
                        if (vis_url.length > 30)
                            adsL = "adsLink";
                        else
                            adsL = "adsLinkMaxi";
                        s += '<span class="'+ adsL +' cat-spot-web">'+ vis_url +'</span></a></div>';
                    }
                    break;
				case 'COLSX-SEARCH':
					var dsc = '';
                    for(i=first; i<= last; ++i) {

						dsc = global_xgiox_ads[i].line2+' '+global_xgiox_ads[i].line3;

						s += '<div class="ric-lt"><p class="img"><img src="img/ico-circle.gif" alt=""/></p>';

                        s += '<p><a href="'+global_xgiox_ads[i].url+'" ';
                        s += 'onMouseOut="window.status=\'\'; return true;" ';
                        s += 'onMouseOver="window.status=\'go to http://'+global_xgiox_ads[i].visible_url+'\'; return true;" rel="nofollow">';
                        s += global_xgiox_ads[i].line1;
                        s += '</a>';
                        s += '<span class="ric-sp">Collegamenti Sponsorizzati</span><br clear="all" />';
						s += dsc;
						s += '<br clear="all" />';
						s += '<a href="'+global_xgiox_ads[i].url+'" ';
						s += 'onMouseOut="window.status=\'\'; return true;" ';
                        s += 'onMouseOver="window.status=\'go to http://'+global_xgiox_ads[i].visible_url+'\'; return true;" ';
						s += 'class="ric-web" rel="nofollow">';
						s += global_xgiox_ads[i].visible_url+'</a></p></div>';
                    }
                    break;
				case 'DX_SX':
					s += '<div class="b160simple" id="sky-google"><div class="b160simple-cont"><label class="annunciGoogle">Annunci Google</label>';
                    for(i=first; i<= last; ++i) {

						dsc = global_xgiox_ads[i].line2+'<br />'+global_xgiox_ads[i].line3;
						vis_url = new String(global_xgiox_ads[i].visible_url);

                        s += '<div class="sponsor2">';
                        s += '<a href="'+global_xgiox_ads[i].url+'" ';
                        s += 'onMouseOut="window.status=\'\'; return true;" ';
                        s += 'onMouseOver="window.status=\'go to http://'+global_xgiox_ads[i].visible_url+'\'; return true;" class="title" rel="nofollow" style="text-decoration:none">';
                        s += '<span class="adsTitle">' + global_xgiox_ads[i].line1 + '</span>';
                        s += '<p style="color: #333">';
						s += dsc;
						s += '</p>';
                        if (vis_url.length > 30)
                            adsL = "adsLinkMini";
                        else
                            adsL = "adsLink";
                        s += '<span class="'+ adsL +'">'+ vis_url +'</span></a></div>';
                    }
                    s += '<div class="clear"><!-- --></div> </div> <div class="clear"><!-- --></div> <div class="b160simple-end"><!-- --></div> </div>';
                    break;
                default:
					s = '';
            }
        }
    }   

    document.write(s);
    return;
}
