window.onload=init;

function init(){
	color_fields();
	document.getElementById('artistes').onmouseover=function(){
		if(this.nextSibling.style.display!="block"){
			this.nextSibling.style.display="block";
		}
	}
	document.getElementById('artistes').onmouseout=function(){
			if(this.nextSibling.style.display!="none"){
				this.nextSibling.style.display="none";
			}
	}
	var sub=document.getElementById('artistes').nextSibling;
	
		sub.onmouseout=function(){
			this.style.display="none";
		}
		sub.onmouseover=function(){
				this.style.display="block";
		}
	
	/*var sub=document.getElementById('artistes').nextSibling.getElementsByTagName('a');
	for(i=0;i<sub.length;i++){
		sub[i].onmouseout=function(){
			this.parentNode.parentNode.style.display="none";
		}
		sub[i].onmouseover=function(){
				this.parentNode.parentNode.style.display="block";
		}
	}*/
	if(document.getElementById('email')){
		document.getElementById('email').onfocus=function(){
			this.value="";
			this.style.background="#fff";
		}
	}
	if(document.getElementById('id_artiste')){
		document.getElementById('id_artiste').onchange=function(){
			document.getElementById('choix_artistes').submit();
		}
		
	}
	if(document.getElementById('view_supp')){
		document.getElementById('view_supp').onclick=function(){
			if(document.getElementById('blog_supp').style.display!="block"){
				document.getElementById('blog_supp').style.display="block";
			}
			else{
				document.getElementById('blog_supp').style.display="none";
			}
			return false;
		}
		
	}
	
	if(document.getElementById('articles_plus')){
		document.getElementById('articles_plus').onclick=function(){
			var li=document.getElementById('articles_presse').getElementsByTagName('LI');
			for(i=0;i<li.length;i++){
				if(li[i].className=="articles_supp"){
					if(li[i].style.display!="block"){
						li[i].style.display="block";
					}
					else{
						li[i].style.display="none";
					}
				}
			}
			return false;
		}
	}
	if(document.getElementById('previous')){
		document.getElementById('previous').onclick=previous;
		document.getElementById('next').onclick=next;
	}
	
}
var diapos=new Array();
var actual;
function callDiaporama(id){
	sendRequest('GET','index.php?mdl=artistes&id_diaporama='+id,writeDiaporama);
}

function writeDiaporama(xhr){
	var result=cleanXML(xhr.responseXML);
	var imgs=result.getElementsByTagName('img');
	for(i=0;i<imgs.length;i++){
		diapos[i]=imgs[i].getAttribute('src');
	}
	document.getElementById('actual').setAttribute('src',diapos[0]);
	actual=0;
	document.getElementById('flash_diaporama').style.display="block";
}
function previous(){
	if(actual==0){
		document.getElementById('actual').setAttribute('src',diapos[(diapos.length-1)]);
		actual=diapos.length-1;
	}
	else{
		document.getElementById('actual').setAttribute('src',diapos[actual-1]);
		actual--;
	}
	return false;
}
function next(){
	if(actual==(diapos.length-1)){
		document.getElementById('actual').setAttribute('src',diapos[0]);
		actual=0;
	}
	else{
		document.getElementById('actual').setAttribute('src',diapos[actual+1]);
		actual++;
	}
	return false;
}
function sendEvent(typ,prm) {
	thisMovie("mediaplayer").sendEvent(typ,prm);
}
function loadFile(fil) {
	thisMovie("mediaplayer").loadFile(fil);
}
function thisMovie(movieName) {
		if(navigator.appName.indexOf("Microsoft") != -1) {
			return window[movieName];
		} else {
			return document[movieName];
		}
}
	/*function getUpdate(typ,pr1,pr2) {
		var id = document.getElementById(typ);
		id.innerHTML = typ+ ": "+Math.round(pr1);
		pr2 == undefined ? null: id.innerHTML += ", "+Math.round(pr2);
	};
	function itemData(obj) {
		var nodes = "";
		for(var i in obj) { 
			nodes += "<li>"+i+": "+obj[i]+"</li>"; 
		}
		document.getElementById("data").innerHTML = nodes;
	};*/



