// JQuery Height/Width/Positionin extensions

// requires jquery-latest.min.js

// written by Suzie Blackman 24 June 2008
// Last update 24 June 2007

// USAGE 

/* JQuery extensions to address cross-brower differences height, width and position values and opperations.
*/

// COMPATIBILITY

/*

* IE6+
* Firefox 3
* Safari

*/


jQuery.fn.extend({
	
	// absolute  real (not CSS) height of an element, including padding and border
	absHeight: function() {
	  	// fall back to height() if hidden element
		return  Math.max($(this).attr("offsetHeight"), $(this).height());
	}, // end function absHeight
	
	// absolute  real (not CSS) width of an element, including padding and border
	absWidth: function() {
		// fall back to height() if hidden element
		return Math.max($(this).attr("offsetWidth"), $(this).width());
	}, // end function absWidth
	
	// absolute  real (not CSS) X position of top left corner relative to window, 
	//including padding and border but not margin
	
	absX: function() {
	  
		var x = 0;
		for(var e = $(this); e ; e=$(e).attr("offsetParent")){
				x += $(e).attr("offsetLeft");
		}
	
		for(e=$(this).attr("parentNode"); e && e != document.body; e=$(e).attr("parentNode")){
			if(($(e).attr("scrollLeft"))) x-= $(e).attr("scrollLeft");
		}
	
		return x;
		
		
	}, // end function absX
	
	// absolute  real (not CSS) Y position of top left corner, including padding and border, relative to window
	absY: function() {
	 
		var y = 0;
		for(var e = $(this); e ; e=$(e).attr("offsetParent")){
				y += $(e).attr("offsetTop");
		}
	
		for(e=$(this).attr("parentNode"); e && e != document.body; e=$(e).attr("parentNode")){
			if(($(e).attr("scrollTop"))) y-= $(e).attr("scrollTop");
		}
	
		return y;
		
	} // end function absY
	
});