/* author: Rick taylor
** Date: August 2004
** ppdm.js
*/

   var agree = " PLEASE READ THE FOLLOWING. If you agree you may proceed by entering the password and downloading the deliverables.\n\n\n"
       agree += "USER agrees on receipt of the PPDM model and supporting material that its use by USER constitutes acceptance by the USER that:\n\n";
       agree += "1.  The PPDM products and supporting material are provided \"as is\" without any warranty or condition of any kind, either statutory, express or implied, including, without limiting the foregoing, implied warranties of merchantability of fitness for a particular purpose, or warranty as to non-infringement with existing or future copyright, patent of other intellectual property rights claimed or asserted by any third party;\n\n";
       agree += "2.  PPDM shall not be liable to User nor to anyone else who uses or otherwise obtains the PPDM products and supporting material, either directly or indirectly from User, for direct, indirect, special or consequential damages or other loss or cost however arising;\n\n";
       agree += "3.  User agrees to indemnify and hold PPDM harmless from any third party claims arising directly or indirectly, or however arising, from the PPDM products and supporting material provided to the User;\n\n";
       agree += "4.  The user acknowledges that the PPDM products and supporting material are under copyright notice and that all rights are reserved by PPDM, the Public Petroleum Data Model Association.\n\n";


    // check to see if browser is netscape/mozilla
    var isNetscape = navigator.appName=="Netscape";

     // global varables for mouse position
     var Xpos;
     var Ypos;

     // save mouse position ns
     function MoveHandler(e)
     {
         Xpos = e.pageX + window.pageXOffset;
         Ypos = e.pageY + window.pageYOffset;
         return true;
     }

     // save mouse position ie
     function MoveHandlerIE() {
         Xpos = window.event.x + document.body.scrollLeft;
         Ypos = window.event.y + document.body.scrollTop;
         //self.status = "X= "+ Xpos + "  scr= " + document.body.scrollTop;
     }

     if (isNetscape) {
         document.captureEvents(Event.MOUSEMOVE);
         document.onMouseMove = MoveHandler;
         document.onMouseOver = MoveHandler;
     } else {
         document.onmousemove = MoveHandlerIE;
     }


     function IE4GetElementById(id)
     {
        return document.all[id];
     }


     if (document.layers)
        document.getElementById = NN4GetLayerById;
     else if (document.all && !document.getElementById)
        document.getElementById = IE4GetElementById;

    // get the style object for th given id
     function getStyleObject(id)
     {
        var elm = null;
        var styleObject = null;

        if (document.getElementById)
           elm = document.getElementById(id);

        if (elm)
        {
           if (elm.style)
              styleObject = elm.style;
           else if (document.layers)
              styleObject = elm;
        }
       return styleObject;
     }

 // hide the style object
     function hideElement(id)
     {
	     
	  var styleObject = getStyleObject(id);

       if (styleObject)
         styleObject.visibility = 'hidden';
     }

 // show the style object with markup and size as parameters.
 //  The location is determined by the mouse cursor

     function showElement(id,txt,wd,hgt,objID)
     {
	     
     var rHgt = hgt;

     obj = document.getElementById(objID);


 // write the markup to the approprate description div element
       document.getElementById(id).innerHTML=txt;

       var styleObject = getStyleObject(id);

// need to get object position for mozilla/Netscape
       if (isNetscape) {
        Xpos = getX(obj);
        Ypos = getY(obj);
       }


       winHeight = (isNetscape)?window.innerHeight:document.body.offsetHeight;

       scrolled = (isNetscape)?window.pageYOffset:document.body.scrollTop;

        // adjust position of message if near bottom of window and for scrolling
         if ((Ypos + hgt + 40) > winHeight + scrolled)
         Ypos = Ypos - (hgt + 40);

 // set the style atributes to view the description box markup
       if (styleObject) {

         styleObject.visibility = 'visible';
         styleObject.left   = (Xpos + 20) + 'px';
         styleObject.top    = (Ypos + 20) + 'px';
         styleObject.width  = wd + 'px';
         styleObject.height = hgt + 'px';

         }
     }

     function getX(obj)
     {
      return( obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+getX(obj.offsetParent) );
     }

     function getY(obj)
     {
      return( obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+getY(obj.offsetParent) );
     }
     

     
      function downloadFile(url)
     {
	     
	  var i_accept = confirm(agree);

	  if (i_accept == true)
       {
        window.open(url);
        return true;
       }
     else
      {
       return false;
      }

     }
     
    
