/*
 * $Id: overlay-modal-v2.js,v 1.31 2010/12/23 16:38:11 florent Exp $
*/
/*
 * flowplayer.js 3.2.4. The Flowplayer API
 * 
 * Copyright 2009 Flowplayer Oy
 * 
 * This file is part of Flowplayer.
 * 
 * Flowplayer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Flowplayer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Flowplayer.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Date: 2010-08-25 12:48:46 +0000 (Wed, 25 Aug 2010)
 * Revision: 551 
 */
(function(){function H(O){console.log("$f.fireEvent",[].slice.call(O))
}function D(O){if(!O||typeof O!="object"){return O}var Q=new O.constructor();for(var P in O){if(O.hasOwnProperty(P)){Q[P]=D(O[P])}}return Q}function B(O,R){if(!O){return }var T,S=0,Q=O.length;if(Q===undefined){for(T in O){if(R.call(O[T],T,O[T])===false){break}}}else{for(var P=O[0];S<Q&&R.call(P,S,P)!==false;P=O[++S]){}}return O}function L(O){return document.getElementById(O)}function F(O,P,Q){if(typeof P!="object"){return O}if(O&&P){B(P,function(S,R){if(!Q||typeof R!="function"){O[S]=R}})}return O
}function A(O){var Q=O.indexOf(".");if(Q!=-1){var R=O.slice(0,Q)||"*";var S=O.slice(Q+1,O.length);var P=[];B(document.getElementsByTagName(R),function(){if(this.className&&this.className.indexOf(S)!=-1){P.push(this)}});return P}}function I(O){O=O||window.event;if(O.preventDefault){O.stopPropagation();O.preventDefault()}else{O.returnValue=false;O.cancelBubble=true}return false}function E(O,Q,P){O[Q]=O[Q]||[];O[Q].push(P)}function J(){return"_"+(""+Math.random()).slice(2,10)}var G=function(P,R,Q){var S=this,T={},O={};
S.index=R;if(typeof P=="string"){P={url:P}}F(this,P,true);B(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var W="on"+this;if(W.indexOf("*")!=-1){W=W.slice(0,W.length-1);var V="onBefore"+W.slice(2);S[V]=function(X){E(O,V,X);return S}}S[W]=function(X){E(O,W,X);return S};if(R==-1){if(S[V]){Q[V]=S[V]}if(S[W]){Q[W]=S[W]}}});F(this,{onCuepoint:function(V,W){if(arguments.length==1){T.embedded=[null,V];return S}if(typeof V=="number"){V=[V]
}var X=J();T[X]=[V,W];if(Q.isLoaded()){Q._api().fp_addCuepoints(V,R,X)}return S},update:function(W){F(S,W);if(Q.isLoaded()){Q._api().fp_updateClip(W,R)}var X=Q.getConfig();var V=(R==-1)?X.clip:X.playlist[R];F(V,W,true)},_fireEvent:function(Y,a,X,W){if(Y=="onLoad"){B(T,function(c,b){if(b[0]){Q._api().fp_addCuepoints(b[0],R,c)}});return false}W=W||S;if(Y=="onCuepoint"){var Z=T[a];if(Z){return Z[1].call(Q,W,X)}}if(a&&"onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(Y)!=-1){F(W,a);if(a.metaData){if(!W.duration){W.duration=a.metaData.duration
}else{W.fullDuration=a.metaData.duration}}}var V=true;B(O[Y],function(){V=this.call(Q,W,a,X)});return V}});if(P.onCuepoint){var U=P.onCuepoint;S.onCuepoint.apply(S,typeof U=="function"?[U]:U);delete P.onCuepoint}B(P,function(W,V){if(typeof V=="function"){E(O,W,V);delete P[W]}});if(R==-1){Q.onCuepoint=this.onCuepoint}};var C=function(T,R,S,P){var U=this,Q={},O=false;if(P){F(Q,P)}B(R,function(W,V){if(typeof V=="function"){Q[W]=V;delete R[W]}});F(this,{animate:function(Z,Y,V){if(!Z){return U}if(typeof Y=="function"){V=Y;
Y=500}if(typeof Z=="string"){var W=Z;Z={};Z[W]=Y;Y=500}if(V){var X=J();Q[X]=V}if(Y===undefined){Y=500}R=S._api().fp_animate(T,Z,Y,X);return U},css:function(W,V){if(V!==undefined){var X={};X[W]=V;W=X}R=S._api().fp_css(T,W);F(U,R);return U},show:function(){this.display="block";S._api().fp_showPlugin(T);return U},hide:function(){this.display="none";S._api().fp_hidePlugin(T);return U},toggle:function(){this.display=S._api().fp_togglePlugin(T);return U},fadeTo:function(Y,V,W){if(typeof V=="function"){W=V;
V=500}if(W){var X=J();Q[X]=W}this.display=S._api().fp_fadeTo(T,Y,V,X);this.opacity=Y;return U},fadeIn:function(V,W){return U.fadeTo(1,V,W)},fadeOut:function(V,W){return U.fadeTo(0,V,W)},getName:function(){return T},getPlayer:function(){return S},_fireEvent:function(X,Y,W){if(X=="onUpdate"){var Z=S._api().fp_getPlugin(T);if(!Z){return }F(U,Z);delete U.methods;if(!O){B(Z.methods,function(){var b=""+this;U[b]=function(){var d=[].slice.call(arguments);var c=S._api().fp_invoke(T,b,d);return c==="undefined"||c===undefined?U:c
}});O=true}}var V=Q[X];if(V){var a=V.apply(U,Y);if(X.slice(0,1)=="_"){delete Q[X]}return a}return U}})};function M(d,S,X){var R=this,T=null,Z=false,V,Y,U=[],P={},Q={},W,b,f,a,g,e;F(R,{id:function(){return W},isLoaded:function(){return(T!==null&&T.fp_play!==undefined&&!Z)},getParent:function(){return d},hide:function(h){if(h){d.style.height="0px"}if(R.isLoaded()){T.style.height="0px"}return R},show:function(){d.style.height=e+"px";if(R.isLoaded()){T.style.height=g+"px"}return R},isHidden:function(){return R.isLoaded()&&parseInt(T.style.height,10)===0
},load:function(h){if(!R.isLoaded()&&R._fireEvent("onBeforeLoad")!==false){var k=function(){V=d.innerHTML;if(V&&!flashembed.isSupported(S.version)){d.innerHTML=""}if(h){h.cached=true;E(Q,"onLoad",h)}flashembed(d,S,{config:X})};var j=0;B(N,function(){this.unload(function(l){if(++j==N.length){k()}})})}return R},unload:function(h){if(this.isFullscreen()&&/WebKit/i.test(navigator.userAgent)){if(h){h(false)}return R}if(V.replace(/\s/g,"")!==""){if(R._fireEvent("onBeforeUnload")===false){if(h){h(false)
}return R}Z=true;try{if(T){T.fp_close();R._fireEvent("onUnload")}}catch(k){}var j=function(){T=null;d.innerHTML=V;Z=false;if(h){h(true)}};setTimeout(j,50)}else{if(h){h(false)}}return R},getClip:function(h){if(h===undefined){h=a}return U[h]},getCommonClip:function(){return Y},getPlaylist:function(){return U},getPlugin:function(k){var h=P[k];if(!h&&R.isLoaded()){var j=R._api().fp_getPlugin(k);if(j){h=new C(k,j,R);P[k]=h}}return h},getScreen:function(){return R.getPlugin("screen")},getControls:function(){return R.getPlugin("controls")._fireEvent("onUpdate")
},getLogo:function(){try{return R.getPlugin("logo")._fireEvent("onUpdate")}catch(h){}},getPlay:function(){return R.getPlugin("play")._fireEvent("onUpdate")},getConfig:function(h){return h?D(X):X},getFlashParams:function(){return S},loadPlugin:function(j,k,o,h){if(typeof o=="function"){h=o;o={}}var l=h?J():"_";R._api().fp_loadPlugin(j,k,o,l);var m={};m[l]=h;var n=new C(j,null,R,m);P[j]=n;return n},getState:function(){return R.isLoaded()?T.fp_getState():-1},play:function(j,k){var h=function(){if(j!==undefined){R._api().fp_play(j,k)
}else{R._api().fp_play()}};if(R.isLoaded()){h()}else{if(Z){setTimeout(function(){R.play(j,k)},50)}else{R.load(function(){h()})}}return R},getVersion:function(){var h="flowplayer.js 3.2.4";if(R.isLoaded()){var j=T.fp_getVersion();j.push(h);return j}return h},_api:function(){if(!R.isLoaded()){throw"Flowplayer "+R.id()+" not loaded when calling an API method"}return T},setClip:function(h){R.setPlaylist([h]);return R},getIndex:function(){return f},_swfHeight:function(){return T.clientHeight}});B(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var j="on"+this;
if(j.indexOf("*")!=-1){j=j.slice(0,j.length-1);var h="onBefore"+j.slice(2);R[h]=function(k){E(Q,h,k);return R}}R[j]=function(k){E(Q,j,k);return R}});B(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled").split(","),function(){var h=this;R[h]=function(k,l){if(!R.isLoaded()){return R}var j=null;if(k!==undefined&&l!==undefined){j=T["fp_"+h](k,l)
}else{j=(k===undefined)?T["fp_"+h]():T["fp_"+h](k)}return j==="undefined"||j===undefined?R:j}});R._fireEvent=function(j){if(typeof j=="string"){j=[j]}var h=j[0],l=j[1],n=j[2],o=j[3],p=0;if(X.debug){H(j)}if(!R.isLoaded()&&h=="onLoad"&&l=="player"){T=T||L(b);g=R._swfHeight();B(U,function(){this._fireEvent("onLoad")});B(P,function(u,t){t._fireEvent("onUpdate")});Y._fireEvent("onLoad")}if(h=="onLoad"&&l!="player"){return }if(h=="onError"){if(typeof l=="string"||(typeof l=="number"&&typeof n=="number")){l=n;
n=o}}if(h=="onContextMenu"){B(X.contextMenu[l],function(u,t){t.call(R)});return }if(h=="onPluginEvent"||h=="onBeforePluginEvent"){var s=l.name||l;var r=P[s];if(r){r._fireEvent("onUpdate",l);return r._fireEvent(n,j.slice(3))}return }if(h=="onPlaylistReplace"){U=[];var m=0;B(l,function(){U.push(new G(this,m++,R))})}if(h=="onClipAdd"){if(l.isInStream){return }l=new G(l,n,R);U.splice(n,0,l);for(p=n+1;p<U.length;p++){U[p].index++}}var k=true;if(typeof l=="number"&&l<U.length){a=l;var q=U[l];if(q){k=q._fireEvent(h,n,o)
}if(!q||k!==false){k=Y._fireEvent(h,n,o,q)}}B(Q[h],function(){k=this.call(R,l,n);if(this.cached){Q[h].splice(p,1)}if(k===false){return false}p++});return k};function c(){if($f(d)){$f(d).getParent().innerHTML="";f=$f(d).getIndex();N[f]=R}else{N.push(R);f=N.length-1}e=parseInt(d.style.height,10)||d.clientHeight;W=d.id||"fp"+J();b=S.id||W+"_api";S.id=b;X.playerId=W;if(typeof X=="string"){X={clip:{url:X}}}if(typeof X.clip=="string"){X.clip={url:X.clip}}X.clip=X.clip||{};if(d.getAttribute("href",2)&&!X.clip.url){X.clip.url=d.getAttribute("href",2)
}Y=new G(X.clip,-1,R);X.playlist=X.playlist||[X.clip];var j=0;B(X.playlist,function(){var l=this;if(typeof l=="object"&&l.length){l={url:""+l}}B(X.clip,function(m,n){if(n!==undefined&&l[m]===undefined&&typeof n!="function"){l[m]=n}});X.playlist[j]=l;l=new G(l,j,R);U.push(l);j++});B(X,function(m,l){if(typeof l=="function"){if(Y[m]){Y[m](l)}else{E(Q,m,l)}delete X[m]}});B(X.plugins,function(m,l){if(l){P[m]=new C(m,l,R)}});if(!X.plugins||X.plugins.controls===undefined){P.controls=new C("controls",null,R)
}P.canvas=new C("canvas",null,R);V=d.innerHTML;function h(l){var m=R.hasiPadSupport&&R.hasiPadSupport();if(/iPad|iPhone|iPod/i.test(navigator.userAgent)&&!/.flv$/i.test(U[0].url)&&!m){return true}if(!R.isLoaded()&&R._fireEvent("onBeforeClick")!==false){R.load()}return I(l)}function k(){if(V.replace(/\s/g,"")!==""){if(d.addEventListener){d.addEventListener("click",h,false)}else{if(d.attachEvent){d.attachEvent("onclick",h)}}}else{if(d.addEventListener){d.addEventListener("click",I,false)}R.load()}}setTimeout(k,0)
}if(typeof d=="string"){var O=L(d);if(!O){throw"Flowplayer cannot access element: "+d}d=O;c()}else{c()}}var N=[];function K(O){this.length=O.length;this.each=function(P){B(O,P)};this.size=function(){return O.length}}window.flowplayer=window.$f=function(){var S=null;var T=arguments[0];if(!arguments.length){B(N,function(){if(this.isLoaded()){S=this;return false}});return S||N[0]}if(arguments.length==1){if(typeof T=="number"){return N[T]}else{if(T=="*"){return new K(N)}B(N,function(){if(this.id()==T.id||this.id()==T||this.getParent()==T){S=this;
return false}});return S}}if(arguments.length>1){var O=arguments[1],R=(arguments.length==3)?arguments[2]:{};if(typeof O=="string"){O={src:O}}O=F({bgcolor:"#000000",version:[9,0],expressInstall:"http://static.flowplayer.org/swf/expressinstall.swf",cachebusting:true},O);if(typeof T=="string"){if(T.indexOf(".")!=-1){var P=[];B(A(T),function(){P.push(new M(this,D(O),D(R)))});return new K(P)}else{var Q=L(T);return new M(Q!==null?Q:T,O,R)}}else{if(T){return new M(T,O,R)}}}return null};F(window.$f,{fireEvent:function(){var P=[].slice.call(arguments);
var O=$f(P[0]);return O?O._fireEvent(P.slice(1)):null},addPlugin:function(P,O){M.prototype[P]=O;return $f},each:B,extend:F});if(typeof jQuery=="function"){jQuery.fn.flowplayer=function(O,P){if(!arguments.length||typeof arguments[0]=="number"){var Q=[];this.each(function(){var R=$f(this);if(R){Q.push(R)}});return arguments.length?Q[arguments[0]]:new K(Q)}return this.each(function(){$f(this,D(O),P?D(P):{})})}}})();(function(){var D=document.all,B="http://www.adobe.com/go/getflashplayer",H=typeof jQuery=="function",F=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,I={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:[3,0],onFail:null,expressInstall:null,w3c:false,cachebusting:false};
if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function C(K,L){if(L){for(var M in L){if(L.hasOwnProperty(M)){K[M]=L[M]}}}return K}function J(M,N){var K=[];for(var L in M){if(M.hasOwnProperty(L)){K[L]=N(M[L])}}return K}window.flashembed=function(M,K,L){if(typeof M=="string"){M=document.getElementById(M.replace("#",""))}if(!M){return }if(typeof K=="string"){K={src:K}}return new G(M,C(C({},I),K),L)};var E=C(window.flashembed,{conf:I,getVersion:function(){var K,M;
try{M=navigator.plugins["Shockwave Flash"].description.slice(16)}catch(N){try{K=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");M=K&&K.GetVariable("$version")}catch(O){try{K=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");M=K&&K.GetVariable("$version")}catch(L){}}}M=F.exec(M);return M?[M[1],M[3]]:[0,0]},asString:function(L){if(L===null||L===undefined){return null}var M=typeof L;if(M=="object"&&L.push){M="array"}switch(M){case"string":L=L.replace(new RegExp('(["\\\\])',"g"),"\\$1");L=L.replace(/^\s?(\d+\.?\d+)%/,"$1pct");
return'"'+L+'"';case"array":return"["+J(L,function(O){return E.asString(O)}).join(",")+"]";case"function":return'"function()"';case"object":var K=[];for(var N in L){if(L.hasOwnProperty(N)){K.push('"'+N+'":'+E.asString(L[N]))}}return"{"+K.join(",")+"}"}return String(L).replace(/\s/g," ").replace(/\'/g,'"')},getHTML:function(P,L){P=C({},P);var Q='<object width="'+P.width+'" height="'+P.height+'" id="'+P.id+'" name="'+P.id+'"';if(P.cachebusting){P.src+=((P.src.indexOf("?")!=-1?"&":"?")+Math.random())
}if(P.w3c||!D){Q+=' data="'+P.src+'" type="application/x-shockwave-flash"'}else{Q+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'}Q+=">";if(P.w3c||D){Q+='<param name="movie" value="'+P.src+'" />'}P.width=P.height=P.id=P.w3c=P.src=null;P.onFail=P.version=P.expressInstall=null;for(var K in P){if(P[K]){Q+='<param name="'+K+'" value="'+P[K]+'" />'}}var O="";if(L){for(var N in L){if(L[N]){var M=L[N];O+=N+"="+(/function|object/.test(typeof M)?E.asString(M):M)+"&"}}O=O.slice(0,-1);Q+='<param name="flashvars" value=\''+O+"' />"
}Q+="</object>";return Q},isSupported:function(K){return A[0]>K[0]||A[0]==K[0]&&A[1]>=K[1]}});var A=E.getVersion();function G(M,N,K){if(E.isSupported(N.version)){M.innerHTML=E.getHTML(N,K)}else{if(N.expressInstall&&E.isSupported([6,65])){M.innerHTML=E.getHTML(C(N,{src:N.expressInstall}),{MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title})}else{if(!M.innerHTML.replace(/\s/g,"")){M.innerHTML="<h2>Flash version "+N.version+" or greater is required</h2><h3>"+(A[0]>0?"Your version is "+A:"You have no flash plugin installed")+"</h3>"+(M.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+B+"'>here</a></p>");
if(M.tagName=="A"){M.onclick=function(){location.href=B}}}if(N.onFail){var L=N.onFail.call(this);if(typeof L=="string"){M.innerHTML=L}}}}if(D){window[N.id]=document.getElementById(N.id)}C(this,{getRoot:function(){return M},getOptions:function(){return N},getConf:function(){return K},getApi:function(){return M.firstChild}})}if(H){jQuery.tools=jQuery.tools||{version:"3.2.4"};jQuery.tools.flashembed={conf:I};jQuery.fn.flashembed=function(K,L){return this.each(function(){$(this).data("flashembed",flashembed(this,K,L))
})}}})();var flowplayerConf={defaults:{autoPlay:true,autoBuffering:true},skins:{controls:{borderRadius:0,timeColor:"#ffffff",bufferGradient:"none",slowForward:true,backgroundColor:"rgba(0, 0, 0, 0.5)",volumeSliderGradient:"none",slowBackward:false,timeBorderRadius:20,time:true,progressGradient:"none",height:28,volumeColor:"rgba(102, 102, 102, 1)",fastBackward:false,opacity:1,timeFontSize:12,bufferColor:"rgba(28, 28, 28, 1)",volumeSliderColor:"rgba(0, 0, 0, 1)",border:"0px",buttonColor:"rgba(240, 240, 240, 1)",mute:true,autoHide:{enabled:true,hideDelay:500,hideStyle:"move",mouseOutDelay:500,hideDuration:400,fullscreenOnly:true},backgroundGradient:"none",width:"100pct",display:"block",sliderBorder:"1px solid rgba(128, 128, 128, 0.7)",buttonOverColor:"#ffffff",fullscreen:true,timeBgColor:"rgba(0, 0, 0, 0)",borderWidth:1,scrubberBarHeightRatio:0.5,bottom:0,stop:false,sliderColor:"rgba(0, 0, 0, 1)",zIndex:1,borderColor:"rgba(0, 0, 0, 0.45)",scrubberHeightRatio:0.6,tooltipTextColor:"#ffffff",sliderGradient:"none",timeBgHeightRatio:0,volumeSliderHeightRatio:0.6,volumeBarHeightRatio:0.5,left:"50pct",tooltipColor:"rgba(0, 0, 0, 0)",playlist:false,durationColor:"rgba(153, 153, 153, 1)",play:true,fastForward:true,progressColor:"rgba(102, 102, 102, 1)",timeBorder:"0px solid rgba(0, 0, 0, 0.3)",volume:true,scrubber:true,builtIn:false,volumeBorder:"1px solid rgba(128, 128, 128, 0.7)"}}};
function flowplayerVideofunction(A){flowplayer(A,"//www.viva.com/common/media/flowplayer.commercial-3.2.4.swf",{key:"#$3d33063da7256c01cab",clip:flowplayerConf.defaults,plugins:{content:flowplayerConf.skins.content,controls:flowplayerConf.skins.controls}})}
/* 
 * tools.overlay 1.1.2 - Overlay HTML with eye candy.
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/overlay.html
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 *
 * Launch  : March 2008
 * Date: ${date}
 * Revision: ${revision} 
 */
