function loading() {
	nbInput = document.getElementsByTagName( 'input' ).length;
	nbTxtarea = document.getElementsByTagName( 'textarea' ).length;
	for ( j = 0; j < nbInput; j++ )
	{
		document.getElementsByTagName( 'input' )[j].id = j;
		element_input = document.getElementsByTagName( 'input' )[j];
		if ( element_input.type != "submit" && element_input.type != "radio" && element_input.type != "checkbox" && element_input.type != "image" && element_input.className != "readonly")
		{
			if ( element_input.className != "fieldText" )
			{	element_input.onfocus = function(){ inputFocus( this.id, "input" ) }
				element_input.onblur = function(){ inputBlur( this.id, "input" ) }
			}
		}
		else if ( element_input.className != "readonly" ) element_input.style.border = 0;
	}
	for ( x = 0; x < nbTxtarea; x++ )
	{
		document.getElementsByTagName( 'textarea' )[x].id = x;
		element_textarea = document.getElementsByTagName( 'textarea' )[x];
		
		element_textarea.onfocus = function(){ inputFocus( this.id, "textarea" ) }
		element_textarea.onblur = function(){ inputBlur( this.id, "textarea" ) }
	}
}

function inputFocus( numInput, field ) { document.getElementsByTagName( field )[ numInput ].className = 'inputFocus'; }

function inputBlur( numInput, field ) { document.getElementsByTagName( field )[ numInput ].className = ''; }

function openMenu( menu ) 
{
	string = "ss_"+menu;
	strImg = "img_ss_"+menu;
	if ( ssmenu = document.getElementById( string ).className != "themeOpened" )
	{
		ssmenu = document.getElementById( string ).className = "themeOpened";
		document.getElementById( strImg ).src = "/web/img/moins.gif";
	}
	else 
	{
		ssmenu = document.getElementById( string ).className = "themeClosed";
		document.getElementById( strImg ).src = "/web/img/shim.gif";
	}
}

function changeVideoPanel( panel )
{
	switch( panel )
	{	
		case "resume" :
			document.getElementById( 'cont_resume' ).style.display = 'block';
			document.getElementById( 'cont_comments' ).style.display = 'none';
			break;
		case "comments" :
			document.getElementById( 'cont_comments' ).style.display = 'block';
			document.getElementById( 'cont_resume' ).style.display = 'none';
			break;
	}
}

function getXhr(){
	if(window.XMLHttpRequest) // Firefox et autres
		xhr = new XMLHttpRequest(); 
	else if(window.ActiveXObject){ // Internet Explorer 
		try {
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xhr = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	else { // XMLHttpRequest non supporté par le navigateur 
	   xhr = false; 
	} 
}

function setPopup( url, name, popup_options ){ var Mypopup = window.open( url, name, popup_options ); }

function getInfos( infos, getElementById ){
	getXhr();
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4 && xhr.status == 200){
			displayInfos( xhr.responseText, getElementById );
		}
	}
	xhr.open( "GET", infos, true );
	xhr.send(null);
}

function displayInfos ( reponse, id )
{
	var divInfos = document.getElementById( id ) ;
	divInfos.style.display = 'block';
	divInfos.innerHTML = reponse ;
	loading();
	checkAcronym();
}

function showPopup( id ) { document.getElementById( id ).style.display = "block"; }

function closeErrorPopup( id ) { document.getElementById( id ).style.display = "none"; }

function hidePopup( id )
{	
	document.getElementById( id ).innerHTML = "";
	document.getElementById( id ).style.display = "none";
}

function setVote( note )
{
	for ( i = 1; i <= note; i++ )
	{
		document.getElementById( "img_vote_" + i ).src = "/web/img/vote-over.gif";	
	}
}

function clearVote() 
{
	for ( i = 1; i <= 10; i++ )
	{
		document.getElementById( "img_vote_" + i ).src = "/web/img/vote-off.gif";	
	}	
}

function validVote( note )
{
	for ( i = 1; i <= note; i++ )
	{
		document.getElementById( "img_vote_" + i ).src = "/web/img/vote-on.gif";	
	}
}