document.observe("dom:loaded", function() {
	  // initially hide all containers for tab content
	 var mustLaunch = 0;
	 var mustLaunchFlash = 0;
	 var mustLaunchVideo = 0;
	 var bHref = true;
	  var ForceParams = new Array();
	  
	  theDate =new Date();
	 //Crack the Code 08/06/2009
	  
	  //Transforme la date en yyyymmdd et en INT
	  var iDate =  parseInt(theDate.getFullYear() * 10000 + ((theDate.getMonth()+1)*100) + theDate.getDate()) ;
	  if ((document.location.href=='http://dev.virgin17.fr/' || document.location.href=='http://www.virgin17.fr/' || document.location.href=='http://test.virgin17.fr/')
		&& (iDate >= 20090622 && iDate < 20090722)
	  ) {
		  
		  backgrounColor = '#000000';
		  habillageImageUrl = '/design/virgin17/images/habillage/eightiesawards/fond-virgin17_DEF.jpg';
		  habillageUrl = 'http://eightiesawards.virgin17.fr/';
		  habillageTitle = 'Eighties Awards';
		  decalageHaut = '75px';
		  mustLaunch = 1;
	  }
	  
	  
	  var iDate =  parseInt(theDate.getFullYear() * 10000 + ((theDate.getMonth()+1)*100) + theDate.getDate()) ;
	  if ((document.location.href=='http://dev.virgin17.fr/' || document.location.href=='http://www.virgin17.fr/' || document.location.href=='http://test.virgin17.fr/')
		&& (iDate > 20090701 && iDate < 20090707)
	  ) {
		  backgrounColor = '#000000';
		  habillageImageUrl = 'http://video.premiere.fr/musique/pub/mainsquare/main_square_v17.jpg';
		  habillageUrl = 'http://www.virginradio.fr/festival/main-square-festival';
		  habillageTitle = 'Main Square Festival';
		  decalageHaut = '10px';
		  mustLaunch = 1;
	  }
	  
	  
	  if ((document.location.href=='http://dev.virgin17.fr/' || document.location.href=='http://www.virgin17.fr/' || document.location.href=='http://test.virgin17.fr/')
				&& (iDate > 20090706 && iDate < 20090708)
			  ) {
		  backgrounColor = '#000000';
		  habillageImageUrl = 'http://video.premiere.fr/musique/pub/michael_jackson/fd_v17_mj.jpg';
		  habillageUrl = 'http://www.virgin17.fr/Evenements/Dossiers-speciaux/Hommage-a-Michael-Jackson';
		  habillageTitle = 'Michael Jackson';
		  decalageHaut = '75px';
		  mustLaunch = 1;
		  
		  
	  }
	  
	  
	  
	   if ((document.location.href=='http://dev.virgin17.fr/' || document.location.href=='http://www.virgin17.fr/' || document.location.href=='http://test.virgin17.fr/')
				&& (iDate == 20090914 || iDate == 20090915)
	  ) {
		  backgrounColor = '#990000';
		  habillageImageUrl = 'http://video.premiere.fr/premiere/publicite/habillage/popjob/hab%20V17/fond.jpg';
		  FlashLeftUrl = 'http://video.premiere.fr/premiere/publicite/habillage/popjob/hab%20V17/habillage_G_100x700.swf';
		  FlashTopUrl = 'http://video.premiere.fr/premiere/publicite/habillage/popjob/hab%20V17/habillage_centre_1010x130.swf';
		  FlashRightUrl = 'http://video.premiere.fr/premiere/publicite/habillage/popjob/hab%20V17/habillage_D_100x700.swf';
		  habillageTitle = 'Pop Job';
		  mustLaunchFlash = 1;
	  }

		if ((document.location.href=='http://dev.virgin17.fr/' || document.location.href=='http://www.virgin17.fr/' || document.location.href=='http://test.virgin17.fr/')
				&& (iDate == 20090917 || iDate == 20090918)
	  ) {
		  backgrounColor = '#000000';
		  habillageImageUrl = 'http://video.premiere.fr/premiere/publicite/habillage/Next/hab_V17/fond.jpg';
		  FlashLeftUrl = 'http://video.premiere.fr/premiere/publicite/habillage/Next/hab_V17/habillage_G_100x700.swf';
		  FlashTopUrl = 'http://video.premiere.fr/premiere/publicite/habillage/Next/hab_V17/habillage_centre_1010x130.swf';
		  FlashRightUrl = 'http://video.premiere.fr/premiere/publicite/habillage/Next/hab_V17/habillage_D_100x700.swf';
		  habillageTitle = 'Next Made in France';
		  mustLaunchFlash = 1;
	  }
	  
	  if ((document.location.href=='http://dev.virgin17.fr/' || document.location.href=='http://www.virgin17.fr/' || document.location.href=='http://test.virgin17.fr/')
				&& (iDate == 20090916 || iDate == 20090923)
	  ) {
		  backgrounColor = '#000000';
		  habillageImageUrl = 'http://video.premiere.fr/premiere/publicite/habillage/Op%20Guitar%20hero_VR/hab%20V17/hab_guitarheroV_V17.jpg';
		  FlashLeftUrl = 'http://video.premiere.fr/premiere/publicite/habillage/Op%20Guitar%20hero_VR/hab%20V17/left_GH5_v17.swf';
		  FlashTopUrl = 'http://video.premiere.fr/premiere/publicite/habillage/Op%20Guitar%20hero_VR/hab%20V17/top_GH5_v17.swf';
		  FlashRightUrl = 'http://video.premiere.fr/premiere/publicite/habillage/Op%20Guitar%20hero_VR/hab%20V17/right_GH5_v17.swf';
		  habillageTitle = 'Guitar Hero 5';
		  mustLaunchFlash = 1;
	  }
	  
	  if ((document.location.href=='http://dev.virgin17.fr/' || document.location.href=='http://www.virgin17.fr/' || document.location.href=='http://test.virgin17.fr/')
				&& (iDate == 20090930 || iDate == 20091001 || iDate == 20091008)
	  ) {
		  backgrounColor = '#000000';
		  habillageImageUrl = 'http://video.premiere.fr/premiere/publicite/habillage/Baffie/fond.jpg';
		  FlashLeftUrl = 'http://video.premiere.fr/premiere/publicite/habillage/Baffie/habillage_G_100x700.swf';
		  FlashTopUrl = 'http://video.premiere.fr/premiere/publicite/habillage/Baffie/habillage_centre_1010x130.swf';
		  FlashRightUrl = 'http://video.premiere.fr/premiere/publicite/habillage/Baffie/habillage_D_100x700.swf';
		  habillageTitle = 'Baffie !';
		  mustLaunchFlash = 1;
	  }
	  
	  if (
			 (document.location.href=='http://dev.virgin17.fr/' || document.location.href=='http://www.virgin17.fr/' || document.location.href=='http://test.virgin17.fr/')
			  && (iDate == 20091109 || iDate == 20091111 || iDate == 20091118)
	  ) {
		  backgrounColor = '#000000';
		  habillageImageUrl = 'http://video.premiere.fr/premiere/publicite/habillage/IleDeLaTentation/V17_habillage_idt.jpg';
		  FlashUrl = 'http://video.premiere.fr/premiere/publicite/habillage/IleDeLaTentation/iledelatentation2.swf';
		  RedirUrl = 'http://ile-de-la-tentation.premiere.fr/';
		  
		  habillageTitle = 'Ile de la Tentation';
		  mustLaunchVideo = 1;
	  }
	  
	  if (
			 (document.location.href=='http://dev.virgin17.fr/' || document.location.href=='http://www.virgin17.fr/' || document.location.href=='http://test.virgin17.fr/')
			  && (iDate == 20091206 || iDate == 20091209 || iDate == 20091215 || iDate == 20091216)
	  ) {
		  backgrounColor = '#5C0101';
		  //habillageImageUrl = 'http://video.premiere.fr/premiere/publicite/habillage/V17_ChanteSiTuPeux/fd_chantesitupeux.jpg';
		  habillageImageUrl = 'http://video.premiere.fr/premiere/publicite/habillage/V17_ChanteSiTuPeux/habillage_V17_chantesitupeux16.jpg';
		  FlashUrl = 'http://video.premiere.fr/premiere/publicite/habillage/V17_ChanteSiTuPeux/video_chante_hab.swf';
		  RedirUrl = 'http://www.virgin17.fr/Programmes/Emissions-Series/Chante-si-tu-peux';
		  
		  ForceParams = new Array();
		  ForceParams['width'] = 282;
		  ForceParams['height'] = 172;
		  ForceParams['top'] = -116;
		  ForceParams['left'] = 700;
		  
		  habillageTitle = 'Chante... si tu peux !';
		  mustLaunchVideo = 1;
	  }
	  
	  if (
				 (document.location.href=='http://dev.virgin17.fr/' || document.location.href=='http://www.virgin17.fr/' || document.location.href=='http://test.virgin17.fr/')
				  && (iDate == 20100126 || iDate == 20100127 || iDate == 20100128 )
		  ) {
		  backgrounColor = '#000000';
		  //habillageImageUrl = 'http://video.premiere.fr/premiere/publicite/habillage/V17_ChanteSiTuPeux/fd_chantesitupeux.jpg';
		  var habillageImageUrl = 'http://video.premiere.fr/premiere/publicite/habillage/V17_24h_chrono/fond_24h.jpg';
		  var FlashUrl = 'http://video.premiere.fr/premiere/publicite/habillage/V17_24h_chrono/24H_994x245.swf';
		  var RedirUrl = 'http://www.virgin17.fr/Programmes/Emissions-Series/Serie-24h ';
		
		
		  ForceParams['width'] = '994';
		ForceParams['height'] = '245';
		ForceParams['top'] = '-130';
		ForceParams['left'] = '0';
		ForceParams['zIndex'] = '0';
		
		bHref = false;
		  
		  habillageTitle = '24H Chrono sur Virgin 17';
		  mustLaunchVideo = 1;
	  }
	  
	  if ((document.location.href=='http://dev.virgin17.fr/' || document.location.href=='http://www.virgin17.fr/' || document.location.href=='http://test.virgin17.fr/')
				&& (iDate == 20100227 || iDate == 20100228)
			  ) {
		  backgrounColor = '#000000';
		  habillageImageUrl = 'http://video.premiere.fr/premiere/publicite/habillage/V17/BwinPoker/Habillage_Bwin_Foot_Virgin17.jpg';
		  habillageUrl = 'https://adserver.itsfogo.com/click.aspx?zoneid=76994';
		  habillageTitle = 'Pariez sur le match PSG / OM';
		  decalageHaut = '100px';
		  mustLaunch = 1;
	  }
	  
	  if (
				 (document.location.href=='http://dev.virgin17.fr/' || document.location.href=='http://www.virgin17.fr/' || document.location.href=='http://test.virgin17.fr/')
				  && (iDate == 20100308 || iDate == 20100309 || iDate == 20100310 )
		  ) {
		  backgrounColor = '#000000';
		  //habillageImageUrl = 'http://video.premiere.fr/premiere/publicite/habillage/V17_ChanteSiTuPeux/fd_chantesitupeux.jpg';
		  var habillageImageUrl = 'http://video.premiere.fr/thotnet/Autopromo/Virgin17/les_stars_chantent/habillage_V17_MJ.jpg';
		  var FlashUrl = 'http://video.premiere.fr/thotnet/Autopromo/Virgin17/les_stars_chantent/video_starsMJ_300x186.swf';
		  var RedirUrl = 'http://www.virgin17.fr/Programmes/Emissions-Series/Les-stars-chantent-Michael-Jackson';
		
		
		  ForceParams['width'] = '300';
		ForceParams['height'] = '186';
		ForceParams['top'] = '-93';
		ForceParams['left'] = '694';
		ForceParams['zIndex'] = '0';
		
		bHref = true;
		  
		  habillageTitle = 'Les stars chantent Mickael Jackson';
		  mustLaunchVideo = 1;
	  }
	  
	  
	  if (mustLaunch == 1) {
		 
		 
		  launchHabillage( backgrounColor, habillageImageUrl, habillageUrl, habillageTitle, decalageHaut);
	  }
	  
	   
	  if (mustLaunchFlash == 1) {
		  launchHabillageFlash( backgrounColor, habillageImageUrl, FlashLeftUrl, FlashTopUrl, FlashRightUrl, habillageTitle);
	  }
	  
	  if (mustLaunchVideo == 1) {
		  launchHabillageVideo(  backgrounColor, habillageImageUrl, FlashUrl, habillageTitle, RedirUrl, ForceParams, bHref);
	  }
	  
	});