(function(C){C.tools=C.tools||{};
C.tools.overlay={version:"1.1.2",addEffect:function(E,F,G){B[E]=[F,G]},conf:{top:"10%",left:"center",absolute:false,speed:"normal",closeSpeed:"fast",effect:"default",close:null,oneInstance:true,closeOnClick:true,closeOnEsc:true,api:false,expose:null,target:null}};var B={};C.tools.overlay.addEffect("default",function(E){this.getOverlay().fadeIn(this.getConf().speed,E)},function(E){this.getOverlay().fadeOut(this.getConf().closeSpeed,E)});var D=[];function A(G,K){var O=this,M=C(this),N=C(window),J,I,H,E=K.expose&&C.tools.expose.version;
var F=K.target||G.attr("rel");I=F?C(F):null||G;if(!I.length){throw"Could not find Overlay: "+F}if(G&&G.index(I)==-1){G.click(function(P){O.load(P);return P.preventDefault()})}C.each(K,function(P,Q){if(C.isFunction(Q)){M.bind(P,Q)}});C.extend(O,{load:function(U){if(O.isOpened()){return O}var R=B[K.effect];if(!R){throw'Overlay: cannot find effect : "'+K.effect+'"'}if(K.oneInstance){C.each(D,function(){this.close(U)})}U=U||C.Event();U.type="onBeforeLoad";M.trigger(U);if(U.isDefaultPrevented()){return O
}H=true;if(E){I.expose().load(U)}var T=K.top;var S=K.left;var P=I.outerWidth({margin:true});var Q=I.outerHeight({margin:true});if(typeof T=="string"){T=T=="center"?Math.max((N.height()-Q)/2,0):parseInt(T,10)/100*N.height()}if(S=="center"){S=Math.max((N.width()-P)/2,0)}if(!K.absolute){T+=N.scrollTop();S+=N.scrollLeft()}I.css({top:T,left:S,position:"absolute"});U.type="onStart";M.trigger(U);R[0].call(O,function(){if(H){U.type="onLoad";M.trigger(U)}});if(K.closeOnClick){C(document).bind("click.overlay",function(W){if(!O.isOpened()){return 
}var V=C(W.target);if(V.parents(I).length>1){return }C.each(D,function(){this.close(W)})})}if(K.closeOnEsc){C(document).unbind("keydown.overlay").bind("keydown.overlay",function(V){if(V.keyCode==27){C.each(D,function(){this.close(V)})}})}return O},close:function(Q){if(!O.isOpened()){return O}Q=Q||C.Event();Q.type="onBeforeClose";M.trigger(Q);if(Q.isDefaultPrevented()){return }H=false;B[K.effect][1].call(O,function(){Q.type="onClose";M.trigger(Q)});var P=true;C.each(D,function(){if(this.isOpened()){P=false
}});if(P){C(document).unbind("click.overlay").unbind("keydown.overlay")}return O},getContent:function(){return I},getOverlay:function(){return I},getTrigger:function(){return G},getClosers:function(){return J},isOpened:function(){return H},getConf:function(){return K},bind:function(P,Q){M.bind(P,Q);return O},unbind:function(P){M.unbind(P);return O}});C.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(P,Q){O[Q]=function(R){return O.bind(Q,R)}});if(E){if(typeof K.expose=="string"){K.expose={color:K.expose}
}C.extend(K.expose,{api:true,closeOnClick:K.closeOnClick,closeOnEsc:false});var L=I.expose(K.expose);L.onBeforeClose(function(P){O.close(P)});O.onClose(function(P){L.close(P)})}J=I.find(K.close||".close");if(!J.length&&!K.close){J=C('<div class="close"></div>');I.children(".viva-head").append(J)}J.click(function(P){O.close(P)})}C.fn.overlay=function(E){var F=this.eq(typeof E=="number"?E:0).data("overlay");if(F){return F}if(C.isFunction(E)){E={onBeforeLoad:E}}var G=C.extend({},C.tools.overlay.conf);
E=C.extend(true,G,E);this.each(function(){F=new A(C(this),E);D.push(F);C(this).data("overlay",F)});return E.api?F:this}})(jQuery);
/* 
 * Overlay Gallery plugin, version: 1.0.0
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/overlay.html#gallery
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 *
 * Since  : July 2009
 * Date: ${date}
 * Revision: ${revision} 
 */
