/** 
 * Window methods
 * There is technically no Window.prototype object. 
 * Assigning new properties to Window.prototype works in Firefox, but not in IE6.
 * @author Rebecca Younes
 */


/**
 * @description Scroll to an element
 * @param {HTMLElement} el The element to scroll to
 * @param {Integer} topPadding Padding between element top and scroll position
 * @param {Integer} leftPadding Padding between element left edge and scroll position
 * @return {void}
 */
window.scrollToElement = function(el, topPadding, leftPadding) {

	// el.offsetLeft and el.offsetRight don't work correctly in IE6, so use
	// yui's getXY() for cross-browser support
	var offsets = YAHOO.util.Dom.getXY(el),
		offsetLeft = offsets[0],
		offsetTop = offsets[1];
		
	topPadding = topPadding || 0;	
	leftPadding = leftPadding || 0;

	offsetLeft -= leftPadding;	
	offsetTop -= topPadding;
	
	window.scrollTo(offsetLeft, offsetTop);
};

/**
 * @description Display a message in the window status bar.
 * Use to display something other than the link href value when hovering over it.
 * @param {String} msg
 */
window.showStatus = function(msg) {
	
	window.status = msg;
	return true;
};

window.replaceStatusMessage = function(msg, event) {

	YAHOO.util.Event.stopEvent(event);
	return window.showStatus(msg);
}; 

window.showBlankStatus = function() {
	
	return window.showStatus('');
};

/** 
 * @description Display an element's text in the window status bar (e.g., on mouseover)
 * @param {HTMLElement} el The element (typically a link element)
 * @param {Event} event The event
 */
window.showTextInStatusBar = function(el, event) {
	
	return window.replaceStatusMessage(el.firstChild.nodeValue, event);
};
