jQuery.fn.center = function()   
{
            
	function getBodyScrollTop(){
		return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
	}
        
        jQuery.getBodyScrollTop = getBodyScrollTop;
	
	function getClientWidth()  
	{  
	  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;  
	}  
	   
	function getClientHeight()  
	{  
	  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;  
	} 	
	var w = $(window);  
	this.css("position","absolute");  
	this.css("top",getBodyScrollTop()+(getClientHeight()-this.height())/2 + "px");  
	this.css("left",(getClientWidth()-this.width())/2 + "px");  
	return this;  
}  
