function getElementsByClass(balise, classe){
		var allTags = document.getElementsByTagName(balise);
		var arClass = new Array();
		for(var t=0; t<allTags.length;t++){
		    if(allTags[t].className.indexOf(classe) != -1){
				    arClass.push(allTags[t]);
				}
		}
		return arClass;
}
var isMSIE=navigator.userAgent.indexOf("MSIE")!=-1;
var iddiv;
var w;
var h;
var artwidth = 600;
function afficheNews(id){
        unes = getElementsByClass("div", "uneFF");
        //document.getElementById("titreColRight").innerHTML = "<?php //echo $catText ?>//";
        for(u = 0; u < unes.length; u++){

          unes[u].style.display = "none";
        }
        var articles = getElementsByClass("div", "articleJSFF");
	for(i = 0; i < articles.length; i++){
		//articles[i].style.top = "-1500px";
                articles[i].style.display = "none";
	}
        curArticle = document.getElementById(id);
        curArticle.style.display = "block";
        //curArticle.style.top = - getElementsByClass("div","tocJSFF")[0].offsetHeight + "px";
        curArticle.style.width = "0px";
        //curArticle.style.left = "400px";
        curArticle.style.height = "1px";
        iddiv = id;
        w = window["dim" + id][1];
        h = window["dim" + id][0];
        redimArticle();
}
function redimArticle(){
  curArticle = document.getElementById(iddiv);
  to = window.setTimeout("redimArticle()", 20);
  curArticle.style.color = "#FFFFFF";
  if(isMSIE){
    rate = 0.6;
  }else{
    rate = 0.7;
  }
  if(parseInt(curArticle.style.width) < window["dim" + iddiv][1] - (window["dim" + iddiv][1] * 0.01)){
      w *= rate * 0.7;
      curArticle.style.width =  (window["dim" + iddiv][1] - w) + "px";

  }else if(parseInt(curArticle.style.height) < window["dim" + iddiv][0] - (window["dim" + iddiv][0] * 0.01)){
      curArticle.style.width =  window["dim" + iddiv][1] + "px";
      h *= rate;
      curArticle.style.height =  (window["dim" + iddiv][0] - h) + "px";

  }else{
     curArticle.style.height =  (window["dim" + iddiv][0]) + "px";

     window.clearTimeout(to);
  }

}
var i = 0;
var linkTitle = document.getElementById("cle");
if(linkTitle == null){
	to = window.setTimeout('linkTitle = document.getElementById("cle")', 100);
}else{
	clearTimeout("to");
}

