// 	On empeche le site d'être encapsulé dans une frame.
if (top != self) {
	top.location.href = location.href;
}

// 	INFOBULLE
//
// 	Exemple d'utilisation html :
//
//		<div id="bulle1" style="position:absolute; display:none; background:blue; border:1px black solid;">Ca fonctionne !</div>
//		<span onmousemove="move_infobulle('bulle',event);" onmouseout="close_infobulle('bulle');" onmouseover="show_infobulle('bulle',event);">Test infobulle</span>
//
	
var pos_x_souris=0;
var pos_y_souris=0;

// Quand la souris bouge, on récupère sa position
function get_position_souris(e){
		if ( !e ){
            e = window.event;
		}
        var scrollH = 0;	// scrollY
        var scrollW = 0;	// scrollX
        var windowH = 0;	// largeur de la fenetre
        var windowW = 0;	// hauteur de la fenetre        
        if (document.doctype == null || document.documentElement.clientHeight == 0){
			// IE -OU- pas de doctype
        	// window.innerWidth n'est definie que sous FF
        	// les deux paires d'egalites suivantes sont verifiees sous IE en absence 
        	// de doctype
        	if (window.innerWidth || (document.body.offsetHeight == document.documentElement.offsetHeight && document.body.offsetWidth == document.documentElement.offsetWidth)){
				// Firefox ou IE sans doctype -OU- IE avec doctype HTML 4.0
        		scrollH = document.body.scrollTop;
        		scrollW = document.body.scrollLeft;
        		windowH = document.body.clientHeight;
        		windowW = document.body.clientWidth;
        	}else{   
				// IE avec doctype XHTML 1.0
        		scrollH = document.documentElement.scrollTop;
        		scrollW = document.documentElement.scrollLeft;
        		windowH = document.documentElement.clientHeight;
        		windowW = document.documentElement.clientWidth;
        	}
        }else{   
			// Firefox
        	if (document.doctype.publicId.search(/xhtml/i) != -1){   
				// Firefox doctype XHTML 1.0
        		scrollH = document.documentElement.scrollTop;
        		scrollW = document.documentElement.scrollLeft;
        	}else{   
				// Firefox doctype HTML 4.0
        		scrollH = document.body.scrollTop;
        		scrollW = document.body.scrollLeft;
        	}
        }
        // FireFox
        if (window.innerWidth && window.innerHeight){
			windowH = window.innerHeight;
        	windowW = window.innerWidth;
        }
        var left;
        var top;
        if (navigator.appName!="Microsoft Internet Explorer") {
            left=e.pageX;
            top=e.pageY;
        }else{
            if(document.documentElement.clientWidth>0) {
                left=0+event.x+document.documentElement.scrollLeft;
                top=0+event.y+document.documentElement.scrollTop;
            }else{
                left=event.x+scrollW;
                top=event.y+scrollH;
            }
            
        }
		pos_x_souris=top;
		pos_y_souris=left;
}

// 	Gestion du déplacement de l'infobulle
function move_infobulle(id,event){
	get_position_souris(event);
    document.getElementById(id).style.top  = (pos_x_souris-10)+"px"; 
    document.getElementById(id).style.left = pos_y_souris+25+"px";	
}

//	Affiche l'infobulle
function show_infobulle(id,event,idlink,page){
	if(!page)page='commentaires';
	get_position_souris(event);	
	document.getElementById(id).style.position  = 'absolute';
    document.getElementById(id).style.top  = pos_x_souris+"px"; 
    document.getElementById(id).style.left = pos_y_souris+25+"px";		
	if(document.getElementById(id).style.visibility)document.getElementById(id).style.visibility = 'visible';
	else document.getElementById(id).style.display = 'block';
	
	var b=document.getElementById('bulle');
	b.innerHTML="Chargement...";
	XHR=new XHRConnection();
	XHR.setRefreshArea("bulle");
	XHR.sendAndLoad("index.php?page="+page+"&ajax=true&id_link="+idlink,"GET");
}

// 	Ferme l'infobulle
function close_infobulle(id){
	document.getElementById(id).style.visibility = 'hidden';
}

function getCat(id){
	XHR=new XHRConnection();
	XHR.setRefreshArea("categorie_form");
	var v=document.getElementById("categorie_form");
	v.innerHTML="Chargement...";
	XHR.sendAndLoad("index.php?page=edito&ajax=true&univ="+id.value,"GET");
} 

var oldv=null;
function show(id){
	var v=document.getElementById(id);
	if(v){
		if(v.style.display!='none')
			v.style.display = 'none';
		else v.style.display = 'block';
	}
	

	if(oldv){
		if(oldv.style.display!='none')
			oldv.style.display = 'none';
	}
	oldv=v;
}

