(function(g){g.ceebox={version:"2.1.5"};g.fn.ceebox=function(r){r=g.extend({selector:g(this).selector},g.fn.ceebox.defaults,r);var q=this;var p=g(this).selector;if(r.videoJSON){g.getJSON(r.videoJSON,function(s){g.extend(g.fn.ceebox.videos,s);n(q,r,p)})}else{n(q,r,p)}return this};g.fn.ceebox.defaults={html:true,image:true,video:true,modal:false,titles:true,htmlGallery:true,imageGallery:true,videoGallery:true,videoWidth:false,videoHeight:false,videoRatio:"16:9",htmlWidth:false,htmlHeight:false,htmlRatio:false,imageWidth:false,imageHeight:false,animSpeed:1,easing:"swing",fadeOut:20,fadeIn:20,overlayColor:"#000",overlayOpacity:0.5,boxColor:"",textColor:"",borderColor:"",borderWidth:"3px",padding:15,margin:150,onload:null,unload:null,videoJSON:null,iPhoneRedirect:true};g.fn.ceebox.ratios={"4:3":1.333,"3:2":1.5,"16:9":1.778,"1:1":1,square:1};g.fn.ceebox.relMatch={width:/(?:width:)([0-9]+)/i,height:/(?:height:)([0-9]+)/i,ratio:/(?:ratio:)([0-9\.:]+)/i,modal:/modal:true/i,nonmodal:/modal:false/i,videoSrc:/(?:videoSrc:)(http:[\/\-\._0-9a-zA-Z:]+)/i,videoId:/(?:videoId:)([\-\._0-9a-zA-Z:]+)/i};g.fn.ceebox.loader="<div id='cee_load' style='z-index:205;top:50%;left:50%;position:fixed'></div>";g.fn.ceebox.videos={base:{param:{wmode:"transparent",allowFullScreen:"true",allowScriptAccess:"always"},flashvars:{autoplay:true}},facebook:{siteRgx:/facebook\.com\/video/i,idRgx:/(?:v=)([a-zA-Z0-9_]+)/i,src:"http://www.facebook.com/v/[id]"},youtube:{siteRgx:/youtube\.com\/watch/i,idRgx:/(?:v=)([a-zA-Z0-9_\-]+)/i,src:"http://www.youtube.com/v/[id]&hl=en&fs=1&autoplay=1"},metacafe:{siteRgx:/metacafe\.com\/watch/i,idRgx:/(?:watch\/)([a-zA-Z0-9_]+)/i,src:"http://www.metacafe.com/fplayer/[id]/.swf"},google:{siteRgx:/google\.com\/videoplay/i,idRgx:/(?:id=)([a-zA-Z0-9_\-]+)/i,src:"http://video.google.com/googleplayer.swf?docId=[id]&hl=en&fs=true",flashvars:{playerMode:"normal",fs:true}},spike:{siteRgx:/spike\.com\/video|ifilm\.com\/video/i,idRgx:/(?:\/)([0-9]+)/i,src:"http://www.spike.com/efp",flashvars:{flvbaseclip:"[id]"}},vimeo:{siteRgx:/vimeo\.com\/[0-9]+/i,idRgx:/(?:\.com\/)([a-zA-Z0-9_]+)/i,src:"http://www.vimeo.com/moogaloop.swf?clip_id=[id]&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1"},dailymotion:{siteRgx:/dailymotion\.com\/video/i,idRgx:/(?:video\/)([a-zA-Z0-9_]+)/i,src:"http://www.dailymotion.com/swf/[id]&related=0&autoplay=1"},cnn:{siteRgx:/cnn\.com\/video/i,idRgx:/(?:\?\/video\/)([a-zA-Z0-9_\/\.]+)/i,src:"http://i.cdn.turner.com/cnn/.element/apps/cvp/3.0/swf/cnn_416x234_embed.swf?context=embed&videoId=[id]",width:416,height:374}};g.fn.ceebox.overlay=function(q){q=g.extend({width:60,height:30,type:"html"},g.fn.ceebox.defaults,q);if(g("#cee_overlay").size()===0){g("<div id='cee_overlay'></div>").css({opacity:q.overlayOpacity,position:"absolute",top:0,left:0,backgroundColor:q.overlayColor,width:"100%",height:g(document).height(),zIndex:10190}).appendTo(g("body"))}if(g("#cee_box").size()===0){var r=m(q);var p={position:r.position,zIndex:10200,top:"50%",left:"50%",height:q.height+"px",width:q.width+"px",marginLeft:r.mleft+"px",marginTop:r.mtop+"px",opacity:0,borderWidth:q.borderWidth,borderColor:q.borderColor,backgroundColor:q.boxColor,color:q.textColor};g("<div id='cee_box'></div>").css(p).appendTo("body").animate({opacity:1},q.animSpeed,function(){g("#cee_overlay").addClass("cee_close")})}g("#cee_box").removeClass().addClass("cee_"+q.type);if(g("#cee_load").size()===0){g(g.fn.ceebox.loader).appendTo("body")}g("#cee_load").show("fast").animate({opacity:1},"fast")};g.fn.ceebox.popup=function(v,p){var w=i(p.margin);p=g.extend({width:w.width,height:w.height,modal:false,type:"html",onload:null},g.fn.ceebox.defaults,p);var z,u;if(g(v).is("a,area,input")&&(p.type=="html"||p.type=="image"||p.type=="video")){if(p.gallery){u=g(p.selector).eq(p.gallery.parentId).find("a[href],area[href],input[href]")}h[p.type].prototype=new f(v,p);var s=new h[p.type]();v=s.content;p.action=s.action;p.modal=s.modal;if(p.titles){p.titleHeight=g(s.titlebox).contents().contents().wrap("<div></div>").parent().attr("id","ceetitletest").css({position:"absolute",top:"-300px",width:s.width+"px"}).appendTo("body").height();g("#ceetitletest").remove();p.titleHeight=(p.titleHeight>=10)?p.titleHeight+20:30}else{p.titleHeight=0}p.width=s.width+2*p.padding;p.height=s.height+p.titleHeight+2*p.padding}g.fn.ceebox.overlay(p);c.action=p.action;c.onload=p.onload;c.unload=p.unload;var y=m(p);var t={marginLeft:y.mleft,marginTop:y.mtop,width:p.width+"px",height:p.height+"px",borderWidth:p.borderWidth};if(p.borderColor){var q=/#[1-90a-f]+/gi;var r=a(p.borderColor,q);t=g.extend(t,{borderTopColor:r[0],borderRightColor:r[1],borderBottomColor:r[2],borderLeftColor:r[3]})}t=(p.textColor)?g.extend(t,{color:p.textColor}):t;t=(p.boxColor)?g.extend(t,{backgroundColor:p.boxColor}):t;g("#cee_box").animate(t,p.animSpeed,p.easing,function(){var B=g(this).append(v).children().hide();var A=B.length;var C=true;B.fadeIn(p.fadeIn,function(){if(g(this).is("#cee_iframeContent")){C=false}if(C&&this==B[A-1]){g.fn.ceebox.onload()}});if(p.modal===true){g("#cee_overlay").removeClass("cee_close")}else{g("<a href='#' id='cee_closeBtn' class='cee_close' title='Close'>close</a>").prependTo("#cee_box");if(p.gallery){l(p.gallery,u,p)}k(z,u,p.fadeOut)}})};g.fn.ceebox.closebox=function(q,p){q=q||1;g("#cee_box").fadeOut(q);g("#cee_overlay").fadeOut((typeof q=="number")?q*2:"slow",function(){g("#cee_box,#cee_overlay,#cee_HideSelect,#cee_load").unbind().trigger("unload").remove();if(d(p)){p()}else{if(d(c.unload)){c.unload()}}c.unload=null});document.onkeydown=null};g.fn.ceebox.onload=function(p){g("#cee_load").hide(300).fadeOut(600,function(){g(this).remove()});if(d(c.action)){c.action();c.action=null}if(d(c.onload)){c.onload();c.onload=null}};var c={};function n(r,q,p){c.vidRegex=function(){var s="";g.each(g.fn.ceebox.videos,function(w,t){if(t.siteRgx!==null&&typeof t.siteRgx!=="string"){var u=String(t.siteRgx);s=s+u.slice(1,u.length-2)+"|"}});return new RegExp(s+"\\.swf$","i")}();c.userAgent=navigator.userAgent;g(".cee_close").die().live("click",function(){g.fn.ceebox.closebox();return false});if(p!=false){g(r).each(function(s){o(this,s,q,p)})}g(r).live("click",function(v){var w=g(v.target).closest("[href]");var t=w.data("ceebox");if(t){var s=(t.opts)?g.extend({},q,t.opts):q;g.fn.ceebox.overlay(s);if(t.type=="image"){var u=new Image();u.onload=function(){var y=u.width,z=u.height;s.imageWidth=e(y,g.fn.ceebox.defaults.imageWidth);s.imageHeight=e(z,g.fn.ceebox.defaults.imageHeight);s.imageRatio=y/z;g.fn.ceebox.popup(w,g.extend(s,{type:t.type},{gallery:t.gallery}))};u.src=g(w).attr("href")}else{g.fn.ceebox.popup(w,g.extend(s,{type:t.type},{gallery:t.gallery}))}return false}})}var o=function(A,u,p,s){var t,v=[],r=[],w=0;(g(A).is("[href]"))?t=g(A):t=g(A).find("[href]");var q={image:function(B,C){if(C&&C.match(/\bimage\b/i)){return true}else{return B.match(/\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/i)||false}},video:function(B,C){if(C&&C.match(/\bvideo\b/i)){return true}else{return B.match(c.vidRegex)||false}},html:function(B){return true}};var z=t.length;t.each(function(D){var E=this;var C=g.metadata?g(E).metadata():false;var B=C?g.extend({},p,C):p;g.each(q,function(G){if(q[G](g(E).attr("href"),g(E).attr("rel"))&&B[G]){var F=false;if(B[G+"Gallery"]===true){r[r.length]=D;F=true}v[v.length]={linkObj:E,type:G,gallery:F,linkOpts:B};return false}})});var y=r.length;g.each(v,function(C){if(v[C].gallery){var B={parentId:u,gNum:w,gLen:y};if(w>0){B.prevId=r[w-1]}if(w<y-1){B.nextId=r[w+1]}w++}if(!g.support.opacity&&g(A).is("map")){g(v[C].linkObj).click(function(D){D.preventDefault()})}g.data(v[C].linkObj,"ceebox",{type:v[C].type,opts:v[C].linkOpts,gallery:B})})};var f=function(u,A){var t=A[A.type+"Width"];var v=A[A.type+"Height"];var y=A[A.type+"Ratio"]||t/v;var s=g(u).attr("rel");if(s&&s!==""){var q={};g.each(g.fn.ceebox.relMatch,function(r,p){q[r]=p.exec(s)});if(q.modal){A.modal=true}if(q.nonmodal){A.modal=false}if(q.width){t=Number(j(q.width))}if(q.height){v=Number(j(q.height))}if(q.ratio){y=j(q.ratio);y=(Number(y))?Number(y):String(y)}if(q.videoSrc){this.videoSrc=String(j(q.videoSrc))}if(q.videoId){this.videoId=String(j(q.videoId))}}var z=i(A.margin);t=e(t,z.width);v=e(v,z.height);if(y){if(!Number(y)){y=(g.fn.ceebox.ratios[y])?Number(g.fn.ceebox.ratios[y]):1}if(t/v>y){t=parseInt(v*y,10)}if(t/v<y){v=parseInt(t/y,10)}}this.modal=A.modal;this.href=g(u).attr("href");this.title=g(u).attr("title")||u.t||"";this.titlebox=(A.titles)?"<div id='cee_title'><h2>"+this.title+"</h2></div>":"";this.width=t;this.height=v;this.rel=s;this.iPhoneRedirect=A.iPhoneRedirect};var h={image:function(){this.content="<img id='cee_img' src='"+this.href+"' width='"+this.width+"' height='"+this.height+"' alt='"+this.title+"'/>"+this.titlebox},video:function(){var r="",q=this;var p=function(){var t=this,u=q.videoId;t.flashvars=t.param={};t.src=q.videoSrc||q.href;t.width=q.width;t.height=q.height;g.each(g.fn.ceebox.videos,function(y,w){if(w.siteRgx&&typeof w.siteRgx!="string"&&w.siteRgx.test(q.href)){if(w.idRgx){w.idRgx=new RegExp(w.idRgx);u=String(j(w.idRgx.exec(q.href)))}t.src=(w.src)?w.src.replace("[id]",u):t.src;if(w.flashvars){g.each(w.flashvars,function(v,z){if(typeof z=="string"){t.flashvars[v]=z.replace("[id]",u)}})}if(w.param){g.each(w.param,function(v,z){if(typeof z=="string"){t.param[v]=z.replace("[id]",u)}})}t.width=w.width||t.width;t.height=w.height||t.height;t.site=y;return}});return t}();if(g.flash.hasVersion(8)){this.width=p.width;this.height=p.height;this.action=function(){g("#cee_vid").flash({swf:p.src,params:g.extend(g.fn.ceebox.videos.base.param,p.param),flashvars:g.extend(g.fn.ceebox.videos.base.flashvars,p.flashvars),width:p.width,height:p.height})}}else{this.width=400;this.height=200;if(((c.userAgent.match(/iPhone/i))&&this.iPhoneRedirect)||((c.userAgent.match(/iPod/i))&&this.iPhoneRedirect)){var s=this.href;this.action=function(){g.fn.ceebox.closebox(400,function(){window.location=s})}}else{p.site=p.site||"SWF file";r="<p style='margin:20px'>Adobe Flash 8 or higher is required to view this movie. You can either:</p><ul><li>Follow link to <a href='"+this.href+"'>"+p.site+" </a></li><li>or <a href='http://www.adobe.com/products/flashplayer/'>Install Flash</a></li><li> or <a href='#' class='cee_close'>Close This Popup</a></li></ul>"}}this.content="<div id='cee_vid' style='width:"+this.width+"px;height:"+this.height+"px;'>"+r+"</div>"+this.titlebox},html:function(){var s=this.href,t=this.rel;var q=[s.match(/[a-zA-Z0-9_\.]+\.[a-zA-Z]{2,4}/i),s.match(/^http:+/),(t)?t.match(/^iframe/):false];if((document.domain==q[0]&&q[1]&&!q[2])||(!q[1]&&!q[2])){var u,p=(u=s.match(/#[a-zA-Z0-9_\-]+/))?String(s.split("#")[0]+" "+u):s;this.action=function(){g("#cee_ajax").load(p)};this.content=this.titlebox+"<div id='cee_ajax' style='width:"+(this.width-30)+"px;height:"+(this.height-20)+"px'></div>"}else{g("#cee_iframe").remove();this.content=this.titlebox+"<iframe frameborder='0' hspace='0' src='"+s+"' id='cee_iframeContent' name='cee_iframeContent"+Math.round(Math.random()*1000)+"' onload='jQuery.fn.ceebox.onload()' style='width:"+(this.width)+"px;height:"+(this.height)+"px;' > </iframe>"}}};function i(p){var q=document.documentElement;p=p||100;this.width=(window.innerWidth||self.innerWidth||(q&&q.clientWidth)||document.body.clientWidth)-p;this.height=(window.innerHeight||self.innerHeight||(q&&q.clientHeight)||document.body.clientHeight)-p;return this}function m(s){var t="fixed",q=0,r=/[0-9]+/g,p=a(s.borderWidth,r);if(!window.XMLHttpRequest){if(g("#cee_HideSelect")===null){g("body").append("<iframe id='cee_HideSelect'></iframe>")}t="absolute";q=parseInt((document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop),10)}this.mleft=parseInt(-1*((s.width)/2+Number(p[3])),10);this.mtop=parseInt(-1*((s.height)/2+Number(p[0])),10)+q;this.position=t;return this}function a(r,s){var q=r.match(s),t=[],p=q.length;if(p>1){t[0]=q[0];t[1]=q[1];t[2]=(p==2)?q[0]:q[2];t[3]=(p==4)?q[3]:q[1]}else{t=[q,q,q,q]}return t}function k(){document.onkeydown=function(q){q=q||window.event;var p=q.keyCode||q.which;switch(p){case 13:return false;case 27:g.fn.ceebox.closebox();document.onkeydown=null;break;case 188:case 37:g("#cee_prev").trigger("click");break;case 190:case 39:g("#cee_next").trigger("click");break;default:break}return true}}function l(z,v,r){var y=r.height,A=r.width,t=r.titleHeight,s=r.padding;var q={image:{w:parseInt(A/2,10),h:y-t-2*s,top:s,bgtop:(y-t-2*s)/2},video:{w:60,h:80,top:parseInt(((y-t-10)-2*s)/2,10),bgtop:24}};q.html=q.video;function u(B,F){var D,p=q[r.type].bgtop,E=(p-2000),w="px";(B=="prev")?D=[{left:0},"left"]:D=[{right:0},x="right"];var C=function(G){return g.extend({zIndex:105,width:q[r.type].w+w,height:q[r.type].h+w,position:"absolute",top:q[r.type].top,backgroundPosition:D[1]+" "+G+w},D[0])};g("<a href='#'></a>").text(B).attr({id:"cee_"+B}).css(C(E)).hover(function(){g(this).css(C(p))},function(){g(this).css(C(E))}).one("click",function(G){G.preventDefault();(function(J,L,K){g("#cee_prev,#cee_next").unbind().click(function(){return false});document.onkeydown=null;var I=g("#cee_box").children(),H=I.length;I.fadeOut(K,function(){g(this).remove();if(this==I[H-1]){J.eq(L).trigger("click")}})})(v,F,r.fadeOut)}).appendTo("#cee_box")}if(z.prevId>=0){u("prev",z.prevId)}if(z.nextId){u("next",z.nextId)}g("#cee_title").append("<div id='cee_count'>Item "+(z.gNum+1)+" of "+z.gLen+"</div>")}function e(q,p){return((q&&q<p)||!p)?q:p}function d(p){return typeof p=="function"}function j(q){var p=q.length;return(p>1)?q[p-1]:q}function b(q,p,r){if(debugging===true){var t="",s="[ceebox]("+(p||"")+")";(g.isArray(q)||typeof q=="object"||typeof q=="function")?g.each(q,function(u,v){t=t+u+":"+v+", "}):t=q;if(window.console&&window.console.log){window.console.log(s+t)}else{if(g("#debug").size()===0){g("<ul id='debug'></ul>").appendTo("body").css({border:"1px solid #ccf",position:"fixed",top:"10px",right:"10px",width:"300px",padding:"10px",listStyle:"square"});g("<li>").css({margin:"0 0 5px"}).appendTo("#debug").append(s).wrapInner("<b></b>").append(" "+t)}}}}})(jQuery);