function toggleDisplay(id, idHide, lien){
	
	linkTitle.style.textDecoration = "none";
	document.getElementById(lien).style.textDecoration = "underline";
	linkTitle = document.getElementById(lien);
	
	
	document.getElementById(id).style.display="block";
	document.getElementById(idHide).style.display="none";
	
	/*document.getElementById(id + "Title").style.backgroundColor="#fff9af";
	document.getElementById(idHide + "Title").style.backgroundColor="#c6c073";
	document.getElementById(id + "Title").style.margin="0px";
	document.getElementById(idHide + "Title").style.marginBottom="2px";
	document.getElementById(id + "Title").style.backgroundImage = "url('img/post-it_title_underline.gif')";
	document.getElementById(idHide + "Title").style.backgroundImage = "none"; 
	document.getElementById(id + "Title").style.backgroundPosition = "bottom center";
	document.getElementById(id + "Title").style.fontWeight="bold";
	document.getElementById(idHide + "Title").style.fontWeight="normal"; */
}
function imgOptions(id){
	largeImages = getElementsByClass("div", "largeImage");
	for(l = 0; l < largeImages.length; l++){
		largeImages[l].style.display = "none";
    }
	document.getElementById(id).style.display = "block";
}
function hideImage(id){
	document.getElementById(id).style.display = "none";
}
function toggleSize(id){
	it = document.getElementById("r" + id);
//	pgraphes = document.getElementById("c" + id).getElementsByTagName("p");
	pg = document.getElementById("c" + id).childNodes.item(1).childNodes;
	pgraphes = new Array();
	for(i = 0; i < pg.length; i++){
		//alert('<!--' + pg.item(i).innerHTML + '-->');
		if(pg.item(i).tagName == "P" || pg.item(i).tagName == "UL"){
			pgraphes.push(pg.item(i));
		}
	}
	if(pgraphes.length > 1){
		for(i = 0; i < pgraphes.length; i++){
			if(!isMSIE){
				if(i > 0 && pgraphes[i].style.display == "none"){
					pgraphes[i].style.display = "block";
					it.innerHTML = "<img src=\"img/news-less.gif\" style=\"padding:0; padding-right:3px;\"/>";
				}else if(i > 0){
					pgraphes[i].style.display = "none";
					it.innerHTML = "<img src=\"http://www.ulb.ac.be/design/img/news-more.gif\" style=\"padding:0; padding-right:3px;\"/>Lire la suite...";
				}
				
			}else{
				if(i > 0 && pgraphes[i].style.display == "none"){
					pgraphes[i].style.display = "block";
					it.innerHTML = "<img src=\"img/news-less.gif\" style=\"padding:0; padding-right:3px;\"/>";
				}else if(i > 0){
					pgraphes[i].style.display = "none";
					it.innerHTML = "<img src=\"http://www.ulb.ac.be/design/img/news-more.gif\" style=\"padding:0; padding-right:3px;\"/>Lire la suite...";
				}
			}
		}
	}
	/*if(document.getElementById(id).style.overflow == "hidden"){
		document.getElementById(id).style.overflow = "visible";
		document.getElementById(id).style.height = "";
	}else{
		document.getElementById(id).style.overflow = "hidden";
		document.getElementById(id).style.height = "85px";
	}*/
}
/*var booksArray;
var v = 85;
var b = 0;
var opacite;
var vto;
var ind;
var grow = true;*/
function getInd(){
	ind = document.getElementById("ind");
}
function Slide(id){
	if ( typeof this.v == 'undefined' ) {
		this.id = id;
        this.booksArray;
		this.v = 85;
		this.b = 0;
		this.opacite;
		this.vto = -1;
    }
	this.vague = vague;
	this.vover = vover;
	this.getBooks = getBooks;
	this.placeBooks = placeBooks;
}
function vague(){
	bnext = this.b + 1;
	if(this.b == this.booksArray.length - 1) bnext = 0;
	this.booksArray[this.b].style.display = "block";
	
	this.booksArray[bnext].style.display = "block";
	
	this.v += 5;
	v2 = this.v + 180;
	rad = this.v*(Math.PI/180);
	this.opacite = Math.round((Math.sin(rad)) * 1000) / 1000;
	rad2 = v2*(Math.PI/180);
	opacite2 = Math.round((Math.sin(rad2)) * 1000) / 1000;
	//ind.innerHTML = v2;
	if(isMSIE){
		
			this.booksArray[this.b].style.filter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + Math.round((this.opacite + .5)*100) + ")";
			this.booksArray[this.b].style.zIndex = 1 + Math.round(this.opacite);
			this.booksArray[bnext].style.filter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + Math.round((opacite2 + .5)*100) + ")";
			this.booksArray[bnext].style.zIndex = 1 + Math.round(opacite2);
			
			
	}else{
		
			this.booksArray[this.b].style.opacity = "" + (this.opacite + .5);
			this.booksArray[this.b].style.zIndex = 1 + Math.round(this.opacite);
			this.booksArray[bnext].style.opacity = "" + (opacite2 + .5);
			this.booksArray[bnext].style.zIndex = 1 + Math.round(opacite2);
	}	
	if(this.v == 270){
		this.booksArray[this.b].style.display = "none";
		
		this.b++;
		
		if(this.b == this.booksArray.length) this.b = 0;
		this.v = 90;
	}
	if(this.v == 360){
		
		this.v = 0;
	}
	if(this.v == 90){
		/*if(isMSIE){
			if(this.booksArray[bnext].style.zIndex <= 1){
				//onmouseout="slide1.vover(0, this, 'slide1');" onmouseover="slide1.vover(1, this, 'slide1');"
				this.booksArray[bnext].setAttribute("onmouseover", "");
				this.booksArray[bnext].setAttribute("onmouseout", "");
			}else{
				this.booksArray[bnext].setAttribute("onmouseover", this.id + ".vover(1, this, '" + this.id + "');");
				this.booksArray[bnext].setAttribute("onmouseout", this.id + ".vover(1, this, '" + this.id + "');");
			}
		}*/
		this.vto = setTimeout(this.id + '.vague()', 4000);
		
	}else{
		this.vto = setTimeout(this.id + '.vague()', 50);
	}
}

