function startRotation(jsonUrl,baseUrl,content,width,height) {

	if(window['timer_'+content] != undefined) {
		clearInterval(window['timer_'+content]);
	}
	
	$.getJSON(jsonUrl,
	        function(data){
				attacherBandeau(data,baseUrl,content,width,height);

				window['timer_'+content] = setInterval("startRotation('"+jsonUrl+"','"+baseUrl+"','"+content+"','"+width+"','"+height+"')",(Number(data['duration']) * 1000));
	        });

}

function attacherBandeau(data,baseUrl,content,width,height,clear)
{
	//bandeau de type image
	if(data['type'] == 'image') {
		var str = '<img src="'+data['src']+'">';

		if(data['url']) {
			str = str.replace(str,'<a href="'+data['url']+'">'+str+'</a>');
		}

		$('#'+content).html(str);
	} 
	
	//bandeau de type flash SWF
	else if(data['type'] == 'flash') {
		var rand = Math.random();
		$('#'+content).html('<div id="bandeauFlash'+rand+'" class="bandeauFlash">');
		var flashvars = {};
		var params = {menu: "false",wmode:"transparent"};
		var attributes = {};

		swfobject.embedSWF(data['src'], "bandeauFlash"+rand, width, height, "9.0.0",baseUrl+"/public/swf/expressInstall.swf", flashvars, params, attributes);					
	}

	if(clear == true && window['timer_'+content] != undefined) {
		clearInterval(window['timer_'+content]);
	}
}
