(function($) {
	$.fn.centering = function(Animation){
		var ScrollTop=0;
		var InnerHeight;
		var topOffset =0;
		
		/*Width,Height*/
		if (window.innerWidth){
			InnerHeight=window.innerHeight;
		} else if (document.documentElement.offsetWidth){
			InnerHeight=document.documentElement.offsetHeight;
		} else {
			InnerHeight=document.body.offsetHeight;
		}
	    /*Scroll left,top*/
		if (window.pageXOffset || window.pageYOffset){
			ScrollTop=window.pageYOffset;
		} else if (document.documentElement.scrollLeft || document.documentElement.scrollTop){
			ScrollTop=document.documentElement.scrollTop;
		} else if (document.body.scrollLeft || document.body.scrollTop){
			ScrollTop=document.body.scrollTop;
		}

		str = new String(topOffset);
		topOffset = (str.indexOf('%') > 0) ? (topOffset = parseInt(topOffset) / 100 * InnerHeight) : (parseInt(topOffset));

		topOffset+=ScrollTop;
		
		this.css("position", "relative");
		if (Animation){
			this.animate({"top" : InnerHeight + topOffset - ((this[0].offsetHeight + InnerHeight) / 2) + 'px'}, 200);
		} else{
			this.css({"top" : InnerHeight + topOffset - ((this[0].offsetHeight + InnerHeight) / 2) + 'px'});
		}		
		return this;
	}
	
})(jQuery)
