/*
	plugins.js
	Idea from HTML5BoilerPlate.

 	@author Jay Contonio
*/

// usage: log('inside coolFunc',this,arguments);
window.log = function() {
	log.history = log.history || [];   // store logs to an array for reference
	log.history.push(arguments);
	if (this.console)
	{
	  console.log( Array.prototype.slice.call(arguments) );
	}
}


String.prototype.linkify = function() 
{
	return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function(m) {
		return m.link(m);
	});
};

/**
 * Gets the current position of the object
 * 
 * @param {Object} obj 	The element you want to find the position of
 * @returns {Object} 	Contains top and left position
 */
window.findPos = function(obj)
{
	var leftPos, topPos;
	if (obj.offsetParent)
	{
		topPos = obj.offsetTop;
		leftPos = obj.offsetLeft;
	}
	return { top:topPos, left:leftPos };
}