function launchHabillage( backgrounColor, habillageImageUrl, habillageUrl, habillageTitle, decalageHaut) {
	
	
	
//	stylePub = document.createElement('style');
//	stylePub.appendChild(document.createTextNode('body{background: ' + backgrounColor + ' url(' + habillageImageUrl + ') no-repeat top center; margin: 149px 0 0 0;}'));
	  
	document.body.style.background=backgrounColor + ' url(' + habillageImageUrl + ') no-repeat top center';
	document.body.style.margin = decalageHaut + ' 0 0 0';
	
	
	
//	document.getElementsByTagName('head')[0].appendChild(stylePub);
	  
	  
	  divPub = document.createElement('div');
	  //divPub.setAttribute('style', 'position: absolute;	width: 998px; height: 209px; top: -175px; left: -10px;');
	  divPub.style.position = 'absolute';
	  divPub.style.width = '998px';
	  divPub.style.height = '160px';
	  divPub.style.top = '-75px';
	  divPub.style.left = '-10px';
	  divPub.style.zIndex = '999';
	  aPub = document.createElement('a');
	  aPub.setAttribute('href', habillageUrl);
	  aPub.setAttribute('title', habillageTitle);
	  aPub.style.height = '160px';
	  aPub.style.position = 'absolute';
	  
	  imgPub = document.createElement('img');
	  imgPub.setAttribute('src', '/design/virginradio/images/pixtrans.gif');
	  imgPub.setAttribute('width', '998');
	  imgPub.setAttribute('height', '160');
	  
	  aPub.appendChild(imgPub);
	  divPub.appendChild(aPub);
	  //div.style = 'position: absolute;	width: 998px; height: 209px; top: -175px; left: -10px;';
	  document.getElementById('container').insertBefore(divPub, document.getElementById('container').firstChild);
	  
	  document.getElementById('megabanner').innerHTML = '';
	  document.getElementById('megabanner').style.display = 'none';
	  
}


