diff -r 56befcb22751 -r 94a1dc255022 thd/web/js/uc.base.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/thd/web/js/uc.base.js Tue Sep 22 16:40:38 2009 +0200 @@ -0,0 +1,62 @@ +var uc = uc || {}; + +//retourne vrai si IE +uc.navigatorIsIeNoCollision = function (){ +return navigator.appName.substring( 0,5 ).toUpperCase() == 'MICRO'; +} + +uc.calculeOffsetLeft = function(r){ +return uc.calculeOffset(r,"offsetLeft") +} + +uc.calculeOffsetTop = function(r){ +return uc.calculeOffset(r,"offsetTop") +} + +uc.calculeOffset = function(element,attr){ + var offset=0; + while(element){ + offset+=element[attr]; + element=element.offsetParent + } + return offset +} + + +uc.returnDocumentSize = function () { + var myWidth = 0, myHeight = 0; + if( typeof( window.innerWidth ) == 'number' ) { + //Non-IE + myWidth = window.innerWidth; + myHeight = window.innerHeight; + } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { + //IE 6+ in 'standards compliant mode' + myWidth = document.documentElement.clientWidth; + myHeight = document.documentElement.clientHeight; + } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { + //IE 4 compatible + myWidth = document.body.clientWidth; + myHeight = document.body.clientHeight; + } + var result = new Array(myWidth,myHeight); + return result; +} + + +uc.getDocScrollTop = function(){ + if(document.body.scrollTop){ + ltop = document.body.scrollTop; + }else{ + ltop = document.documentElement.scrollTop; + } +return ltop; +} + +uc.getDocScrollLeft = function(){ + if(document.body.scrollLeft){ + ltop = document.body.scrollLeft; + }else{ + ltop = document.documentElement.scrollLeft; + } +return ltop; +} \ No newline at end of file