includes/clientside/static/windows.js
changeset 420 301f546688d1
parent 338 915d399dfdbf
child 1227 bdac73ed481e
equal deleted inserted replaced
419:b8b4e38825db 420:301f546688d1
     4  * Copyright (C) 2006-2007 Dan Fuhry
     4  * Copyright (C) 2006-2007 Dan Fuhry
     5  * Yes, it's part of Enano, so it's GPL
     5  * Yes, it's part of Enano, so it's GPL
     6  */
     6  */
     7 
     7 
     8   var position;
     8   var position;
     9   function getScrollOffset()
       
    10   {
       
    11     var position;
       
    12     if (self.pageYOffset)
       
    13     {
       
    14       position = self.pageYOffset;
       
    15     }
       
    16     else if (document.documentElement && document.documentElement.scrollTop)
       
    17     {
       
    18       position = document.documentElement.scrollTop;
       
    19     }
       
    20     else if (document.body)
       
    21     {
       
    22       position = document.body.scrollTop;
       
    23     }
       
    24     return position;
       
    25   }
       
    26   position = getScrollOffset();
     9   position = getScrollOffset();
    27   
    10   
    28   var jws = {
    11   var jws = {
    29     position : position,
    12     position : position,
    30     obj : null,
    13     obj : null,
   148     }
   131     }
   149   } // class jws
   132   } // class jws
   150 
   133 
   151 //window.onscroll=jws['scrollHandler'];
   134 //window.onscroll=jws['scrollHandler'];
   152 
   135 
   153 /*
       
   154  * Utility functions
       
   155  */
       
   156  
       
   157 // getElementWidth() and getElementHeight()
       
   158 // Source: http://www.aspandjavascript.co.uk/javascript/javascript_api/get_element_width_height.asp
       
   159 
       
   160 function getElementHeight(Elem) {
       
   161   if (ns4) 
       
   162   {
       
   163     var elem = getObjNN4(document, Elem);
       
   164     return elem.clip.height;
       
   165   } 
       
   166   else
       
   167   {
       
   168     if(document.getElementById) 
       
   169     {
       
   170       var elem = document.getElementById(Elem);
       
   171     }
       
   172     else if (document.all)
       
   173     {
       
   174       var elem = document.all[Elem];
       
   175     }
       
   176     if (op5) 
       
   177     { 
       
   178       xPos = elem.style.pixelHeight;
       
   179     }
       
   180     else
       
   181     {
       
   182       xPos = elem.offsetHeight;
       
   183     }
       
   184     return xPos;
       
   185   } 
       
   186 }
       
   187 
       
   188 function getElementWidth(Elem) {
       
   189   if (ns4) {
       
   190     var elem = getObjNN4(document, Elem);
       
   191     return elem.clip.width;
       
   192   } else {
       
   193     if(document.getElementById) {
       
   194       var elem = document.getElementById(Elem);
       
   195     } else if (document.all){
       
   196       var elem = document.all[Elem];
       
   197     }
       
   198     if (op5) {
       
   199       xPos = elem.style.pixelWidth;
       
   200     } else {
       
   201       xPos = elem.offsetWidth;
       
   202     }
       
   203     return xPos;
       
   204   }
       
   205 }
       
   206 
       
   207 function getHeight() {
       
   208   var myHeight = 0;
       
   209   if( typeof( window.innerWidth ) == 'number' ) {
       
   210     myHeight = window.innerHeight;
       
   211   } else if( document.documentElement &&
       
   212       ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
       
   213     myHeight = document.documentElement.clientHeight;
       
   214   } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
       
   215     myHeight = document.body.clientHeight;
       
   216   }
       
   217   return myHeight;
       
   218 }
       
   219 
       
   220 function getWidth() {
       
   221   var myWidth = 0;
       
   222   if( typeof( window.innerWidth ) == 'number' ) {
       
   223     myWidth = window.innerWidth;
       
   224   } else if( document.documentElement &&
       
   225       ( document.documentElement.clientWidth || document.documentElement.clientWidth ) ) {
       
   226     myWidth = document.documentElement.clientWidth;
       
   227   } else if( document.body && ( document.body.clientWidth || document.body.clientWidth ) ) {
       
   228     myWidth = document.body.clientWidth;
       
   229   }
       
   230   return myWidth;
       
   231 }
       
   232 
       
   233 /**************************************************
   136 /**************************************************
   234  * dom-drag.js
   137  * dom-drag.js
   235  * 09.25.2001
   138  * 09.25.2001
   236  * www.youngpup.net
   139  * www.youngpup.net
   237  * The original version of this code is in the
   140  * The original version of this code is in the