function Is() {
    var agent = navigator.userAgent.toLowerCase();
    this.ie   = (agent.indexOf("msie") != -1 && (agent.indexOf("opera") == -1));
    this.iemac=this.ie && agent.indexOf("mac")!=-1;
    this.opera=(agent.indexOf("opera") == -1);
    this.iewin=this.ie && !this.iemac;
    this.gecko=(navigator.product == "Gecko");
}
var is = new Is();   
var bcolor='#1b6fcb';
var fcolor='#F8F6F0';
var xmlhttp=false;
var urlbase="http://www.observatorium.fr/";
function getxmlReq(url,parms,typ,dv,funct) {

/*@cc_on @*/

if( xmlhttp && xmlhttp.readyState )
    {
        xmlhttp.abort( );
        xmlhttp = false;
    };
if (window.XMLHttpRequest) {
  xmlhttp =new XMLHttpRequest(); } else
  { /*@cc_on @*/
/*@if (@_jscript_version >= 5)
  xmlhttp= new ActiveXObject("Msxml2.XMLHTTP");
 } @else @*/ if  (window.ActiveXObject)
 {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } else { alert('verification non possible sur ce navigateur');return false; };
  };
/*@end @*/

 if(typ!="POST") {typ="GET";};
if(typ=='POST') {
xmlhttp.open("POST", urlbase+url,true);      }
else {
xmlhttp.open("GET", urlbase+url+parms,true); parms='';    };
  //alert('url='+urlbase+url+' parms='+parms+ ' dv='+dv);


 xmlhttp.onreadystatechange=function() {
         el=document.getElementById(dv)?document.getElementById(dv):null;

  if (xmlhttp.readyState==4) {

             if(el!=null) {el.style.display='block';};

             if(dv=='listepartis') {
                eld=document.getElementById('cal')?document.getElementById('cal'):null;
                 if(eld!=null) {if(eld.style.display!='none') {eld.style.display='none';} else {eld.style.display='block';};};
            };
            if(document.all) {el.innerHTML='...';} else {setElHtml(el,'...');};
   if (xmlhttp.status==200)
    {

       rep= xmlhttp.responseText;eval(funct);
  } else {
  rep='Problème de connexion avec le serveur. Essayer &agrave; nouveau '+xmlhttp.status;
  
  };
 if(dv!='chatdv') { setElHtml(el,rep);}
 else { if(xmlhttp.status==200) {  return rep; } else {return 0;};}; if(xmlhttp.status==200) { if(dv=='zonerep'   ) {activtd();} else if(dv.indexOf('dvmodif')>-1) {
  majbox(rep,el);
  } else if ( typ=="POST" && dv.substr(0,6)=='dvcomm') {
  parms='';rep=maketext(rep);initeditordv(rep.substr(0,10),el,typ);} else if(dv=='divbookmark') { if(rep==0) {chgbkmrk(el);} else {el.style.display='none';alert(rep);};  };  };
  };
 }
 if(typ=="POST") {xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8');
 };
 xmlhttp.send(parms);
 };
function setElHtml(el,val)
{  //if(document.all) {el.innerHTML=rep;} else {
   el.innerHTML=val;
  /*rng = document.createRange();
       rng.setStartBefore(el);
       htmlFrag = rng.createContextualFragment(val);
       while (el.hasChildNodes()) {el.removeChild(el.lastChild);};
       el.appendChild(htmlFrag);*/
};


 function inidiv(divname,divp,decalx,decaly)
{
    doc=document.getElementById(divname);
    pos = document.getElementById(divp);
        DivLeft=parseInt(getLeft(pos))+decalx;

         DivTop=parseInt(getTop(pos))+decaly;

              doc.style.top = DivTop+"px";

        doc.style.left = DivLeft+"px";


};
function getLeft(MyObject)
    {
    if (MyObject.offsetParent)

        return (MyObject.offsetLeft + getLeft(MyObject.offsetParent));
    else

        return (MyObject.offsetLeft);
    }
function getTop(MyObject)
    {
    if (MyObject.offsetParent)
        return (MyObject.offsetTop + getTop(MyObject.offsetParent));
    else
        return (MyObject.offsetTop);
    }

function maketext(tx)
{
tx=tx.replace(/(<([^>]+)>)/ig,"");
return tx;
};
