

	function showDIV( nom , id , total )
	{
	
		for( i = 1; i <= total; i ++ )
		{
		
			document.getElementById( nom + i ).style.display = 'none' ;
		
		}
		
		document.getElementById( nom + id ).style.display = 'block' ;
	
	}
	
	function popup( url, height, width )
	{
		var winl = (screen.width - width ) / 2;
		var wint = (screen.height - height ) / 2;
	
		window.open( url, 'POPUP', "top="+wint+", left="+winl+", height="+ height +", width="+width+", menubar=no, resizable=no, scroolbars=no, status=no, toolbar=no" );
	}
	
	function newQuery()
	{
			
		 if ( window.XMLHttpRequest )
		 {
		 
            httpRequest = new XMLHttpRequest();
			
            if ( httpRequest.overrideMimeType )
			{
			
                httpRequest.overrideMimeType( 'text/xml' ) ;
				
            }
		
        }
        else if ( window.ActiveXObject )
		{
		
            try
			{
			
                httpRequest = new ActiveXObject( "Msxml2.XMLHTTP" ) ;
			
            }
            catch (e)
			{
			
                try
				{
                    httpRequest = new ActiveXObject( "Microsoft.XMLHTTP" ) ;
                }
				
                catch (e) {}
				
            }
		
        }

        if ( ! httpRequest )
		{
         
			alert( 'Abandon :( Impossible de créer une instance XMLHTTP' ) ;
			return false;
        
		}
		else
		{
		
			return httpRequest ;
		
		}
	
	}
	
	function noter( note , id , user_id )
	{
	
		var request = newQuery() ;
		
		document.getElementById( 'etoile-vote' ).style.display 	    = 'none' ;
		document.getElementById( 'chargement-vote' ).style.display 	= 'inline' ;
		
		request.open( "GET", "/plug-in/vote.php?note=" + note + "&user_id=" + user_id + "&id=" + id , true );
		
		request.onreadystatechange = function()
		{
		
			if ( request.readyState == 4 )
			{
			
				if ( request.status == 200 )
				{
				
					var xmlFile  = request.responseXML ;
					var retour   = xmlFile.getElementsByTagName("retour")[0].firstChild.data ;
					var message  = xmlFile.getElementsByTagName("message")[0].firstChild.data ;
					
					document.getElementById( 'chargement-vote' ).style.display 	= 'none' ;
					document.getElementById( 'msg-vote' ).style.display 		= 'inline' ;
					document.getElementById( 'msg-vote' ).innerHTML 			= message ;
					
				}
				else
				{
				
					// alert("PB 200") ;
					document.getElementById( 'chargement-vote' ).style.display 	= 'none' ;
					document.getElementById( 'msg-vote' ).style.display 		= 'inline' ;
					document.getElementById( 'msg-vote' ).innerHTML 			= 'Echec du vote!' ;
				
				}
			
			}
			else
			{
			
				document.getElementById( 'etoile-vote' ).style.display 	    = 'none' ;
				document.getElementById( 'chargement-vote' ).style.display 	= 'inline' ;
			
			}
		
		};
		
		request.send( null ) ;
		
	}
	
	function redirect( page )
	{
		document.location.href = page ;
	}