var ps={rest:{maxConcurrency:3,concurrency:0,callbacks:{},numCalls:0,callQueue:[],server:"http://csp.picsearch.com/rest"},media:{},mediafields:["mediaid"],eventListeners:{},embedMode:null,streamName:null,call:function(b){var a=0;if(arguments.length>1){a=++this.rest.numCalls;this.rest.callbacks[a+"success"]=arguments[1];if(typeof arguments[2]=="function"){this.rest.callbacks[a+"failure"]=arguments[2];}}this.call2(b,a);},call2:function(c,b){var e,d,a;var b;if(this.rest.concurrency>=this.rest.maxConcurrency){this.rest.callQueue.push([c,b]);return;}this.rest.concurrency++;c="?jsonp=ps.responseHandler&eventParam="+b+"&auth="+picsearch_ajax_auth+c;e=this.rest.server+c;d=document.getElementsByTagName("head").item(0);a=document.createElement("script");a.type="text/javascript";a.id="ps-json-"+b;a.src=e;d.appendChild(a);},popCallback:function(b,a){var c;c=this.rest.callbacks[b+a];delete this.rest.callbacks[b+"success"];delete this.rest.callbacks[b+"failure"];return c;},responseHandler:function(c,a){var b;var f;var d=document.getElementById("ps-json-"+a);d.parentNode.removeChild(d);ps.rest.concurrency--;b=ps.popCallback(a,c.status);if(b){b(c);}if(ps.rest.concurrency<ps.rest.maxConcurrency&&ps.rest.callQueue.length>0){f=ps.rest.callQueue.shift();ps.call2(f[0],f[1]);}},getOptions:function(h,e){var f,c;var d={};var b={success:"function",failure:"function",options:"object"};for(f=0;f<3;f++){for(c in b){if(!d[c]&&(typeof e[h+f])==b[c]){for(var g in e[h+f]){d[c]=e[h+f];}}}}d.options=d.options||{};return d;},argstringifyPropertyFilter:function(e,d,b){var a="";var g,f,c;for(var g=0;g<e.length;g++){if(typeof e[g]=="string"){a+="&"+d+"="+encodeURIComponent(g+"="+e[g]);}else{if(typeof e[g]=="boolean"){a+="&"+d+"="+e[g]?"true":"false";}else{if(b){f=e[g];if(f.length==0){a+="&"+d+".exists="+encodeURIComponent(g);}else{for(c in f){if(typeof f[c]=="string"){a+="&"+d+".or="+encodeURIComponent(g+"="+f[c]);}else{if(typeof f[c]=="boolean"){a+="&"+d+".or="+f[c]?"true":"false";}else{a+="&"+d+".or.substring="+encodeURIComponent(g+"="+f[c][0]);}}}}}}}}return a;},argstringify2:function(e,f,d){var a="";var c,b;if(typeof e==="undefined"){return"";}if(f in e){c=e[f];if(c instanceof Array){for(var b=0;b<c.length;b++){a+="&"+d+"="+encodeURIComponent(c[b]);}}else{a+="&"+d+"="+encodeURIComponent(c);}}return a;},argstringify:function(d,a,i,h){if(typeof d==="undefined"){return"";}var b="";var e,c,g;for(g=0;g<a.length;g++){b+=this.argstringify2(d,a[g],a[g]);}for(g in i){b+=this.argstringify2(d,g,i[g]);}if(h&&("filters" in d)){e=[];c={mediaids:"filter.mediaid",tags:"filter.tag",mediatype:"filter.mediatype",association:"filter.association",categoryid:"filter.categoryid",maxposted:"filter.maxposted",minnumratings:"filter.minnumratings",minposted:"filter.minposted",reference:"filter.reference",status:"filter.status",userid:"filter.userid"};b+=this.argstringify(d.filters,e,c);e={exclude:true,max:false,min:false,"":true};for(g in e){if(typeof d.filters!=="undefined"){if((g+"properties") in d.filters){b+=this.argstringifyPropertyFilter(d.filters[g+"properties"],"filter."+g+"property",e[g]);}}}}return b;},arrayUnion:function(f){var c={};var b,a,d;var e=[];for(b=0;b<f.length;b++){if(typeof f[b]!=="undefined"){for(a=0;a<f[b].length;a++){c[f[b][a]]=true;}}}for(d in c){e.push(d);}return e;},pad:function(c,a,b){c=""+c;while(c.length<a){c=b+c;}return c;},parseDuration:function(b){var a={milliseconds:b%1000,seconds:parseInt(b/1000)%60,minutes:parseInt(b/60000)%60,hours:parseInt(b/3600000)};if(a.hours>0){a.timestamp=a.hours+":"+this.pad(a.minutes,2,"0")+":"+this.pad(a.seconds,2,"0");}else{if((a.hours==0)&&(a.minutes>0)){a.timestamp=a.minutes+":"+this.pad(a.seconds,2,"0");}else{if((a.hours==0)&&(a.minutes==0)&&a.seconds>0){a.timestamp="0:"+this.pad(a.seconds,2,"0");}}}return a;},listMedia:function(){var b;var a=this.getOptions(0,arguments);a.options.fields=this.arrayUnion([this.mediafields,a.options.fields]);b="&method=listMedia";b+=this.argstringify(a.options,["order","count","start","period","player"],{fields:"field"},true);this.call(b,function(d){var c;for(c in {embedMode:1,streamName:1}){if(c in d){ps[c]=d[c];}}for(c in d.media){ps.media[d.media[c].mediaid]=d.media[c];}a.success(d);},a.failure);},addEventListener:function(a){var b=this.getOptions(1,arguments);if(!(a in this.eventListeners)){this.eventListeners[a]=[];}this.eventListeners[a].push(b.success);if(a=="mediaActivated"){this.mediafields=this.arrayUnion([this.mediafields,b.options.fields]);}},activateMedia:function(b){var c=this.getOptions(1,arguments);var a;if(!(b in this.media)){if(c.options.noretry){if(c.failure){c.failure();}return;}this.getMediaDetails(b,function(d){ps.activateMedia(b,{noretry:true});});return;}for(a in this.eventListeners.mediaActivated){this.eventListeners.mediaActivated[a](this.media[b]);}if(c.success){c.success();}},search:function(d){var c=this.getOptions(1,arguments);var e="&method=search&searchText="+encodeURIComponent(d);var a=["order","count","start","period","player"];var b={fields:"field",constraints:"constraint"};c.options.fields=this.arrayUnion([this.mediafields,c.options.fields]);e+=this.argstringify(c.options,a,b,true);this.call(e,function(g){var f;for(f in {embedMode:1,streamName:1}){if(f in g){ps[f]=g[f];}}for(var f=0;f<g.media.length;f++){ps.media[g.media[f].mediaid]=g.media[f];}c.success(g);},c.failure);},getMediaDetails:function(d){var f=this.getOptions(1,arguments);var a=f.options.refresh;var e,c;if(!(d in this.media)){a=true;}if(!a){e=this.media[d];for(var c=0;c<f.options.fields.length;c++){if(!(f.options.fields[c] in e)){a=true;break;}}}if(!a){return f.success(e);}var b={};var g;f.options.fields=this.arrayUnion([this.mediafields,f.options.fields]);f.options.filters={mediaids:[d],mediatype:f.options.mediatype||"video"};g="&method=listMedia";g+=this.argstringify(f.options,["player"],{fields:"field"},true);this.call(g,function(h){ps.media[h.media[0].mediaid]=h.media[0];f.success(h.media[0]);},f.failure);},listCategories:function(){var a=this.getOptions(0,arguments);var b="&method=listCategories";b+=this.argstringify(a.options,["count","start"],{},true);this.call(b,a.success,a.failure);},assignRating:function(a){var b=this.getOptions(1,arguments);var c="&method=assignRating";b.options.mediaid=a;c+=this.argstringify(b.options,["rating","mediaid"],{},false);this.call(c,b.success,b.failure);},getUploadURL:function(){var f=this.getOptions(0,arguments);var g="&method=getUploadURL";var b={};var a=["categoryid","description","failure_url","mediatype","returnmediaid","success_url","title","userid"];f.options.staticFields=f.options.staticFields||{};for(var c in a){b[a[c]]="staticfield."+a[c];}for(var e in f.options.staticFields){if(e.substring(9,0)=="property."){b[e]="staticfield."+e;}}for(var d in {success_url:0,failure_url:0}){if(!((d in f.options.staticFields)||(d in f.options.mutableFields))){f.options.staticFields[d]=location;}}g+=this.argstringify(f.options.staticFields,[],b,false);delete f.options.staticFields;g+=this.argstringify(f.options,["period"],{mutableFields:"mutablefield"},false);this.call(g,f.success,f.failure);},embedHandler:function(b){ps.embedMode=b.embedMode;ps.streamName=b.streamName;if("media" in b){var a=b.media.mediaid;this.mergeMedia(a,b.media);}if(!("options" in b)){b.options={};}ps.embed(b.options);},mergeMedia:function(a,c){if(!(a in ps.media)){ps.media[a]={};}if(!("streams" in ps.media[a])){ps.media[a]["streams"]={};}for(var b in {player:1,playerconfig:1,image:1,playimage:1,playertag:1,flashembed:1,throbberimage:1}){if(b in c){ps.media[a][b]=c[b];}}if("streams" in c){for(var d in c.streams){ps.media[a].streams[d]=c.streams[d];}}},setOpacity:function(b,a){if(typeof b=="string"){b=document.getElementById(b);}if(!b){return;}b.style.opacity=a/100;b.style.filter="alpha(opacity="+a+")";},embed:function(){var x=this.getOptions(0,arguments);var q=x.options.embedMode||ps.embedMode;var f=true;var A;if("loadResources" in x.options){f=x.options.loadResources;}var v=false;var k=x.options.mediaid||null;if(k===null){if(ps.embedMode!==null){x.success({embedMode:ps.embedMode});return;}}else{if(k in ps.media){A=ps.media[k];if(q=="flash"&&A.flashembed=="flowplayer"){v=("player" in A)&&("playerconfig" in A);}else{if(q=="flash"&&A.flashembed=="generic"){v="playertag" in A;}else{if(q=="html5"||q=="rtsp"||q=="iphone"){v=(ps.streamName!==null)&&("streams" in A)&&(ps.streamName in A.streams);}}}v=v&&"image" in A;v=v&&"playimage" in A;}}var z=x.options.width||640;var u=x.options.height||360;var r;var w;var B=x.options.blindsColor||null;if("mediaid" in x.options){if("containerId" in x.options){w=x.options.containerId;r=document.getElementById(w);}else{if(document.getElementById(k)){w=k;r=document.getElementById(w);}else{r=document.createElement("div");r.id=k;r.style.width=z+"px";r.style.height=u+"px";document.body.appendChild(r);w=k;}}z=x.options.width||r.width||z;u=x.options.height||r.height||u;x.options.width=z;x.options.height=u;x.options.containerId=w;}if(!v&&f){var l="&method=embed";var s=["throbber","containerId","mediaid","embedMode","autoplay","rdfa","player","autoload","width","height","imagePadding"];l+=this.argstringify(x.options,s,{},false);this.call(l,function(h){if("embedMode" in h){ps.embedMode=h.embedMode;ps.streamName=h.streamName;}if("media" in h){ps.mergeMedia(k,h.media);x.options.loadResources=false;ps.embed(k,x.options,x.success,x.failure);}else{if(x.success&&(k===null)&&(ps.embedMode!==null)){x.success({embedMode:ps.embedMode});}else{if(x.failure){x.failure();}}}});return;}if(!v){if(x.failure){x.failure();}return;}var i;if(q=="html5"){i=document.createElement("div");i.id=w;}else{var t=x.options.imagePadding||0;if(q=="flash"){i=document.createElement("div");}else{i=document.createElement("a");}i.id=w;i.style.position="relative";i.style.width=z+"px";i.style.height=u+"px";var j="";if(t>0){j="padding: "+t+"px;";}var d=z-(2*t);var b=u-(2*t);var p="";if(B){p="background-color: "+B+";";}var D='<div style="position: relative; overflow: hidden; width: '+z+"px; height: "+u+'px;"><div style="height: '+u+"px; text-align: center; vertical-align: middle; width: "+z+'px; display: table-cell;"><img id="'+w+'-icon" onmouseover="ps.setOpacity(this, 100)" onmouseout="ps.setOpacity(this, 60)" src="'+A.playimage+'" /></div><div style="position: absolute; top: 0; left: 0; width: '+d+"px; height: "+b+"px; z-index: -1; display: table; table-layout: fixed;"+j+'"><div  id="'+w+'-splash" style="width: '+d+"px; height: "+b+"px; display: table-cell; text-align: center; vertical-align: middle;"+p+'"><img style="max-height: '+b+"px; max-width: "+d+'px;" src="'+A.image+'" /></div></div></div>';i.innerHTML=D;}r.parentNode.replaceChild(i,r);r=i;var c={embedMode:ps.embedMode,playerContainer:r};if(x.options.throbber==true){var e=document.createElement("div");r.id=w+"-parent";e.id=w;e.style.width=z+"px";e.style.height=u+"px";e.style.position="absolute";e.style.top="0";e.style.left="0";e.style.zIndex=-2;r.appendChild(e);r=e;ps.setOpacity(w+"-icon",60);}if(q=="flash"){if(x.options.autoload!==false){if(x.options.throbber==true){var E=document.getElementById(w+"-icon");E.src=A.throbberimage;r.style.zIndex=0;}if(A.flashembed=="flowplayer"){r.innerHTML="";var g=flowplayer(w,A.player,A.playerconfig);c.player=g;}else{var n=document.createElement("div");n.innerHTML=A.playertag;var G=n.getElementsByTagName("object").item(0);G.height=u;G.width=z;var a=G.getElementsByTagName("embed").item(0);a.height=u;a.width=z;r.innerHTML="";r.appendChild(n);}}else{if(x.options.throbber){var F=document.createElement("img");F.src=A.throbberimage;}var E=document.getElementById(w+"-icon");E.onclick=function(){r.style.zIndex=0;if(x.options.throbber){E.src=A.throbberimage;}if(A.flashembed=="flowplayer"){r.innerHTML="";flowplayer(w,A.player,A.playerconfig);}else{var m=document.createElement("div");m.innerHTML=A.playertag;var h=m.getElementsByTagName("object").item(0);h.height=u;h.width=z;var o=h.getElementsByTagName("embed").item(0);o.height=u;o.width=z;r.innerHTML="";r.appendChild(m);}};}}else{if(q=="html5"){var C=document.createElement("video");C.width=z;C.height=u;C.controls=true;if("image" in A){C.poster=A.image;}var y=document.createElement("source");y.src=A.streams[ps.streamName];y.type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"';C.appendChild(y);r.appendChild(C);}else{if(q=="rtsp"||q=="iphone"){r.href=A.streams[ps.streamName];}}}if(x.success){x.success(c);}},print:function(b){if(window.console!==undefined){console.log(b);}else{var c=document.createElement("p");var a=document.createTextNode(b);c.appendChild(a);document.body.appendChild(c);}}};(function(){function v(a){console.log("$f.fireEvent",[].slice.call(a));}function r(a){if(!a||typeof a!="object"){return a;}var c=new a.constructor();for(var b in a){if(a.hasOwnProperty(b)){c[b]=r(a[b]);}}return c;}function p(a,d){if(!a){return;}var f,e=0,c=a.length;if(c===undefined){for(f in a){if(d.call(a[f],f,a[f])===false){break;}}}else{for(var b=a[0];e<c&&d.call(b,e,b)!==false;b=a[++e]){}}return a;}function z(a){return document.getElementById(a);}function t(a,b,c){if(typeof b!="object"){return a;}if(a&&b){p(b,function(e,d){if(!c||typeof d!="function"){a[e]=d;}});}return a;}function o(a){var c=a.indexOf(".");if(c!=-1){var d=a.slice(0,c)||"*";var e=a.slice(c+1,a.length);var b=[];p(document.getElementsByTagName(d),function(){if(this.className&&this.className.indexOf(e)!=-1){b.push(this);}});return b;}}function w(a){a=a||window.event;if(a.preventDefault){a.stopPropagation();a.preventDefault();}else{a.returnValue=false;a.cancelBubble=true;}return false;}function s(a,c,b){a[c]=a[c]||[];a[c].push(b);}function x(){return"_"+(""+Math.random()).slice(2,10);}var u=function(b,d,c){var e=this,f={},a={};e.index=d;if(typeof b=="string"){b={url:b};}t(this,b,true);p(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var i="on"+this;if(i.indexOf("*")!=-1){i=i.slice(0,i.length-1);var h="onBefore"+i.slice(2);e[h]=function(j){s(a,h,j);return e;};}e[i]=function(j){s(a,i,j);return e;};if(d==-1){if(e[h]){c[h]=e[h];}if(e[i]){c[i]=e[i];}}});t(this,{onCuepoint:function(h,i){if(arguments.length==1){f.embedded=[null,h];return e;}if(typeof h=="number"){h=[h];}var j=x();f[j]=[h,i];if(c.isLoaded()){c._api().fp_addCuepoints(h,d,j);}return e;},update:function(i){t(e,i);if(c.isLoaded()){c._api().fp_updateClip(i,d);}var j=c.getConfig();var h=(d==-1)?j.clip:j.playlist[d];t(h,i,true);},_fireEvent:function(k,m,j,i){if(k=="onLoad"){p(f,function(D,n){if(n[0]){c._api().fp_addCuepoints(n[0],d,D);}});return false;}i=i||e;if(k=="onCuepoint"){var l=f[m];if(l){return l[1].call(c,i,j);}}if(m&&"onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(k)!=-1){t(i,m);if(m.metaData){if(!i.duration){i.duration=m.metaData.duration;}else{i.fullDuration=m.metaData.duration;}}}var h=true;p(a[k],function(){h=this.call(c,i,m,j);});return h;}});if(b.onCuepoint){var g=b.onCuepoint;e.onCuepoint.apply(e,typeof g=="function"?[g]:g);delete b.onCuepoint;}p(b,function(i,h){if(typeof h=="function"){s(a,i,h);delete b[i];}});if(d==-1){c.onCuepoint=this.onCuepoint;}};var q=function(f,d,e,b){var g=this,c={},a=false;if(b){t(c,b);}p(d,function(i,h){if(typeof h=="function"){c[i]=h;delete d[i];}});t(this,{animate:function(l,k,h){if(!l){return g;}if(typeof k=="function"){h=k;k=500;}if(typeof l=="string"){var i=l;l={};l[i]=k;k=500;}if(h){var j=x();c[j]=h;}if(k===undefined){k=500;}d=e._api().fp_animate(f,l,k,j);return g;},css:function(i,h){if(h!==undefined){var j={};j[i]=h;i=j;}d=e._api().fp_css(f,i);t(g,d);return g;},show:function(){this.display="block";e._api().fp_showPlugin(f);return g;},hide:function(){this.display="none";e._api().fp_hidePlugin(f);return g;},toggle:function(){this.display=e._api().fp_togglePlugin(f);return g;},fadeTo:function(k,h,i){if(typeof h=="function"){i=h;h=500;}if(i){var j=x();c[j]=i;}this.display=e._api().fp_fadeTo(f,k,h,j);this.opacity=k;return g;},fadeIn:function(h,i){return g.fadeTo(1,h,i);},fadeOut:function(h,i){return g.fadeTo(0,h,i);},getName:function(){return f;},getPlayer:function(){return e;},_fireEvent:function(j,k,i){if(j=="onUpdate"){var l=e._api().fp_getPlugin(f);if(!l){return;}t(g,l);delete g.methods;if(!a){p(l.methods,function(){var n=""+this;g[n]=function(){var F=[].slice.call(arguments);var E=e._api().fp_invoke(f,n,F);return E==="undefined"||E===undefined?g:E;};});a=true;}}var h=c[j];if(h){var m=h.apply(g,k);if(j.slice(0,1)=="_"){delete c[j];}return m;}return g;}});};function A(I,e,j){var d=this,f=null,l=false,h,k,g=[],b={},c={},i,n,K,m,L,J;t(d,{id:function(){return i;},isLoaded:function(){return(f!==null&&f.fp_play!==undefined&&!l);},getParent:function(){return I;},hide:function(C){if(C){I.style.height="0px";}if(d.isLoaded()){f.style.height="0px";}return d;},show:function(){I.style.height=J+"px";if(d.isLoaded()){f.style.height=L+"px";}return d;},isHidden:function(){return d.isLoaded()&&parseInt(f.style.height,10)===0;},load:function(C){if(!d.isLoaded()&&d._fireEvent("onBeforeLoad")!==false){var E=function(){h=I.innerHTML;if(h&&!flashembed.isSupported(e.version)){I.innerHTML="";}if(C){C.cached=true;s(c,"onLoad",C);}flashembed(I,e,{config:j});};var D=0;p(B,function(){this.unload(function(F){if(++D==B.length){E();}});});}return d;},unload:function(C){if(this.isFullscreen()&&/WebKit/i.test(navigator.userAgent)){if(C){C(false);}return d;}if(h.replace(/\s/g,"")!==""){if(d._fireEvent("onBeforeUnload")===false){if(C){C(false);}return d;}l=true;try{if(f){f.fp_close();d._fireEvent("onUnload");}}catch(E){}var D=function(){f=null;I.innerHTML=h;l=false;if(C){C(true);}};setTimeout(D,50);}else{if(C){C(false);}}return d;},getClip:function(C){if(C===undefined){C=m;}return g[C];},getCommonClip:function(){return k;},getPlaylist:function(){return g;},getPlugin:function(E){var C=b[E];if(!C&&d.isLoaded()){var D=d._api().fp_getPlugin(E);if(D){C=new q(E,D,d);b[E]=C;}}return C;},getScreen:function(){return d.getPlugin("screen");},getControls:function(){return d.getPlugin("controls")._fireEvent("onUpdate");},getLogo:function(){try{return d.getPlugin("logo")._fireEvent("onUpdate");}catch(C){}},getPlay:function(){return d.getPlugin("play")._fireEvent("onUpdate");},getConfig:function(C){return C?r(j):j;},getFlashParams:function(){return e;},loadPlugin:function(D,E,P,C){if(typeof P=="function"){C=P;P={};}var F=C?x():"_";d._api().fp_loadPlugin(D,E,P,F);var G={};G[F]=C;var O=new q(D,null,d,G);b[D]=O;return O;},getState:function(){return d.isLoaded()?f.fp_getState():-1;},play:function(D,E){var C=function(){if(D!==undefined){d._api().fp_play(D,E);}else{d._api().fp_play();}};if(d.isLoaded()){C();}else{if(l){setTimeout(function(){d.play(D,E);},50);}else{d.load(function(){C();});}}return d;},getVersion:function(){var C="flowplayer.js 3.2.4";if(d.isLoaded()){var D=f.fp_getVersion();D.push(C);return D;}return C;},_api:function(){if(!d.isLoaded()){throw"Flowplayer "+d.id()+" not loaded when calling an API method";}return f;},setClip:function(C){d.setPlaylist([C]);return d;},getIndex:function(){return K;},_swfHeight:function(){return f.clientHeight;}});p(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var D="on"+this;if(D.indexOf("*")!=-1){D=D.slice(0,D.length-1);var C="onBefore"+D.slice(2);d[C]=function(E){s(c,C,E);return d;};}d[D]=function(E){s(c,D,E);return d;};});p(("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 C=this;d[C]=function(E,F){if(!d.isLoaded()){return d;}var D=null;if(E!==undefined&&F!==undefined){D=f["fp_"+C](E,F);}else{D=(E===undefined)?f["fp_"+C]():f["fp_"+C](E);}return D==="undefined"||D===undefined?d:D;};});d._fireEvent=function(D){if(typeof D=="string"){D=[D];}var C=D[0],F=D[1],S=D[2],T=D[3],U=0;if(j.debug){v(D);}if(!d.isLoaded()&&C=="onLoad"&&F=="player"){f=f||z(n);L=d._swfHeight();p(g,function(){this._fireEvent("onLoad");});p(b,function(N,M){M._fireEvent("onUpdate");});k._fireEvent("onLoad");}if(C=="onLoad"&&F!="player"){return;}if(C=="onError"){if(typeof F=="string"||(typeof F=="number"&&typeof S=="number")){F=S;S=T;}}if(C=="onContextMenu"){p(j.contextMenu[F],function(N,M){M.call(d);});return;}if(C=="onPluginEvent"||C=="onBeforePluginEvent"){var X=F.name||F;var W=b[X];if(W){W._fireEvent("onUpdate",F);return W._fireEvent(S,D.slice(3));}return;}if(C=="onPlaylistReplace"){g=[];var G=0;p(F,function(){g.push(new u(this,G++,d));});}if(C=="onClipAdd"){if(F.isInStream){return;}F=new u(F,S,d);g.splice(S,0,F);for(U=S+1;U<g.length;U++){g[U].index++;}}var E=true;if(typeof F=="number"&&F<g.length){m=F;var V=g[F];if(V){E=V._fireEvent(C,S,T);}if(!V||E!==false){E=k._fireEvent(C,S,T,V);}}p(c[C],function(){E=this.call(d,F,S);if(this.cached){c[C].splice(U,1);}if(E===false){return false;}U++;});return E;};function H(){if($f(I)){$f(I).getParent().innerHTML="";K=$f(I).getIndex();B[K]=d;}else{B.push(d);K=B.length-1;}J=parseInt(I.style.height,10)||I.clientHeight;i=I.id||"fp"+x();n=e.id||i+"_api";e.id=n;j.playerId=i;if(typeof j=="string"){j={clip:{url:j}};}if(typeof j.clip=="string"){j.clip={url:j.clip};}j.clip=j.clip||{};if(I.getAttribute("href",2)&&!j.clip.url){j.clip.url=I.getAttribute("href",2);}k=new u(j.clip,-1,d);j.playlist=j.playlist||[j.clip];var D=0;p(j.playlist,function(){var F=this;if(typeof F=="object"&&F.length){F={url:""+F};}p(j.clip,function(G,N){if(N!==undefined&&F[G]===undefined&&typeof N!="function"){F[G]=N;}});j.playlist[D]=F;F=new u(F,D,d);g.push(F);D++;});p(j,function(G,F){if(typeof F=="function"){if(k[G]){k[G](F);}else{s(c,G,F);}delete j[G];}});p(j.plugins,function(G,F){if(F){b[G]=new q(G,F,d);}});if(!j.plugins||j.plugins.controls===undefined){b.controls=new q("controls",null,d);}b.canvas=new q("canvas",null,d);h=I.innerHTML;function C(F){var G=d.hasiPadSupport&&d.hasiPadSupport();if(/iPad|iPhone|iPod/i.test(navigator.userAgent)&&!/.flv$/i.test(g[0].url)&&!G){return true;}if(!d.isLoaded()&&d._fireEvent("onBeforeClick")!==false){d.load();}return w(F);}function E(){if(h.replace(/\s/g,"")!==""){if(I.addEventListener){I.addEventListener("click",C,false);}else{if(I.attachEvent){I.attachEvent("onclick",C);}}}else{if(I.addEventListener){I.addEventListener("click",w,false);}d.load();}}setTimeout(E,0);}if(typeof I=="string"){var a=z(I);if(!a){throw"Flowplayer cannot access element: "+I;}I=a;H();}else{H();}}var B=[];function y(a){this.length=a.length;this.each=function(b){p(a,b);};this.size=function(){return a.length;};}window.flowplayer=window.$f=function(){var e=null;var f=arguments[0];if(!arguments.length){p(B,function(){if(this.isLoaded()){e=this;return false;}});return e||B[0];}if(arguments.length==1){if(typeof f=="number"){return B[f];}else{if(f=="*"){return new y(B);}p(B,function(){if(this.id()==f.id||this.id()==f||this.getParent()==f){e=this;return false;}});return e;}}if(arguments.length>1){var a=arguments[1],d=(arguments.length==3)?arguments[2]:{};if(typeof a=="string"){a={src:a};}a=t({bgcolor:"#000000",version:[9,0],expressInstall:"http://static.flowplayer.org/swf/expressinstall.swf",cachebusting:true},a);if(typeof f=="string"){if(f.indexOf(".")!=-1){var b=[];p(o(f),function(){b.push(new A(this,r(a),r(d)));});return new y(b);}else{var c=z(f);return new A(c!==null?c:f,a,d);}}else{if(f){return new A(f,a,d);}}}return null;};t(window.$f,{fireEvent:function(){var b=[].slice.call(arguments);var a=$f(b[0]);return a?a._fireEvent(b.slice(1)):null;},addPlugin:function(b,a){A.prototype[b]=a;return $f;},each:p,extend:t});if(typeof jQuery=="function"){jQuery.fn.flowplayer=function(a,b){if(!arguments.length||typeof arguments[0]=="number"){var c=[];this.each(function(){var d=$f(this);if(d){c.push(d);}});return arguments.length?c[arguments[0]]:new y(c);}return this.each(function(){$f(this,r(a),b?r(b):{});});};}})();(function(){var n=document.all,l="http://www.adobe.com/go/getflashplayer",r=typeof jQuery=="function",p=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,s={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 m(a,b){if(b){for(var c in b){if(b.hasOwnProperty(c)){a[c]=b[c];}}}return a;}function t(c,d){var a=[];for(var b in c){if(c.hasOwnProperty(b)){a[b]=d(c[b]);}}return a;}window.flashembed=function(c,a,b){if(typeof c=="string"){c=document.getElementById(c.replace("#",""));}if(!c){return;}if(typeof a=="string"){a={src:a};}return new q(c,m(m({},s),a),b);};var o=m(window.flashembed,{conf:s,getVersion:function(){var a,c;try{c=navigator.plugins["Shockwave Flash"].description.slice(16);}catch(d){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");c=a&&a.GetVariable("$version");}catch(e){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");c=a&&a.GetVariable("$version");}catch(b){}}}c=p.exec(c);return c?[c[1],c[3]]:[0,0];},asString:function(b){if(b===null||b===undefined){return null;}var c=typeof b;if(c=="object"&&b.push){c="array";}switch(c){case"string":b=b.replace(new RegExp('(["\\\\])',"g"),"\\$1");b=b.replace(/^\s?(\d+\.?\d+)%/,"$1pct");return'"'+b+'"';case"array":return"["+t(b,function(e){return o.asString(e);}).join(",")+"]";case"function":return'"function()"';case"object":var a=[];for(var d in b){if(b.hasOwnProperty(d)){a.push('"'+d+'":'+o.asString(b[d]));}}return"{"+a.join(",")+"}";}return String(b).replace(/\s/g," ").replace(/\'/g,'"');},getHTML:function(g,b){g=m({},g);var h='<object width="'+g.width+'" height="'+g.height+'" id="'+g.id+'" name="'+g.id+'"';if(g.cachebusting){g.src+=((g.src.indexOf("?")!=-1?"&":"?")+Math.random());}if(g.w3c||!n){h+=' data="'+g.src+'" type="application/x-shockwave-flash"';}else{h+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';}h+=">";if(g.w3c||n){h+='<param name="movie" value="'+g.src+'" />';}g.width=g.height=g.id=g.w3c=g.src=null;g.onFail=g.version=g.expressInstall=null;for(var a in g){if(g[a]){h+='<param name="'+a+'" value="'+g[a]+'" />';}}var e="";if(b){for(var d in b){if(b[d]){var c=b[d];e+=d+"="+(/function|object/.test(typeof c)?o.asString(c):c)+"&";}}e=e.slice(0,-1);h+='<param name="flashvars" value=\''+e+"' />";}h+="</object>";return h;},isSupported:function(a){return f[0]>a[0]||f[0]==a[0]&&f[1]>=a[1];}});var f=o.getVersion();function q(c,d,a){if(o.isSupported(d.version)){c.innerHTML=o.getHTML(d,a);}else{if(d.expressInstall&&o.isSupported([6,65])){c.innerHTML=o.getHTML(m(d,{src:d.expressInstall}),{MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title});}else{if(!c.innerHTML.replace(/\s/g,"")){c.innerHTML="<h2>Flash version "+d.version+" or greater is required</h2><h3>"+(f[0]>0?"Your version is "+f:"You have no flash plugin installed")+"</h3>"+(c.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+l+"'>here</a></p>");if(c.tagName=="A"){c.onclick=function(){location.href=l;};}}if(d.onFail){var b=d.onFail.call(this);if(typeof b=="string"){c.innerHTML=b;}}}}if(n){window[d.id]=document.getElementById(d.id);}m(this,{getRoot:function(){return c;},getOptions:function(){return d;},getConf:function(){return a;},getApi:function(){return c.firstChild;}});}if(r){jQuery.tools=jQuery.tools||{version:"3.2.4"};jQuery.tools.flashembed={conf:s};jQuery.fn.flashembed=function(a,b){return this.each(function(){$(this).data("flashembed",flashembed(this,a,b));});};}})();