function launchHabillageVideo(  backgrounColor, habillageImageUrl, FlashUrl, habillageTitle, RedirUrl, ForceParams, bHref) {
	document.body.style.background=backgrounColor + ' url(' + habillageImageUrl + ') no-repeat top center';
	document.body.style.margin = '127px 0 0 0';
	
	 divPubTop = document.createElement('div');
	  //divPub.setAttribute('style', 'position: absolute;	width: 998px; height: 209px; top: -175px; left: -10px;');
	  divPubTop.id = 'flashPubTop';
	  divPubTop.name = 'flashPubTop';
	  //divPubTop.setAttribute('href', 'test.com');
	  divPubTop.style.position = 'absolute';
	  if(typeof ForceParams['width'] != 'undefined'){
		  divPubTop.style.width = ''+ForceParams['width']+'px';
	  }else{
		  divPubTop.style.width = '320px';
	  }
	  if(typeof ForceParams['height'] != 'undefined'){
		  divPubTop.style.height = ''+ForceParams['height']+'px';
	  }else{
		  divPubTop.style.height = '240px';
	  }
	  if(typeof ForceParams['top'] != 'undefined'){
		  divPubTop.style.top = ''+ForceParams['top']+'px';
	  }else{
		  divPubTop.style.top = '-150px';
	  }
	  if(typeof ForceParams['left'] != 'undefined'){
		  divPubTop.style.left = ''+ForceParams['left']+'px';
	  }else{
		  divPubTop.style.left = '672px';
	  }
	  //divPubTop.style.backgroundColor = 'red';
	  if(bHref == true){
		  aPub = document.createElement('a');
		  aPub.setAttribute('href', RedirUrl);
		  aPub.setAttribute('title', habillageTitle);
		  aPub.style.height = '237px';
		  aPub.style.width = '650px';
		  aPub.style.top = '-139px';
		  aPub.style.position = 'absolute';
		  aPub.style.zIndex = '5000';
	  
	  
	  
	  divA = document.createElement('a');
	  }
	  document.getElementById('container').insertBefore(divPubTop, document.getElementById('container').firstChild);
	  document.getElementById('megabanner').style.display ='none';
	  if(bHref == true){
		  document.getElementById('container').insertBefore(aPub, document.getElementById('container').firstChild);
	  }
	  
	  flashWidth = "320";
	  flashHeight = "240";
	  if(typeof ForceParams['width'] != 'undefined'){
		  flashWidth = ''+ForceParams['width']+'';
	  }
	  if(typeof ForceParams['height'] != 'undefined'){
		  flashHeight = ''+ForceParams['height']+'';
	  }
	  
	  var so = new SWFObject(FlashUrl, "flashPubVideo", flashWidth, flashHeight, "8", "");
	  so.addParam("wmode", "transparent");
	  so.addVariable("clickTag", RedirUrl);
	  so.write("flashPubTop");
	  
	  document.getElementById("flashPubTop").style.zIndex = '0';
	  
}

