var currentHeight = 0;
var urlPageActualiteItool = "";
/*
function changeHauteur(h, id) {
	$j = jQuery.noConflict();
	currentHeight = Math.round(h);
	
	var windowHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		windowHeight = Math.round(window.innerHeight);
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		windowHeight = Math.round(document.documentElement.clientHeight);
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		windowHeight = Math.round(document.body.clientHeight);
	}
	
	if (Math.round(windowHeight) <= Math.round(h)) {
		h = Math.round(currentHeight) + 'px';
	} else {
		h = Math.round(windowHeight) + 'px';
	}
	
	if (h != null && document.getElementById('divFlash') && document.getElementById('objFlash')) {
		$j('#divFlash').css('height', h);
		$j('#objFlash').css('height', h);
	}
}*/

function changeHauteur(h) {
	
	$j = jQuery.noConflict();
	currentHeight = Math.round(h);
	
	if(h != null){
		$j('#divFlash').css('height', h);
		$j('#objFlash').css('height', h);
	}
	
}


function scrollToTop() {
	window.scroll(0,0);
}


// Gestion de l'ajax via DSL
function callDSL(urlDSL, urlItool) {
	
	if(urlItool != "" ){
	
		// On verifie que l'on ne se trouve pas sur la page du flash, auquelle cas on place le lien "entier" dans le menu pour les actualités
		// Sinon, on met juste l'ancre en tant qu'url
		var currentLocation = document.location.href;
		
		var reg = new RegExp("^"+urlItool+".*$", "i");
		if(currentLocation.match(reg)){
			urlPageActualiteItool = "";
		}
		else{
			urlPageActualiteItool = urlItool;
		}

		var DSLScript = document.createElement("script");
		DSLScript.src = urlDSL;
		DSLScript.type = "text/javascript";
		document.body.appendChild(DSLScript);
		
		
		
	}
	
}

// Callback de l'appel aux thematiques
function callbackDSL_Thematiques(tabValues){

	$j = jQuery.noConflict();
	
	var rayon = "";
	var libelleActus = "";
	var lienActus = "";

	for (var i=0; i<tabValues.length; i++){
		
		identifiantRayon = tabValues[i][0]; 
		
		for ( var j=0; j<tabValues[i][1].length; j++) {
			
			libelleActus = tabValues[i][1][j][0];
			lienActus = tabValues[i][1][j][1];
			
			if($j(".liste-famille-"+identifiantRayon)){
			
				var contenu = $j(".liste-famille-"+identifiantRayon).html() + "<li><a href='"+urlPageActualiteItool+lienActus+"'><span class='niveau1'>"+libelleActus+"</span></a></li>";
			
				$j(".liste-famille-"+identifiantRayon).html(contenu);
			
			}
			
		}
		
	}
	
	

}


// Partage sur twitter
function shareOnTwitter(pUrl, sTitle) {
	var targetUrl = 'http://twitter.com/share?text=' + encodeURIComponent(sTitle) + '&url=' + encodeURIComponent(pUrl);
	window.open(targetUrl, 'windowShareOnTwitter', 'height=626,height=436').focus();
}

// Partage sur facebook
function shareOnFacebook(pUrl, sTitle) {
	var targetUrl = 'http://www.facebook.com/sharer.php?t=' + encodeURIComponent(sTitle) + '&u=' + encodeURIComponent(pUrl);
	window.open(targetUrl, 'windowShareOnFacebook', 'height=626,height=436').focus();
}

function afficherSousMenu(id){
	if(document.getElementById(id)){
		document.getElementById(id).style.display = "block";
	}
}

function cacherSousMenu(id){
	if(document.getElementById(id)){
		document.getElementById(id).style.display = "none";
	}
}
