/*
        FlowBox V1.07 an enhanced branch of the colorbox v1.1.6 - built specifically for integration of FlowPlayer to web pages
        FlowBox and the additional methods contained herein ¬© 2009 SymfoniP.com - Ronan Cashell / Kevin Burns- all rights reserved
*/
(function(k){var z,n,f,r,b,m,E,A,q,t,x,l,j,C,h,w,e,p,B,u,v,g,d,o,s;function a(){l.css({position:"absolute",width:k(window).width(),height:k(window).height(),top:k(window).scrollTop(),left:k(window).scrollLeft()})}function c(F){if(F.keyCode==37){F.preventDefault();k(document).unbind("keydown",c);k("a#contentPrevious").click()}else{if(F.keyCode==39){F.preventDefault();k(document).unbind("keydown",c);k("a#contentNext").click()}}}function D(){if(k("#flowboxInlineTemp").length>0){C.children().each(function(){if(this.id=="contentCurrent"||this.id=="contentNext"||this.id=="contentPrevious"||this.id=="contentTitle"){k(this).remove()}});C.children().insertAfter("#flowboxInlineTemp")}if(k("#modalLoadedContent #modalVideo")){k("#modalVideo").appendTo("body").hide()}if(A){k(A).remove()}}function y(F,G){return(typeof F=="string")?(F.match(/%/)?(G/100)*parseInt(F,10):parseInt(F,10)):F}jQuery.noConflict();jQuery(document).ready(function(F){F("body").append(l=F('<div id="modalBackgroundOverlay" />').hide(),q=F('<div id="flowbox" />').css("opacity",0));F('<div id="modalWrap" />').appendTo(q).append(F('<div><div id="borderTopLeft" /><div id="borderTopCenter" /><div id="borderTopRight" /></div>'),e=F('<div id="borderMiddleLeft" />'),j=F('<div id="modalContent" />'),p=F('<div id="borderMiddleRight" />'),F('<div><div id="borderBottomLeft" /><div id="borderBottomCenter" /><div id="borderBottomRight" /></div>'));j.append(C=F('<div id="modalLoadedContent"><a id="contentNext" href="#"></a><a id="contentPrevious" href="#"></a><span id="contentCurrent"></span><span id="contentTitle"></span><div id="preloadPrevious"></div><div id="preloadNext"></div><div id="preloadClose"></div></div>'),$flowPlayer=F('<div id="modalVideo" />'),x=F('<div id="modalLoadingOverlay" />'),h=F('<a id="modalClose" href="#"></a>'));F(document).bind("keydown.colorClose",function(G){if(G.keyCode==27){G.preventDefault();F.fn.flowbox.close()}});h.click(function(G){G.preventDefault();F.fn.flowbox.close()});w=F("#borderTopCenter");B=F("#borderBottomCenter");r=w.height()+B.height()+j.outerHeight(true)-j.height();b=e.width()+p.width()+j.outerWidth(true)-j.width();f=C.outerHeight(true);n=C.outerWidth(true);C.empty();q.css({"padding-bottom":r,"padding-right":b}).hide();F("#contentPrevious, #contentNext, #modalClose").live("mouseover",function(){F(this).addClass("hover")});F("#contentPrevious, #contentNext, #modalClose").live("mouseout",function(){F(this).removeClass("hover")})});k.fn.flowbox=function(I,G,N,O){function F(S,W,U,R){var Q=document.documentElement.clientHeight;var T=Q/2-W/2;var P=document.documentElement.clientWidth/2-S/2;if(W>Q){T-=(W-Q)}if(T<0){T=0}if(P<0){P=0}T+=k(window).scrollTop();P+=k(window).scrollLeft();S=S-b;W=W-r;function V(X){j[0].style.width=w[0].style.width=B[0].style.width=X.style.width;j[0].style.height=e[0].style.height=p[0].style.height=X.style.height}q.animate({height:W,width:S,top:T,left:P},{duration:U,complete:function(){if(R){R()}V(this);if(k.browser.msie&&k.browser.version<7){a()}},step:function(){V(this)}})}var L=[];function M(){if(z.preloading!==false&&E.length>1&&E[m].href.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(.*))?$/i)){var Q,P;Q=m>0?E[m-1].href:E[E.length-1].href;P=m<E.length-1?E[m+1].href:E[0].href;return[k("<img />").attr("src",P),k("<img />").attr("src",Q)]}return false}function H(){x.show();if(k(this).attr("id")=="contentPrevious"){m=m>0?m-1:E.length-1}else{m=m<E.length-1?m+1:0}J(E[m].href,E[m].title);return false}function K(S,R,U){if(q.data("open")!==true){return false}var V=U.transition=="none"?0:U.transitionSpeed;C.remove();C=k(S);centerVideo=0;if(E[m].href.match(/\.(flv|mp4|m4v|mov|FLV|MP4|M4V|MOV)(?:\?([^#]*))?(?:#(.*))?$/i)){centerVideo=u}else{centerVideo=0}C.hide().appendTo("body").css({width:(U.fixedWidth)?U.fixedWidth-n-b:C.width()-centerVideo}).css({height:(U.fixedHeight)?U.fixedHeight-f-r:C.height()+centerVideo}).attr({id:"modalLoadedContent"}).append(R).prependTo(j);if(k("#modalPhoto").length>0&&U.fixedHeight){var Q=(parseInt(C[0].style.height,10)-parseInt(k("#modalPhoto")[0].style.height,10))/2;k("#modalPhoto").css({marginTop:(Q>0?Q:0)})}function P(W){F(parseInt(C[0].style.width,10)+n+b,parseInt(C[0].style.height,10)+f+r,W,function(){if(q.data("open")!==true){return false}C.show();x.hide();k(document).bind("keydown",c);if(O){O()}if(U.transition==="fade"){q.animate({opacity:1},V)}return true})}if(U.transition=="fade"){q.animate({opacity:0},V,function(){P(0)})}else{P(V)}var T=M();return true}function J(Q,R){if(E[m].name=="iframe"){z=G}else{z=I}D();var P="";if(!z.removeNullTitlePad||E.length>1){P="<p id='contentTitle'>"+R+"</p>"}if(E.length>1){P+="<span id='contentCurrent'>"+z.contentCurrent+"</span>";P=P.replace(/\{current\}/,m+1).replace(/\{total\}/,E.length);P+="<a id='contentPrevious' href='#'>"+z.contentPrevious+"</a><a id='contentNext' href='#'>"+z.contentNext+"</a> "}if(E[m].name=="inline"||z.inline){tmp=Q.split("/");tmp1=tmp[tmp.length-1].split("#");Q="#"+tmp1[tmp1.length-1];A=k('<div id="flowboxInlineTemp" />').hide().insertBefore(k(Q)[0]);K(k(Q).wrapAll("<div />").parent(),P,z)}else{if(E[m].name=="iframe"||z.iframe){K(k("<div><iframe name='iframe_"+new Date().getTime()+" 'frameborder=0 src ="+Q+"></iframe></div>"),P,z)}else{if(Q.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(.*))?$/i)){A=new Image();A.onload=function(){A.onload=null;K(k("<div />").css({width:this.width,height:this.height}).append(k(this).css({width:this.width,height:this.height,display:"block",margin:"auto"}).attr("id","modalPhoto")),P,z);if(E.length>1){k(this).css({cursor:"pointer"}).click(H)}};A.src=Q}else{if(Q.match(/\.(flv|mp4|m4v|mov|FLV|MP4|M4V|MOV)(?:\?([^#]*))?(?:#(.*))?$/i)){if(typeof defWidth=="undefined"){defWidth=parseInt(k("#modalVideo").width());defHeight=parseInt(k("#modalVideo").height())}classWidth=defWidth;classHeight=defHeight;anchorClasses=k(E[m]).attr("class").split(" ");for(i=0;i<anchorClasses.length;i++){className=anchorClasses[i];if(className.substring(0,3)=="sym"){tmpDim=className.substring(3).split("x");classWidth=parseInt(tmpDim[0]);classHeight=parseInt(tmpDim[1])}}k("#modalVideo").width(classWidth).height(classHeight);K(k("<div />").css({width:(classWidth+u),height:(classHeight+u)}),P,z);k("#modalVideo").prependTo(k("#modalLoadedContent")).show();if(E.length>1){k(this).css({cursor:"pointer"}).click(H)}if(typeof N.flowplayerloc!="undefined"){g=N.flowplayerloc}else{g="/swf/flowplayer-3.1.0.swf"}N.clip.url=Q;N.screen.width=classWidth;N.screen.height=classHeight;$f("modalVideo",g,N)}else{A=k("<div />").load(Q,function(S,T){if(T=="success"){K(k(this),P,z)}else{K(k("<p>Request unsuccessful.</p>"))}})}}}}}if(k(this).attr("name")=="iframe"){if(G.fixedWidth){G.fixedWidth=y(G.fixedWidth,document.documentElement.clientWidth)}if(G.fixedHeight){G.fixedHeight=y(G.fixedHeight,document.documentElement.clientHeight)}z=G}else{z=I}k(this).unbind("click.flowbox").bind("click.flowbox",function(){if(k(this).attr("name")=="iframe"){z=G}else{z=I}if(typeof z.bgOpacity!="undefined"&&parseFloat(z.bgOpacity)>=1){z.bgOpacity=parseInt(z.bgOpacity)/100}u=5;if(z.fixedWidth){z.fixedWidth=y(z.fixedWidth,document.documentElement.clientWidth)}if(z.fixedHeight){z.fixedHeight=y(z.fixedHeight,document.documentElement.clientHeight)}if(this.rel&&this.rel!="nofollow"&&this.rel!="self"){E=k("a[rel='"+this.rel+"']");m=k(E).index(this)}else{E=k(this);m=0}if(q.data("open")!==true){k(document).bind("keydown",c);h.html(z.modalClose);l.css({opacity:z.bgOpacity}).show();q.data("open",true).css({opacity:1});if(z.overlayClass!=""){l.attr("class",z.overlayClass)}else{if(z.overlayImage!=""){l.css({"background-image":"url("+z.overlayImage+")","background-repeat":"repeat","background-position":"0 0",opacity:z.bgOpacity})}else{l.css({"background-color":z.overlayColor,opacity:z.bgOpacity})}}F(y(z.initialWidth,document.documentElement.clientWidth),y(z.initialHeight,document.documentElement.clientHeight),0);if(k.browser.msie&&k.browser.version<7){k(window).bind("resize scroll",a)}}J(z.href?z.href:E[m].href,z.title?z.title:E[m].title);k("a#contentPrevious, a#contentNext").die().live("click",H);if(z.overlayClose!==false){l.css({cursor:"pointer"}).click(function(){k.fn.flowbox.close()})}return false});if(z.open!==false&&q.data("open")!==true){k(this).triggerHandler("click.flowbox")}return this.each(function(){})};k.fn.flowbox.close=function(){k("#contentTitle").remove();D();l.css({cursor:"auto"}).fadeOut("fast");q.stop(true,false).removeData("open").fadeOut("fast",function(){C.remove()});k(document).unbind("keydown",c);k(window).unbind("resize scroll",a);return false};k.fn.flowbox.settings={transition:"elastic",transitionSpeed:275,initialWidth:"400",initialHeight:"400",fixedWidth:false,fixedHeight:false,inline:false,iframe:false,href:false,removeNullTitlePad:false,title:false,bgOpacity:0.5,preloading:true,contentCurrent:" {current} of {total}",contentPrevious:"previous",contentNext:"next",modalClose:"close",open:false,overlayClose:true,overlayCursor:"pointer",overlayImage:"",overlayColor:"#7f7f7f",overlayClass:"",showImages:true,flowboxVideo:"a[href$=flv],a[href$=mp4],a[href$=m4v],a[href$=mov],a[href$=MOV],a[href$=MP4],a[href$=M4V]",flowboxImage:"a[href$=png],a[href$=PNG],a[href$=jpg],a[href$=JPG],a[href$=gif],a[href$=GIF]"};k.fn.flowbox.fp_settings={key:"",clip:{scaling:"scale",url:"",autoPlay:false,accelerated:true,autoBuffering:true},play:{label:"Play",replayLabel:"Play again"},logo:{url:"",fullscreenOnly:true,displayTime:15},screen:{width:640,height:360},plugins:{controls:{backgroundColor:"#131313",backgroundGradient:[0.3,0],autoHide:"always",all:false,play:true,mute:false,fullscreen:true,scrubber:true,height:20,buttonColor:"#8C838A",sliderColor:"#333333",progressColor:"#CCCCCC",bufferColor:"#666666"}}};k.fn.flowbox.initFlowbox=function(H,G,F){o=k.extend({},k.fn.flowbox.settings,H);d=k.extend({},k.fn.flowbox.fp_settings,F);lifb=k.extend({},o,G);lifb.iframe=true;if(o.showImages){k(k.fn.flowbox.settings.flowboxImage).flowbox(o,lifb,d)}k("a[name='iframe']").flowbox(o,lifb,d);k("a[name='inline'],a[name='flash'],a[name='ajax']").flowbox(o,lifb,d);k(k.fn.flowbox.settings.flowboxVideo).flowbox(o,lifb,d)}})(jQuery);