(function(B){var A=B.tools.overlay;A.plugins=A.plugins||{};A.plugins.gallery={version:"1.0.0",conf:{imgId:"img",next:".next",prev:".prev",info:".info",progress:".progress",disabledClass:"disabled",activeClass:"active",opacity:0.8,speed:"slow",template:"<strong>${title}</strong> <span>Image ${index} of ${total}</span>",autohide:true,preload:true,api:false}};
B.fn.gallery=function(D){var N=B.extend({},A.plugins.gallery.conf),L;B.extend(N,D);L=this.overlay();var Q=this,I=L.getOverlay(),J=I.find(N.next),G=I.find(N.prev),E=I.find(N.info),C=I.find(N.progress),H=G.add(J).add(E).css({opacity:N.opacity}),R=L.getClosers(),K;function O(T){C.fadeIn();H.hide();R.hide();var S=T.attr("href");var U=new Image();U.onload=function(){C.fadeOut();var X=B("#"+N.imgId,I);if(!X.length){X=B("<img/>").attr("id",N.imgId).css("visibility","hidden");I.prepend(X)}X.attr("src",S).css("visibility","hidden");
var Y=U.width;var Z=(B(window).width()-Y)/2;K=Q.index(Q.filter("[href="+S+"]"));Q.removeClass(N.activeClass).eq(K).addClass(N.activeClass);var V=N.disabledClass;H.removeClass(V);if(K===0){G.addClass(V)}if(K==Q.length-1){J.addClass(V)}var a=N.template.replace("${title}",T.attr("title")||T.data("title")).replace("${index}",K+1).replace("${total}",Q.length);var W=parseInt(E.css("paddingLeft"),10)+parseInt(E.css("paddingRight"),10);E.html(a).css({width:Y-W});I.animate({width:Y,height:U.height,left:Z},N.speed,function(){X.hide().css("visibility","visible").fadeIn(function(){if(!N.autohide){H.fadeIn();
R.show()}})})};U.onerror=function(){I.fadeIn().html("Cannot find image "+S)};U.src=S;if(N.preload){Q.filter(":eq("+(K-1)+"), :eq("+(K+1)+")").each(function(){var V=new Image();V.src=B(this).attr("href")})}}function F(S,T){S.click(function(){if(S.hasClass(N.disabledClass)){return }var U=Q.eq(i=K+(T?1:-1));if(U.length){O(U)}})}F(J,true);F(G);B(document).keydown(function(S){if(!I.is(":visible")||S.altKey||S.ctrlKey){return }if(S.keyCode==37||S.keyCode==39){var T=S.keyCode==37?G:J;T.click();return S.preventDefault()
}return true});function P(){if(!I.is(":animated")){H.show();R.show()}}if(N.autohide){I.hover(P,function(){H.fadeOut();R.hide()}).mousemove(P)}var M;this.each(function(){var U=B(this),T=B(this).overlay(),S=T;T.onBeforeLoad(function(){O(U)});T.onClose(function(){Q.removeClass(N.activeClass)})});return N.api?M:this}})(jQuery);
/* 
 * tools.overlay "Apple Effect" 1.0.1
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/overlay.html#apple
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 *
 * Since  : July 2009
 * Date: ${date}
 * Revision: ${revision} 
 */
