(function(a){function o(b,c,d){if(debugging===true){var e="",f="[ceebox]("+(c||"")+")";a.isArray(b)||typeof b=="object"||typeof b=="function"?a.each(b,function(a,b){e=e+a+":"+b+", "}):e=b;if(window.console&&window.console.log){window.console.log(f+e)}else{if(a("#debug").size()===0){a("<ul id='debug'></ul>").appendTo("body").css({border:"1px solid #ccf",position:"fixed",top:"10px",right:"10px",width:"300px",padding:"10px",listStyle:"square"});a("<li>").css({margin:"0 0 5px"}).appendTo("#debug").append(f).wrapInner("<b></b>").append(" "+e)}}}}function n(a){var b=a.length;return b>1?a[b-1]:a}function m(a){return typeof a=="function"}function l(a,b){return a&&a<b||!b?a:b}function k(b,c,d){function j(b,e){var f,g=i[d.type].bgtop,h=g-2e3,j="px";b=="prev"?f=[{left:0},"left"]:f=[{right:0},x="right"];var k=function(b){return a.extend({zIndex:105,width:i[d.type].w+j,height:i[d.type].h+j,position:"absolute",top:i[d.type].top,backgroundPosition:f[1]+" "+b+j},f[0])};a("<a href='#'></a>").text(b).attr({id:"cee_"+b}).css(k(h)).hover(function(){a(this).css(k(g))},function(){a(this).css(k(h))}).one("click",function(b){b.preventDefault();(function(b,c,d){a("#cee_prev,#cee_next").unbind().click(function(){return false});document.onkeydown=null;var e=a("#cee_box").children(),f=e.length;e.fadeOut(d,function(){a(this).remove();if(this==e[f-1]){b.eq(c).trigger("click")}})})(c,e,d.fadeOut)}).appendTo("#cee_box")}var e=d.height,f=d.width,g=d.titleHeight,h=d.padding;var i={image:{w:parseInt(f/2,10),h:e-g-2*h,top:h,bgtop:(e-g-2*h)/2},video:{w:60,h:80,top:parseInt((e-g-10-2*h)/2,10),bgtop:24}};i.html=i.video;if(b.prevId>=0){j("prev",b.prevId)}if(b.nextId){j("next",b.nextId)}a("#cee_title").append("<div id='cee_count'>Item "+(b.gNum+1)+" of "+b.gLen+"</div>")}function j(){document.onkeydown=function(b){b=b||window.event;var c=b.keyCode||b.which;switch(c){case 13:return false;case 27:a.fn.ceebox.closebox();document.onkeydown=null;break;case 188:case 37:a("#cee_prev").trigger("click");break;case 190:case 39:a("#cee_next").trigger("click");break;default:break}return true}}function i(a,b){var c=a.match(b),d=[],e=c.length;if(e>1){d[0]=c[0];d[1]=c[1];d[2]=e==2?c[0]:c[2];d[3]=e==4?c[3]:c[1]}else{d=[c,c,c,c]}return d}function h(b){var c="fixed",d=0,e=/[0-9]+/g,f=i(b.borderWidth,e);if(!window.XMLHttpRequest){if(a("#cee_HideSelect")===null){a("body").append("<iframe id='cee_HideSelect'></iframe>")}c="absolute";d=parseInt(document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop,10)}this.mleft=parseInt(-1*(b.width/2+Number(f[3])),10);this.mtop=parseInt(-1*(b.height/2+Number(f[0])),10)+d;this.position=c;return this}function g(a){var b=document.documentElement;a=a||100;this.width=(window.innerWidth||self.innerWidth||b&&b.clientWidth||document.body.clientWidth)-a;this.height=(window.innerHeight||self.innerHeight||b&&b.clientHeight||document.body.clientHeight)-a;return this}function c(c,e,f){b.vidRegex=function(){var b="";a.each(a.fn.ceebox.videos,function(a,c){if(c.siteRgx!==null&&typeof c.siteRgx!=="string"){var d=String(c.siteRgx);b=b+d.slice(1,d.length-2)+"|"}});return new RegExp(b+"\\.swf$","i")}();b.userAgent=navigator.userAgent;a(".cee_close").die().live("click",function(){a.fn.ceebox.closebox();return false});if(f!=false){a(c).each(function(a){d(this,a,e,f)})}a(c).live("click",function(b){var c=a(b.target).closest("[href]");var d=c.data("ceebox");if(d){var f=d.opts?a.extend({},e,d.opts):e;a.fn.ceebox.overlay(f);if(d.type=="image"){var g=new Image;g.onload=function(){var b=g.width,e=g.height;f.imageWidth=l(b,a.fn.ceebox.defaults.imageWidth);f.imageHeight=l(e,a.fn.ceebox.defaults.imageHeight);f.imageRatio=b/e;a.fn.ceebox.popup(c,a.extend(f,{type:d.type},{gallery:d.gallery}))};g.src=a(c).attr("href")}else{a.fn.ceebox.popup(c,a.extend(f,{type:d.type},{gallery:d.gallery}))}return false}})}a.ceebox={version:"2.1.5"};a.fn.ceebox=function(b){b=a.extend({selector:a(this).selector},a.fn.ceebox.defaults,b);var d=this;var e=a(this).selector;if(b.videoJSON){a.getJSON(b.videoJSON,function(f){a.extend(a.fn.ceebox.videos,f);c(d,b,e)})}else{c(d,b,e)}return this};a.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:"normal",easing:"swing",fadeOut:400,fadeIn:400,overlayColor:"#000",overlayOpacity:.8,boxColor:"",textColor:"",borderColor:"",borderWidth:"3px",padding:15,margin:150,onload:null,unload:null,videoJSON:null,iPhoneRedirect:true};a.fn.ceebox.ratios={"4:3":1.333,"3:2":1.5,"16:9":1.778,"1:1":1,square:1};a.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};a.fn.ceebox.loader="<div id='cee_load' style='z-index:105;top:50%;left:50%;position:fixed'></div>";a.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}};a.fn.ceebox.overlay=function(b){b=a.extend({width:60,height:30,type:"html"},a.fn.ceebox.defaults,b);if(a("#cee_overlay").size()===0){a("<div id='cee_overlay'></div>").css({opacity:b.overlayOpacity,position:"absolute",top:0,left:0,backgroundColor:b.overlayColor,width:"100%",height:a(document).height(),zIndex:100}).appendTo(a("body"))}if(a("#cee_box").size()===0){var c=h(b);var d={position:c.position,zIndex:102,top:"50%",left:"50%",height:b.height+"px",width:b.width+"px",marginLeft:c.mleft+"px",marginTop:c.mtop+"px",opacity:0,borderWidth:b.borderWidth,borderColor:b.borderColor,backgroundColor:b.boxColor,color:b.textColor};a("<div id='cee_box'></div>").css(d).appendTo("body").animate({opacity:1},b.animSpeed,function(){a("#cee_overlay").addClass("cee_close")})}a("#cee_box").removeClass().addClass("cee_"+b.type);if(a("#cee_load").size()===0){a(a.fn.ceebox.loader).appendTo("body")}a("#cee_load").show("fast").animate({opacity:1},"fast")};a.fn.ceebox.popup=function(c,d){var l=g(d.margin);d=a.extend({width:l.width,height:l.height,modal:false,type:"html",onload:null},a.fn.ceebox.defaults,d);var m,n;if(a(c).is("a,area,input")&&(d.type=="html"||d.type=="image"||d.type=="video")){if(d.gallery){n=a(d.selector).eq(d.gallery.parentId).find("a[href],area[href],input[href]")}f[d.type].prototype=new e(c,d);var o=new f[d.type];c=o.content;d.action=o.action;d.modal=o.modal;if(d.titles){d.titleHeight=a(o.titlebox).contents().contents().wrap("<div></div>").parent().attr("id","ceetitletest").css({position:"absolute",top:"-300px",width:o.width+"px"}).appendTo("body").height();a("#ceetitletest").remove();d.titleHeight=d.titleHeight>=10?d.titleHeight+20:30}else{d.titleHeight=0}d.width=o.width+2*d.padding;d.height=o.height+d.titleHeight+2*d.padding}a.fn.ceebox.overlay(d);b.action=d.action;b.onload=d.onload;b.unload=d.unload;var p=h(d);var q={marginLeft:p.mleft,marginTop:p.mtop,width:d.width+"px",height:d.height+"px",borderWidth:d.borderWidth};if(d.borderColor){var r=/#[1-90a-f]+/gi;var s=i(d.borderColor,r);q=a.extend(q,{borderTopColor:s[0],borderRightColor:s[1],borderBottomColor:s[2],borderLeftColor:s[3]})}q=d.textColor?a.extend(q,{color:d.textColor}):q;q=d.boxColor?a.extend(q,{backgroundColor:d.boxColor}):q;a("#cee_box").animate(q,d.animSpeed,d.easing,function(){var b=a(this).append(c).children().hide();var e=b.length;var f=true;b.fadeIn(d.fadeIn,function(){if(a(this).is("#cee_iframeContent")){f=false}if(f&&this==b[e-1]){a.fn.ceebox.onload()}});if(d.modal===true){a("#cee_overlay").removeClass("cee_close")}else{a("<a href='#' id='cee_closeBtn' class='cee_close' title='Close'>close</a>").prependTo("#cee_box");if(d.gallery){k(d.gallery,n,d)}j(m,n,d.fadeOut)}})};a.fn.ceebox.closebox=function(c,d){c=c||400;a("#cee_box").fadeOut(c);a("#cee_overlay").fadeOut(typeof c=="number"?c*2:"slow",function(){a("#cee_box,#cee_overlay,#cee_HideSelect,#cee_load").unbind().trigger("unload").remove();if(m(d)){d()}else if(m(b.unload)){b.unload()}b.unload=null});document.onkeydown=null};a.fn.ceebox.onload=function(c){a("#cee_load").hide(300).fadeOut(600,function(){a(this).remove()});if(m(b.action)){b.action();b.action=null}if(m(b.onload)){b.onload();b.onload=null}};var b={};var d=function(c,d,e,f){var g,h=[],i=[],j=0;a(c).is("[href]")?g=a(c):g=a(c).find("[href]");var k={image:function(a,b){if(b&&b.match(/\bimage\b/i)){return true}else{return a.match(/\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/i)||false}},video:function(a,c){if(c&&c.match(/\bvideo\b/i)){return true}else{return a.match(b.vidRegex)||false}},html:function(a){return true}};var l=g.length;g.each(function(b){var c=this;var d=a.metadata?a(c).metadata():false;var f=d?a.extend({},e,d):e;a.each(k,function(d){if(k[d](a(c).attr("href"),a(c).attr("rel"))&&f[d]){var e=false;if(f[d+"Gallery"]===true){i[i.length]=b;e=true}h[h.length]={linkObj:c,type:d,gallery:e,linkOpts:f};return false}})});var m=i.length;a.each(h,function(b){if(h[b].gallery){var e={parentId:d,gNum:j,gLen:m};if(j>0){e.prevId=i[j-1]}if(j<m-1){e.nextId=i[j+1]}j++}if(!a.support.opacity&&a(c).is("map")){a(h[b].linkObj).click(function(a){a.preventDefault()})}a.data(h[b].linkObj,"ceebox",{type:h[b].type,opts:h[b].linkOpts,gallery:e})})};var e=function(b,c){var d=c[c.type+"Width"];var e=c[c.type+"Height"];var f=c[c.type+"Ratio"]||d/e;var h=a(b).attr("rel");if(h&&h!==""){var i={};a.each(a.fn.ceebox.relMatch,function(a,b){i[a]=b.exec(h)});if(i.modal){c.modal=true}if(i.nonmodal){c.modal=false}if(i.width){d=Number(n(i.width))}if(i.height){e=Number(n(i.height))}if(i.ratio){f=n(i.ratio);f=Number(f)?Number(f):String(f)}if(i.videoSrc){this.videoSrc=String(n(i.videoSrc))}if(i.videoId){this.videoId=String(n(i.videoId))}}var j=g(c.margin);d=l(d,j.width);e=l(e,j.height);if(f){if(!Number(f)){f=a.fn.ceebox.ratios[f]?Number(a.fn.ceebox.ratios[f]):1}if(d/e>f){d=parseInt(e*f,10)}if(d/e<f){e=parseInt(d/f,10)}}this.modal=c.modal;this.href=a(b).attr("href");this.title=a(b).attr("title")||b.t||"";this.titlebox=c.titles?"<div id='cee_title'><h2>"+this.title+"</h2></div>":"";this.width=d;this.height=e;this.rel=h;this.iPhoneRedirect=c.iPhoneRedirect};var f={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 c="",d=this;var e=function(){var b=this,c=d.videoId;b.flashvars=b.param={};b.src=d.videoSrc||d.href;b.width=d.width;b.height=d.height;a.each(a.fn.ceebox.videos,function(e,f){if(f.siteRgx&&typeof f.siteRgx!="string"&&f.siteRgx.test(d.href)){if(f.idRgx){f.idRgx=new RegExp(f.idRgx);c=String(n(f.idRgx.exec(d.href)))}b.src=f.src?f.src.replace("[id]",c):b.src;if(f.flashvars){a.each(f.flashvars,function(a,d){if(typeof d=="string"){b.flashvars[a]=d.replace("[id]",c)}})}if(f.param){a.each(f.param,function(a,d){if(typeof d=="string"){b.param[a]=d.replace("[id]",c)}})}b.width=f.width||b.width;b.height=f.height||b.height;b.site=e;return}});return b}();if(a.flash.hasVersion(8)){this.width=e.width;this.height=e.height;this.action=function(){a("#cee_vid").flash({swf:e.src,params:a.extend(a.fn.ceebox.videos.base.param,e.param),flashvars:a.extend(a.fn.ceebox.videos.base.flashvars,e.flashvars),width:e.width,height:e.height})}}else{this.width=400;this.height=200;if(b.userAgent.match(/iPhone/i)&&this.iPhoneRedirect||b.userAgent.match(/iPod/i)&&this.iPhoneRedirect){var f=this.href;this.action=function(){a.fn.ceebox.closebox(400,function(){window.location=f})}}else{e.site=e.site||"SWF file";c="<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+"'>"+e.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;'>"+c+"</div>"+this.titlebox},html:function(){var b=this.href,c=this.rel;var d=[b.match(/[a-zA-Z0-9_\.]+\.[a-zA-Z]{2,4}/i),b.match(/^http:+/),c?c.match(/^iframe/):false];if(document.domain==d[0]&&d[1]&&!d[2]||!d[1]&&!d[2]){var e,f=(e=b.match(/#[a-zA-Z0-9_\-]+/))?String(b.split("#")[0]+" "+e):b;this.action=function(){a("#cee_ajax").load(f)};this.content=this.titlebox+"<div id='cee_ajax' style='width:"+(this.width-30)+"px;height:"+(this.height-20)+"px'></div>"}else{a("#cee_iframe").remove();this.content=this.titlebox+"<iframe frameborder='0' hspace='0' src='"+b+"' id='cee_iframeContent' name='cee_iframeContent"+Math.round(Math.random()*1e3)+"' onload='jQuery.fn.ceebox.onload()' style='width:"+this.width+"px;height:"+this.height+"px;' > </iframe>"}}}})(jQuery)
