function doHttpRequest(idname,page,cellule ) {  // This function does the AJAX request

  //  Set our destination PHP page "ajaxpost.php"…
  http.open("POST", page+".php", true);
  var lacellule= (cellule=='undefined'?'cell1':cellule);
  http.onreadystatechange = getHttpRes;
  // Make our POST parameters string…
  var params = "text=" + idname;
  
  var lacellule= (cellule=='undefined'?'cell1':cellule);
  // Set our POST header correctly…
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");

  // Send the parms data…
  http.send(params);

}

function getHttpRes( ) {
  if (http.readyState == 4 && http.status == 200) {
    var reply =  http.responseText.split('&brvbar;');
   //res = http.responseText;  // These following lines get the response and update the page
   reply[1]=( reply[1]===undefined?'cell1': reply[1]);
   document.getElementById(reply[1]).innerHTML = reply[0];

  }
}

function getXHTTP( ) {
  var xhttp;
   try {   // The following "try" blocks get the XMLHTTP object for various browsers…
      xhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e2) {
 		 // This block handles Mozilla/Firefox browsers...
	    try {
	      xhttp = new XMLHttpRequest();
	    } catch (e3) {
	      xhttp = false;
	    }
      }
    }
  return xhttp; // Return the XMLHTTP object
}

var http = getXHTTP(); // This executes when the page first loads.

function affiche(the_day ) {// affiche de le input box la date choisie

var ladate=the_day;

document.getElementById('xdate').value = ladate;
}


var newwindow;
function viewurl(url,w,h)
{
  var neww= (w==undefined?500:w);
  var newh= (h==undefined?500:h);

	newwindow=window.open(url,'image','width=' + neww + ', height=' + newh  );
	if (window.focus) {newwindow.focus()}
}


function show_popup()
{
var p=window.createPopup();
var pbody=p.document.body;
pbody.style.backgroundColor="lime";
pbody.style.border="solid black 1px";
pbody.innerHTML="This is a pop-up! Click outside the pop-up to close.";
p.show(150,150,200,50,document.body);
}

function goTo (page,anc) {
/* This function is called from the navigation menu
   to jump to the designated URL. Empty values
   are ignored and "--" indicates a menu seperator    */
   
   var ancor='';
  if (anc!=undefined){
      ancor='#'+anc;
  }
	if (page != "" ) {
		if (page == "--" ) {
			resetMenu();
		} else {
			document.location.href = page + document.getElementById('type_element1').selectedIndex + ancor;
		}
	}
	return false;
}


