function processBrightcove(imageId, videoId) {
	$.ajax({
		url : '/delegate/bcProxy/retrieveInfo.bcProxy?command=find_video_by_id&video_id=' + videoId + '&video_fields=thumbnailUrl',
		async : true,
		dataType: 'jsonp',
		success : function(data, textStatus, jqXHR) {
			$.each(data, function(item, value) {
				$("#" + imageId).html("<img src=\""+value+"\"></img>") ;
	        });

		},
		error:function (xhr, ajaxOptions, thrownError){
        }    
		
	}) ;
}

function getBrightcoveStillImageUrl(width, height, imageId, videoId) {
	$.ajax({
		url : '/delegate/bcProxy/retrieveInfo.bcProxy?command=find_video_by_id&video_id=' + videoId + '&video_fields=videoStillURL',
		async : true,
		dataType: 'jsonp',
		success : function(data, textStatus, jqXHR) {
			$.each(data, function(item, value) {
				$("#" + imageId).html("<img src=\"http://img.tcmwebcorp.com/" + width + "/" + height + "/" +value+"\"></img>") ;
	        });

		},
		error:function (xhr, ajaxOptions, thrownError){
			 alert(xhr.status);
             alert(thrownError);
        }    
		
	}) ;
}


/*
 * Solution temporaire pour faire fonctionner la top story, qui a besoin de la classe css top-stories-img pour son rendu.
 */
function processBrightcoveTopStories(imageId, videoId) {
	$.ajax({
		url : '/delegate/bcProxy/retrieveInfo.bcProxy?command=find_video_by_id&video_id=' + videoId + '&video_fields=thumbnailUrl',
		async : true,
		dataType: 'jsonp',
		success : function(data, textStatus, jqXHR) {
			$.each(data, function(item, value) {
				$("#" + imageId).html("<img class=\"top-stories-img\" src=\""+value+"\"></img>") ;
	        });

		},
		error:function (xhr, ajaxOptions, thrownError){
        }    
		
	}) ;
}

/*
 * Solution temporaire pour faire fonctionner la top story, qui a besoin de la classe css top-stories-img pour son rendu.
 */
function processBrightcoveStillImageTopStories(width, height, imageId, videoId) {
	$.ajax({
		url : '/delegate/bcProxy/retrieveInfo.bcProxy?command=find_video_by_id&video_id=' + videoId + '&video_fields=videoStillURL',
		async : true,
		dataType: 'jsonp',
		success : function(data, textStatus, jqXHR) {
			$.each(data, function(item, value) {
				$("#" + imageId).html("<img class=\"top-stories-img\" src=\"http://img.tcmwebcorp.com/" + width + "/" + height + "/" + value + "\"></img>") ;
	        });

		},
		error:function (xhr, ajaxOptions, thrownError){
        }    
		
	}) ;
}

function syncRoadBlock(adTag){
	if (document.getElementById('divContainingBanner') != null) 
		loadRBs('divContainingBanner', '100%', '100%', adTag.replace("sz=2000x2000", "sz=728x90,940x200"));
	if (document.getElementById('divContainingBigBox') != null) 
		loadRBs('divContainingBigBox', '300', '250', adTag.replace("sz=2000x2000", "sz=300x250").replace("tile=1","tile=2"));
    setTimeout("syncRoadBlock('"+adTag.replace(/(.*)(dc_seed=)([0-9]+)(;)(.*)/,"$1$5")+"')",30000);
}
 
function loadRBs(s, w, h, adTag){
    document.getElementById(s).innerHTML = '<iframe src="' + adTag + '" id="ifr_companion_' + s + '" width="' + w + '" height="' + h + '" marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no></iframe>';
}

