YAHOO.namespace("AppFinder");

// Removes leading whitespaces
String.prototype.ltrim = function() {
	
	var re = /\s*((\S+\s*)*)/;
	return this.replace(re, "$1");
	
}

// Removes ending whitespaces
String.prototype.rtrim = function() {
	
	var re = /((\s*\S+)*)\s*/;
	return this.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
String.prototype.trim = function() {
	
	return this.ltrim().rtrim();
	
}
// Array.indexOf( value, begin, strict ) - Return index of the first element that matches value
Array.prototype.indexOf = function( v, b, s ) {
 for( var i = +b || 0, l = this.length; i < l; i++ ) {
  if( this[i]===v || s && this[i]==v ) { return i; }
 }
 return -1;
};

var myFalseFunc = function() { return false; };

YAHOO.widget.Tooltip.prototype.doShow = function(e, context) {
	
	var yOffset = -30;
	if (this.browser == "opera" && context.tagName == "A") {
		yOffset += 12;
	}

	var me = this;
	return setTimeout(
		function() {
			if (me._tempTitle) {
				me.setBody(me._tempTitle);
			} else {
				me.cfg.refireEvent("text");
			}

			me.moveTo(me.pageX, me.pageY + yOffset);
			if (me.cfg.getProperty("preventoverlap")) {
				me.preventOverlap(me.pageX, me.pageY);
			}
			
			YAHOO.util.Event.removeListener(context, "mousemove", me.onContextMouseMove);

			me.show();
			me.hideProcId = me.doHide();
		},
	this.cfg.getProperty("showdelay"));
};