function vover(on, element, slide){
	
	/*if(isMSIE){
		children = element.childNodes[0].childNodes;
	}else{
		children = element.childNodes.item(0).childNodes;
	}
	for(i in children){
		if(children[i].className == "auteur") auteur = children[i];
	}*/
	if(this.booksArray.length != 1){
		if(on == 1){
			
			if(this.b != 0){
				//this.booksArray[this.b - 1].style.display = "none";//alert(element.previousSibling.innerHTML);	
			}else{
				//this.booksArray[this.booksArray.length - 1].style.display = "none";//alert(this.booksArray[this.booksArray.length - 1].innerHTML);	
			}
			
			/*if(this.v <= 180){
				this.v = 90;
				
			}else{
				this.v = 270;
			}*/
			if(isMSIE){
				element.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
			}else{
				element.style.opacity = "1";
			}
			//auteur.style.display = "block";
			
			clearTimeout(this.vto);
		}else{
			//auteur.style.display = "none";
			
			this.vto = setTimeout(this.id + '.vague()', 50);
		}
	}
}
function getBooks(className){
	this.booksArray = getElementsByClass("div",className);
	//this.placeBooks(this.booksArray);
	if(this.booksArray.length == 1){
		this.booksArray[0].style.display = "block";
		if(isMSIE){
			this.booksArray[0].style.filter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
		}else{
			this.booksArray[0].style.opacity = "1";
		}
	}else{
		this.vague();
	}
}
function placeBooks(elements){
	for(i = 0; i < elements.length; i++){	
		
	}
}
/*function setContent(id){
	var news = document.getElementById("news");
	var block = document.getElementsByTagName("div");
}*/
function getG(objq,adresse){
	
	var ScrollTop = document.body.scrollTop;
	if (ScrollTop == 0)
	{
		if (window.pageYOffset)
			ScrollTop = window.pageYOffset;
		else
			ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
	}
	galleryContainer = document.createElement("div");
	galleryContainer.style.backgroundColor = "#000";
	galleryContainer.style.position = "absolute";
	galleryContainer.style.width = "100%";
	galleryContainer.style.height = "100%";
	/**/galleryContainer.style.left = "0px";
	galleryContainer.style.top = ScrollTop + "px";
	galleryContainer.style.zIndex = "101";
	galleryContainer.setAttribute("id", "galleryContainer");
	//document.getElementById("lightbox").style.display = "block";
	//alert(adresse);
	/*objq.ajax({
	  url: adresse,
	  success: function(data) {
		galleryContainer.innerHTML=$('.result').html(data);
		document.body.appendChild(galleryContainer);
	  }
	});
	*/if (window.XMLHttpRequest){
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
		//alert(xmlhttp.readyState);
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			
			galleryContainer.innerHTML=xmlhttp.responseText;
//			galleryContainer.src=url;
			document.body.appendChild(galleryContainer);

/*for(i = 0; i < document.styleSheets[6].cssRules.length;i++){
	alert(document.styleSheets[6].cssRules[i]);
}*/
		}
	}
	xmlhttp.open("GET",adresse,true);
	xmlhttp.send();
}
