(function($){$.fn.center=function(){return this.each(function(){var $this=$(this);var frameXOffset=0,frameYOffset=0,windowHeight=0,windowWidth=0;if(top.document!=window.document){var frm=$('iframe',top.document.body);if(frm.length==0){frm=$('frame',top.document.body);}
var i=frm.length;while(i--){if(frm[i].contentDocument){doc=frm[i].contentDocument;}else{doc=frm[i].contentWindow.document;}
if(doc===document){frameXOffset=$(frm[i]).offset().left;frameYOffset=$(frm[i]).offset().top;break;}};if(jQuery.browser.msie){windowWidth=top.window.document.documentElement.clientWidth;windowHeight=top.window.document.documentElement.clientHeight;}else{windowWidth=top.window.innerWidth;windowHeight=top.window.innerHeight;}}else{if(jQuery.browser.msie){windowWidth=window.document.documentElement.clientWidth;windowHeight=window.document.documentElement.clientHeight;}else{windowWidth=window.innerWidth;windowHeight=window.innerHeight;}}
var elHeight=$this.height();var newTop=((windowHeight/2)-(elHeight/2))-frameYOffset+$(parent.document.documentElement).scrollTop();if((newTop+elHeight)>$(document).height()){newTop=$(document).height()-elHeight;}
$this.css({left:((windowWidth/2)-($this.width()/2))-frameXOffset+$(parent.document.documentElement).scrollLeft(),top:newTop});});};})(jQuery);