/**
 * Div permettant de savoir sur quel serveur on se trouve
 */
$(document).ready(function commonDivDevPreprodProd()
{
	var s = window.location.href;

	s.match(/^https?:\/\/([^\/]+)\//);
	var host = RegExp.$1;
	
	var bg_couleur = '';
	var txt = '';
	if(host.match(/dev.hi-media-techno.com$/))
	{ // Dev
		bg_couleur = '#77CCFF';
		txt = 'DEV';
	}
	else if(host.match(/preprod.hi-media-techno.com/))
	{ // Preprod
		bg_couleur = '#FFCC77';
		txt = 'PREPROD';
	}
	// si le host est différent d'un hi-mediaperformance.fr ou hi-mediaperformance.co.uk (exemple) un ou deux niveau ou de la régie chine, nous ne sommes pas en prod 
	else if(!host.match(/hi-mediaperformance\.[a-z]+(?:\.[a-z]+)?$/)  && host != 'www.hi-mediaperformance.test.hi-media-techno.com')
	{ // On n'est pas sur la prod
		// Local
		bg_couleur = '#77FF77';
		txt = 'LOCAL';
	}
	
	// nous avons été améné à rentre dans des cas nécessitant l'affichage d'un div d'informations
	if(bg_couleur != '' && txt != ''){
		// Affichage du bandeau
		$('body').prepend('<div id="div-host" style="background-color:'+bg_couleur+'; text-align:center; opacity:0.8; position:fixed; z-index:10000; top:0px; right:0px; width:150px; height:2em; display:table-cell; border:2px black solid;"><b>'+txt+'</b> <sup><a href="#" onclick="$(this).parent().parent().remove()">[X]</a></sup></div>');
	}
});