function launchHabillageFlash( backgrounColor, habillageImageUrl, flashLeftUrl, flashTopUrl, flashRightUrl, habillageTitle) {
	
//	stylePub = document.createElement('style');
//	stylePub.appendChild(document.createTextNode('body{background: ' + backgrounColor + ' url(' + habillageImageUrl + ') no-repeat top center; margin: 149px 0 0 0;}'));
	  
	document.body.style.background=backgrounColor + ' url(' + habillageImageUrl + ') no-repeat top center';
	document.body.style.margin = '80px 0 0 0';
	
	
	
//	document.getElementsByTagName('head')[0].appendChild(stylePub);
	  
	  
	  divPubTop = document.createElement('div');
	  //divPub.setAttribute('style', 'position: absolute;	width: 998px; height: 209px; top: -175px; left: -10px;');
	  divPubTop.id = 'flashPubTop';
	  divPubTop.name = 'flashPubTop';
	  divPubTop.style.position = 'absolute';
	  divPubTop.style.width = '1017px';
	  divPubTop.style.height = '133px';
	  divPubTop.style.top = '-80px';
	  divPubTop.style.left = '100px';
	  //divPubTop.style.backgroundColor = 'red';
	  
	  document.getElementById('container').insertBefore(divPubTop, document.getElementById('container').firstChild);
	  
	  
	  divPubLeft = document.createElement('div');
	  //divPub.setAttribute('style', 'position: absolute;	width: 998px; height: 209px; top: -175px; left: -10px;');
	  divPubLeft.id = 'flashPubLeft';
	  divPubLeft.name = 'flashPubLeft';
	  divPubLeft.style.position = 'absolute';
	  divPubLeft.style.width = '100px';
	  divPubLeft.style.height = '700px';
	  divPubLeft.style.top = '-50px';
	  divPubLeft.style.left = '-110px';
	 // divPubLeft.style.backgroundColor = 'green';
	  
	  document.getElementById('container').insertBefore(divPubLeft, document.getElementById('container').firstChild);
	  
	  
	  divPubRight = document.createElement('div');
	  divPubRight.id = 'flashPubRight';
	  divPubRight.name = 'flashPubRight';
	  divPubRight.style.position = 'absolute';
	  divPubRight.style.width = '100px';
	  divPubRight.style.height = '700px';
	  divPubRight.style.top = '-50px';
	  divPubRight.style.left = '1007px';
	 // divPubRight.style.backgroundColor = 'green';
	  
	  document.getElementById('container').insertBefore(divPubRight, document.getElementById('container').firstChild);
	  
	  
	  var so = new SWFObject(flashTopUrl, "flashPubLeft", "1017", "133", "8", "");
	  so.addParam("wmode", "transparent");
	  so.write("flashPubTop");
	   
	  var so = new SWFObject(flashLeftUrl, "flashPubLeft", "100", "700", "8", "");
	  so.addParam("wmode", "transparent");
	   so.write("flashPubLeft");
	   
	   var so = new SWFObject(flashRightUrl, "flashPubRight", "100", "700", "8", "");
	   so.addParam("wmode", "transparent");
	   so.write("flashPubRight");
	   
	    document.getElementById('megabanner').innerHTML = '';
	  document.getElementById('megabanner').style.display = 'none';
	   
}