Location: PHPKode > projects > PhpProjectMaster > www/template/common/ajax.html
<script type="text/javascript">
isDOM=document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
isMSIE=document.all && document.all.item //Microsoft Internet Explorer 4+
isNetscape4=document.layers //Netscape 4.*
isOpera=window.opera //Opera
isOpera5=isOpera && isDOM //Opera 5+
isMSIE5=isDOM && isMSIE && !isOpera //MSIE 5+
isMozilla=isNetscape6=isDOM && !isMSIE && !isOpera

var obj;

function getLayer(layerName, parentLayerName){
  if(isDOM){ return document.getElementById(layerName); }
  if(isMSIE){ return document.all[layerName]; }
  if(isNetscape4){ return eval('document.layers[layerName]'); }
  return false;
}

function ts(e,what){
  ajaxRead(what);
  mousex = e.clientX;
  mousey = e.clientY;
  pagexoff = 0;
  pageyoff = 0;
  if(isMSIE5){
    pagexoff = document.body.scrollLeft;
    pageyoff = document.body.scrollTop;
  }
  else{
     pagexoff = window.pageXOffset;
     pageyoff = window.pageYOffset;
  }
  if(getLayer(what)){
    if(isNetscape4)
      obj = getLayer(what);
    else
      obj = getLayer(what).style;

          c_width = getLayer(what).offsetWidth;
          oCanvas = document.getElementsByTagName(
              (document.compatMode && document.compatMode == "CSS1Compat") ? "HTML" : "BODY"
      )[0];
          w_width = oCanvas.clientWidth ? oCanvas.clientWidth + oCanvas.scrollLeft : window.innerWidth + window.pageXOffset;

        if(obj){
            leftoff = mousex-pagexoff;
        obj.left = (mousex+pagexoff);
        if (mousex + pagexoff + c_width > w_width) obj.left = w_width - c_width + "px";
  
            topoff = mousey-pageyoff;
        if(isOpera && topoff <= 30)
          obj.top = mousey + 20;
            else 
                if( mousey <= 30) 
                obj.top = (mousey+pageyoff) + 20;
                else 
              if (isOpera) 
            obj.top = mousey + 20;
            else
          obj.top = (mousey+pageyoff) + 20;
                
                
            if(isNetscape4)
          obj.visibility = 'show';
            else
          obj.visibility = 'visible';
          }
   }
  return true;
}

function tc(){
  if(obj){
    if(isNetscape4)
      obj.visibility = 'hide';
    else
      obj.visibility='hidden';
  }
  return true
}

function ajaxRead(id){
    var xmlObj =null;
    if(window.XMLHttpRequest){
        xmlObj =new XMLHttpRequest(); 
    }
    else if(window.ActiveXObject){
        xmlObj =new ActiveXObject("Microsoft.XMLHTTP"); 
    }
    else 
    { 
        return; 
    } 
    xmlObj.onreadystatechange = function(){
/*        alert(xmlObj.readyState);*/
        if(xmlObj.readyState == 4){
            updateObj(id, xmlObj.responseXML.getElementsByTagName('e_title')[0].firstChild.data,  
                          xmlObj.responseXML.getElementsByTagName('add_info')[0].firstChild.data,
                          xmlObj.responseXML.getElementsByTagName('brief_desc')[0].firstChild.data); 
        } 
    } 
    xmlObj.open ('GET','<~ROOT_URL>/php/calendar.php?GetXML=1&id='+id,true); xmlObj.send (''); 
    return 1;
} 

function updateObj(obj,title,add,desc){
    if(document.getElementById(obj)){
        
    }
    else
    {
        document.body.innerHTML = document.body.innerHTML+"<div id="+obj+" class='tip'><div class='bard'><b>"+title+"</b></div>"+add+"<br>"+desc+"</div>"; 
    }
}
</script>
Return current item: PhpProjectMaster