$(function() {
	if(pageRai != 'HP') {
		Banners.vars = [
			{
				s: '.Spalla .banner300x250:eq(0)', // selettore jQuery
				v: 'rai_home^rai_home_ros_medium_box_var^300x250', // variabile banner
				t: '', // tappo in caso di mancata erogazione
				callback: function() {}, // callback da chiamare al caricamento di questo banner
				hideEmpty: true // nascondere il div contenitore in caso di mancata erogazione
			},
			{
				s: '.Spalla .banner300x100:eq(0)',
				v: 'rai_home^rai_home_ ros_ 3_1_rect_var^300x100',
				t: '',
				hideEmpty: true
			}
		];
	reloadBannersOnNielsen = true;
	$(Banners.reloadAll);

	}
});

/* auto refresh */
if (typeof(refreshByJS) == 'undefined') {
	var refreshByJS = true;
}
function tryAutoRefresh() {
	var canRefresh = true;
	$('object,embed').each(function() {
		var res = 0;
		try {
			var res = this.Content.UniPlayerController.GetPlayerState();
		} catch (e) {
			res = 0; // l'object non e' il player unico :P
		}
		if (res != 0) {
			canRefresh = false;
		}
	});
	// if($('.ajaxwidget .editor').length > 0){
	if (/\/community\//.test(''+document.location)) {
		canRefresh = false;
	}
	try {
		console.log("tryAutoRefresh::canRefresh = "+canRefresh);
	} catch (e) {}

	if (refreshByJS && canRefresh) {
		var hash = '#'+(''+document.location.hash).replace(/^#/, '');
		if (hash == '#') {
			hash = '';
		}
		var search = '?'+(''+document.location.search).replace(/^\?/, '');
		if (search == '?') {
			search = '';
		}
		if (/\?./.test(search)) {
			if (!/refresh_ce/.test(search)) {
				search += '&refresh_ce';
			}
		} else {
			search += '?refresh_ce';
		}
		var href = document.location.protocol+'//'+document.location.hostname+(document.location.port!=''?':'+document.location.port:'')+document.location.pathname+search+hash;
		document.location.replace(href);
	}
}
function initAutoRefresh() {
	window.setInterval(tryAutoRefresh, 300000); // prova l'autorefresh ogni 5 minuti
}
$(initAutoRefresh);

reloadBannersOnNielsen = true;
