home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 July / PCpro_2004_07.ISO / docs / maxblast / maxblast3_files / thing.js < prev    next >
Encoding:
Text File  |  2004-03-07  |  1.2 KB  |  37 lines

  1. use( "thing.point" );
  2. /********************************************************************************
  3.  
  4.     Screen Information
  5.     
  6.     Point          Thing.screenSize()       -- returns a the width and height of the browser window
  7.     Point          Thing.scrollSize()       -- returns a the horiz and vert scroll 
  8.     Point          Thing.fullScreenSize()   -- returns the full size of the computer monitor minus the chrome.
  9.  
  10.     Point          Point.wrtPage()          -- converts screen coordinates to page coordinates
  11.     
  12. ********************************************************************************/
  13. if( is.ns4 || is.ns6 ){
  14.     Thing.screenSize = function(){
  15.         return new Point( window.innerWidth, window.innerHeight );
  16.     }
  17.     Thing.scrollSize = function(){
  18.         return new Point( window.pageXOffset, window.pageYOffset );    
  19.     }
  20.     
  21. }
  22. else{
  23.     Thing.screenSize = function(){
  24.         return new Point( document.body.clientWidth, document.body.clientHeight );
  25.     }
  26.     Thing.scrollSize = function(){
  27.         return new Point( document.body.scrollLeft, document.body.scrollTop );
  28.     }
  29. }
  30.  
  31. Thing.fullScreenSize = function(){
  32.     return new Point( screen.availWidth, screen.availHeight );
  33. }
  34. Point.prototype.wrtPage = function(){
  35.     return this.add( Thing.scrollSize() );
  36. }
  37.