/**
 * JQuery extending function
 * 
 * @author machain
 * @required JQuery
 */

jQuery.fn.extend
(
	{
		hasAttr: function(name) 
		{
			return ($(this).attr(name) != undefined);
		}, 
		
		centerVertical: function() 
		{
			var elementHeight = ($(this).height()/2);
			var height = Math.round(($(window).height() / 2));
			var scrollTop = Math.round($(window).scrollTop());
			var top = Math.round(height + scrollTop - elementHeight);
			$(this).css('top', top);
			//alert('height: ' + height + '\n' + 'scrollTop: ' + scrollTop + '\n' + 'top: ' + top + '\n' + 'element height: ' + $(this).height());
		}, 
		
		center: function()
		{
			$(this).centerVertical();
		}
	}
);
