   var http_request = false;

	function closeSB () {
		document.getElementById('SoundBox').innerHTML = '';
		document.getElementById('SoundBox').style.visibility = 'hidden';
	}

	function updateSB () {
		if ( document.getElementById('SoundBox').innerHTML != '' ) {
			var bogus_e;
			makeGETSBRequest('yes',bogus_e);
		}
	}

	// Affichage du popup
	function makeGETSBRequest(updateSB, e) {

      http_request = getXMLHttpObj();
	  if (!http_request) {
         alert('Votre fureteur ne supporte pas Ajax. Vous ne pourrez vous servir de cette application.');
         return false;
	  }
	  url = 'includes/soundbox.php';
	  sid=Math.random();

	  if ( updateSB != 'yes' ) {
		  posx = 0;
	      posy = 0;
		  mouseXandY(e);
		  
		  //document.getElementById('SoundBox').style.left = (posx-450)+'px';
		  document.getElementById('SoundBox').style.left = (824-450)+'px';
          document.getElementById('SoundBox').style.top = '0px';
		  //document.getElementById('SoundBox').style.height = '500px';
	  }

      http_request.onreadystatechange = stateChangedSB;
	  http_request.open('GET', url+"?sid="+sid, true);
      http_request.send(null);
   }
   
   function stateChangedSB() {

      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            result = http_request.responseText;
            document.getElementById('SoundBox').innerHTML = result;
			document.getElementById('SoundBox').style.visibility = 'visible';
         } else {
            alert('Une erreur systeme est survenue lors du chargement du lecteur media.');
         }
      }
   }
   
   // Créer l'objet XMLHttpRequest
	function getXMLHttpObj() {
	   
		if (window.XMLHttpRequest) { // Mozilla, Safari,...
        	http_request = new XMLHttpRequest();
         	if (http_request.overrideMimeType) {
         		// set type accordingly to anticipated content type
            	//http_request.overrideMimeType('text/xml');
            	http_request.overrideMimeType('text/html');
         	}
		} else if (window.ActiveXObject) { // IE
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
         	} catch (e) {
            	try {
               		http_request = new ActiveXObject("Microsoft.XMLHTTP");
            	} catch (e) {}
         	}
      	}
		
		return http_request;
	}