(function(D){var B=D.tools.overlay;
B.effects=B.effects||{};B.effects.apple={version:"1.0.1"};D.extend(B.conf,{start:{absolute:true,top:null,left:null},fadeInSpeed:"fast",zIndex:9999});function C(F){var G=F.offset();return[G.top+F.height()/2,G.left+F.width()/2]}var E=function(N){var K=this.getOverlay(),F=this.getConf(),I=this.getTrigger(),P=this,Q=K.outerWidth({margin:true}),M=K.data("img");if(!M){var L=K.css("backgroundImage");if(!L){throw"background-image CSS property not set for overlay"}L=L.substring(L.indexOf("(")+1,L.indexOf(")")).replace(/\"/g,"");
K.css("backgroundImage","none");M=D('<img src="'+L+'"/>');M.css({border:0,position:"absolute",display:"none"}).width(Q);D("body").append(M);K.data("img",M)}var O=D(window),J=F.start.top||Math.round(O.height()/2),H=F.start.left||Math.round(O.width()/2);if(I){var G=C(I);J=G[0];H=G[1]}if(!F.start.absolute){J+=O.scrollTop();H+=O.scrollLeft()}M.css({top:J,left:H,width:0,zIndex:F.zIndex}).show();M.animate({top:K.css("top"),left:K.css("left"),width:Q},F.speed,function(){M.css("display","none");K.css("zIndex",F.zIndex+1).fadeIn(F.fadeInSpeed,function(){if(P.isOpened()&&!D(this).index(K)){N.call()
}else{K.hide()}})})};var A=function(F){var H=this.getOverlay(),I=this.getConf(),G=this.getTrigger(),L=I.start.top,K=I.start.left;H.hide();if(G){var J=C(G);L=J[0];K=J[1]}H.data("img").animate({top:L,left:K,width:0},I.closeSpeed,F)};B.addEffect("apple",E,A)})(jQuery);
/* 
 * tools.expose 1.0.5 - Make HTML elements stand out
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/expose.html
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 *
 * Launch  : June 2008
 * Date: ${date}
 * Revision: ${revision} 
 */
(function(B){B.tools=B.tools||{};
B.tools.expose={version:"1.0.5",conf:{maskId:null,loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,closeOnEsc:true,zIndex:9998,opacity:0.6,color:"#456",api:false}};function A(){if(B.browser.msie){var E=B(document).height(),D=B(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,E-D<20?D:E]}return[B(window).width(),B(document).height()]}function C(H,G){var E=this,J=B(this),D=null,F=false,I=0;B.each(G,function(K,L){if(B.isFunction(L)){J.bind(K,L)
}});B(window).resize(function(){E.fit()});B.extend(this,{getMask:function(){return D},getExposed:function(){return H},getConf:function(){return G},isLoaded:function(){return F},load:function(N){if(F){return E}I=H.eq(0).css("zIndex");if(G.maskId){D=B("#"+G.maskId)}if(!D||!D.length){var L=A();D=B("<div/>").css({position:"fixed",top:0,left:0,width:L[0],height:L[1],display:"none",opacity:0,zIndex:G.zIndex});if(G.maskId){D.attr("id",G.maskId)}B("body").append(D);var K=D.css("backgroundColor");if(!K||K=="transparent"||K=="rgba(0, 0, 0, 0)"){D.css("backgroundColor",G.color)
}if(G.closeOnEsc){B(document).bind("keydown.unexpose",function(O){if(O.keyCode==27){E.close()}})}if(G.closeOnClick){D.bind("click.unexpose",function(O){E.close(O)})}}N=N||B.Event();N.type="onBeforeLoad";J.trigger(N);if(N.isDefaultPrevented()){return E}B.each(H,function(){var O=B(this);if(!/relative|absolute|fixed/i.test(O.css("position"))){O.css("position","relative")}});H.css({zIndex:Math.max(G.zIndex+1,I=="auto"?0:I)});var M=D.height();if(!this.isLoaded()){D.css({opacity:0,display:"block"}).fadeTo(G.loadSpeed,G.opacity,function(){if(D.height()!=M){D.css("height",M)
}N.type="onLoad";J.trigger(N)})}F=true;return E},close:function(K){if(!F){return E}K=K||B.Event();K.type="onBeforeClose";J.trigger(K);if(K.isDefaultPrevented()){return E}D.fadeOut(G.closeSpeed,function(){K.type="onClose";J.trigger(K);H.css({zIndex:B.browser.msie?I:null})});F=false;return E},fit:function(){if(D){var K=A();D.css({width:K[0],height:K[1]})}},bind:function(K,L){J.bind(K,L);return E},unbind:function(K){J.unbind(K);return E}});B.each("onBeforeLoad,onLoad,onBeforeClose,onClose".split(","),function(K,L){E[L]=function(M){return E.bind(L,M)
}})}B.fn.expose=function(D){var E=this.eq(typeof D=="number"?D:0).data("expose");if(E){return E}if(typeof D=="string"){D={color:D}}var F=B.extend({},B.tools.expose.conf);D=B.extend(F,D);this.each(function(){E=new C(B(this),D);B(this).data("expose",E)});return D.api?E:this}})(jQuery);
/* 
jquery.event.drag.js ~ v1.5 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)  
Liscensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt
*/
(function(E){E.fn.drag=function(L,K,J){if(K){this.bind("dragstart",L)
}if(J){this.bind("dragend",J)}return !L?this.trigger("drag"):this.bind("drag",K?K:L)};var A=E.event,B=A.special,F=B.drag={not:"p,a,img,label,span,h1,h2,h3,h4,h5,h6,input,select,object,textarea,embed,param",distance:0,which:1,dragging:false,setup:function(J){J=E.extend({distance:F.distance,which:F.which,not:F.not},J||{});J.distance=I(J.distance);A.add(this,"mousedown",H,J);if(this.attachEvent){this.attachEvent("ondragstart",D)}},teardown:function(){A.remove(this,"mousedown",H);if(this===F.dragging){F.dragging=F.proxy=false
}G(this,true);if(this.detachEvent){this.detachEvent("ondragstart",D)}}};B.dragstart=B.dragend={setup:function(){},teardown:function(){}};function H(L){var K=this,J,M=L.data||{};if(M.elem){K=L.dragTarget=M.elem;L.dragProxy=F.proxy||K;L.cursorOffsetX=M.pageX-M.left;L.cursorOffsetY=M.pageY-M.top;L.offsetX=L.pageX-L.cursorOffsetX;L.offsetY=L.pageY-L.cursorOffsetY}else{if(F.dragging||(M.which>0&&L.which!=M.which)||E(L.target).is(M.not)){return }}switch(L.type){case"mousedown":E.extend(M,E(K).offset(),{elem:K,target:L.target,pageX:L.pageX,pageY:L.pageY});
A.add(document,"mousemove mouseup",H,M);G(K,false);F.dragging=null;return false;case !F.dragging&&"mousemove":if(I(L.pageX-M.pageX)+I(L.pageY-M.pageY)<M.distance){break}L.target=M.target;J=C(L,"dragstart",K);if(J!==false){F.dragging=K;F.proxy=L.dragProxy=E(J||K)[0]}case"mousemove":if(F.dragging){J=C(L,"drag",K);if(B.drop){B.drop.allowed=(J!==false);B.drop.handler(L)}if(J!==false){break}L.type="mouseup"}case"mouseup":A.remove(document,"mousemove mouseup",H);if(F.dragging){if(B.drop){B.drop.handler(L)
}C(L,"dragend",K)}G(K,true);F.dragging=F.proxy=M.elem=false;break}return true}function C(M,K,L){M.type=K;var J=E.event.handle.call(L,M);return J===false?false:J||M.result}function I(J){return Math.pow(J,2)}function D(){return(F.dragging===false)}function G(K,J){if(!K){return }K.unselectable=J?"off":"on";K.onselectstart=function(){return J};if(K.style){K.style.MozUserSelect=J?"":"none"}}})(jQuery);vivaSPOverlayFunction=function(){var A={effect:"apple",onClose:function(){if(jQuery.browser.msie){var B=this.getOverlay().find(".viva-embed-video").html();
this.getOverlay().find(".viva-embed-video").html("");this.getOverlay().find(".viva-embed-video").html(B)}}};if(!(jQuery.browser.msie&&(parseInt(jQuery.browser.version)<="6"))){jQuery.extend(A,{expose:"#000"})}jQuery("#viva-content-body a[rel],area[rel],div[rel]").each(function(){var C=jQuery(this).attr("rel");var B=jQuery("#"+C+".viva-common-overlay");if(B.length>0){jQuery(this).overlay(A)}});jQuery(".viva-common-overlay").bind("drag",function(B){jQuery(this).css({top:B.offsetY,left:B.offsetX})})};
