(function($){var c;var d;var e;var f;var o;var g=new Image();var h;var i;$.teaserpop=function(a){$.fn.teaserpop(a)};$.teaserpop.show=function(){if($.browser.msie&&!$.support.opacity&&$.browser.version<7){$('select').css({'visibility':'hidden'})}f=$(document).height();c=$('<div id="teaserpop_overlay"></div>');c.css({'width':$(window).width(),'height':f,'background-color':o.overlay_color}).hide().appendTo('body');e=$('<div class="teaserpop_close"><a href="javascript:void(0)"></a></div>');d=$('<div id="teaserpop_box"><div class="teaserpop_content"></div></div>');d.css({'width':'50px','height':'50px','background-color':o.box_bg_color,'padding':o.box_padding,'display':'none','MozBorderRadius':o.box_border_radius,'WebkitBorderRadius':o.box_border_radius,'BorderRadius':o.box_border_radius,'z-index':'1101'}).appendTo('body').addClass('teaserpop_spinner');d.append(e);$.teaserpop.center(d);$('.teaserpop_close').click($.teaserpop.close);c.click($.teaserpop.close);c.css({'display':'block'}).fadeTo(o.overlay_fade_speed,o.overlay_opacity,function(){d.fadeIn('fast',function(){$.teaserpop.load()})})};$.teaserpop.load=function(){switch(o.type){case'img':$(g).one("load",function(){$.teaserpop.fade_img()}).error(function(){$(d).removeClass('teaserpop_spinner').animate({'width':"200px",'height':"35px",'top':(Math.max(($(window).height()-35)/2+$(window).scrollTop()))+"px",'left':(Math.max(($(window).width()-200)/2+$(window).scrollLeft()))+"px"},500,function(){if($.browser.msie){e.show()}else{e.fadeIn('fast')}$('.teaserpop_content').html('<p class="teaserpop_error">'+o.error_message+'</p>')}).css('overflow','visible')});g.src=o.src;break;case'swf':i='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+o.swf_width+'" height="'+o.swf_height+'"><param name="movie" value="'+o.src+'" /><param name="wmode" value="transparent" /><param name="menu" value="false" /><!--[if !IE]>--><object type="application/x-shockwave-flash" data="'+o.src+'" menu="false" wmode="transparent" width="'+o.swf_width+'" height="'+o.swf_height+'"><!--<![endif]--><p><a href="http://www.adobe.com/go/getflashplayer">You need Flash Player. Download it here.</a></p><!--[if !IE]>--></object><!--<![endif]--></object>';d.removeClass('teaserpop_spinner').animate({'width':o.swf_width+"px",'height':o.swf_height+"px",'top':(Math.max(($(window).height()-o.swf_height)/2+$(window).scrollTop()))+"px",'left':(Math.max(($(window).width()-o.swf_width)/2+$(window).scrollLeft()))+"px"},500,function(){if($.browser.msie){e.show()}else{e.fadeIn('fast')}$('.teaserpop_content').html(i)}).css('overflow','visible');break}};$.teaserpop.fade_img=function(){h=$("<img />").attr({'id':'teaserpop_img','border':'0','src':o.src}).hide().appendTo('.teaserpop_content');if(o.href!==""){h.wrap('<a href="'+o.href+'" target="'+o.target+'"></a>')}var a=$(h).width();var b=$(h).height();d.removeClass('teaserpop_spinner').animate({'width':(Math.max(a))+"px",'height':(Math.max(b))+"px",'top':(Math.max(($(window).height()-b)/2+$(window).scrollTop()))+"px",'left':(Math.max(($(window).width()-a)/2+$(window).scrollLeft()))+"px"},500,function(){if($.browser.msie){e.show()}else{e.fadeIn('fast')}h.fadeIn(500)}).css('overflow','visible')};$.teaserpop.center=function(a){$(a).css({'top':($(window).height()-$(a).height())/2+$(window).scrollTop()+"px",'left':($(window).width()-$(a).width())/2+$(window).scrollLeft()+"px"})};$.teaserpop.center_animate=function(a){$(a).stop(true,true).animate({'top':(Math.max(($(window).height()-$(a).height())/2+$(window).scrollTop()))+"px",'left':(Math.max(($(window).width()-$(a).width())/2+$(window).scrollLeft()))+"px"},200)};$.teaserpop.close=function(){e.hide();d.fadeOut('fast',function(){$(this).remove();if($.browser.msie&&!$.support.opacity&&$.browser.version<7){$('select').css({'visibility':'visible'})}$(window).unbind("resize");c.fadeOut('fast',function(){$(this).remove()})})};$.teaserpop.resize=function(){if(c.is(':visible')){c.css({'width':$(window).width(),'height':$(document).height(),'top':'0','left':'0'});$.teaserpop.center_animate(d)}};$.fn.teaserpop=function(a){var b={src:'teaserpop/uploads/3462661544_579ea2e9f3.jpg',type:'img',href:'',target:'_blank',swf_width:0,swf_height:0,overlay_color:'#000000',overlay_opacity:0.8,overlay_fade_speed:500,box_padding:20,box_bg_color:'#FFFFFF',box_border_radius:0,error_message:"Error... Can't find the file..."};o=$.extend(b,a);if($.browser.msie&&!$.support.opacity&&$.browser.version<7){$(window).scroll(function(){if(c.is(':visible')){c.css({width:$(window).width(),height:$(window).height(),top:$(window).scrollTop(),left:$(window).scrollLeft()})}})}$(window).resize(function(){$.teaserpop.resize()});$.teaserpop.show()}})(jQuery);
