/*!
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */
(function(a){var d={vertical:false,rtl:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click",buttonNextCallback:null,buttonPrevCallback:null,itemFallbackDimension:null},c=false;a(window).bind("load.jcarousel",function(){c=true});a.jcarousel=function(s,q){this.options=a.extend({},d,q||{});this.autoStopped=this.locked=false;this.buttonPrevState=this.buttonNextState=this.buttonPrev=this.buttonNext=this.list=this.clip=this.container=null;if(!q||q.rtl===undefined){this.options.rtl=(a(s).attr("dir")||a("html").attr("dir")||"").toLowerCase()=="rtl"}this.wh=!this.options.vertical?"width":"height";this.lt=!this.options.vertical?this.options.rtl?"right":"left":"top";for(var r="",p=s.className.split(" "),n=0;n<p.length;n++){if(p[n].indexOf("jcarousel-skin")!=-1){a(s).removeClass(p[n]);r=p[n];break}}if(s.nodeName.toUpperCase()=="UL"||s.nodeName.toUpperCase()=="OL"){this.list=a(s);this.container=this.list.parent();if(this.container.hasClass("jcarousel-clip")){if(!this.container.parent().hasClass("jcarousel-container")){this.container=this.container.wrap("<div></div>")}this.container=this.container.parent()}else{if(!this.container.hasClass("jcarousel-container")){this.container=this.list.wrap("<div></div>").parent()}}}else{this.container=a(s);this.list=this.container.find("ul,ol").eq(0)}r!==""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1&&this.container.wrap('<div class=" '+r+'"></div>');this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass("jcarousel-clip")){this.clip=this.list.wrap("<div></div>").parent()}this.buttonNext=a(".jcarousel-next",this.container);if(this.buttonNext.size()===0&&this.options.buttonNextHTML!==null){this.buttonNext=this.clip.after(this.options.buttonNextHTML).next()}this.buttonNext.addClass(this.className("jcarousel-next"));this.buttonPrev=a(".jcarousel-prev",this.container);if(this.buttonPrev.size()===0&&this.options.buttonPrevHTML!==null){this.buttonPrev=this.clip.after(this.options.buttonPrevHTML).next()}this.buttonPrev.addClass(this.className("jcarousel-prev"));this.clip.addClass(this.className("jcarousel-clip")).css({overflow:"hidden",position:"relative"});this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden",position:"relative",top:0,margin:0,padding:0}).css(this.options.rtl?"right":"left",0);this.container.addClass(this.className("jcarousel-container")).css({position:"relative"});!this.options.vertical&&this.options.rtl&&this.container.addClass("jcarousel-direction-rtl").attr("dir","rtl");var l=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;r=this.list.children("li");var o=this;if(r.size()>0){var m=0,h=this.options.offset;r.each(function(){o.format(this,h++);m+=o.dimension(this,l)});this.list.css(this.wh,m+100+"px");if(!q||q.size===undefined){this.options.size=r.size()}}this.container.css("display","block");this.buttonNext.css("display","block");this.buttonPrev.css("display","block");this.funcNext=function(){o.next()};this.funcPrev=function(){o.prev()};this.funcResize=function(){o.reload()};this.options.initCallback!==null&&this.options.initCallback(this,"init");if(!c&&a.browser.safari){this.buttons(false,false);a(window).bind("load.jcarousel",function(){o.setup()})}else{this.setup()}};var b=a.jcarousel;b.fn=b.prototype={jcarousel:"0.2.7"};b.fn.extend=b.extend=a.extend;b.fn.extend({setup:function(){this.prevLast=this.prevFirst=this.last=this.first=null;this.animating=false;this.tail=this.timer=null;this.inTail=false;if(!this.locked){this.list.css(this.lt,this.pos(this.options.offset)+"px");var e=this.pos(this.options.start,true);this.prevFirst=this.prevLast=null;this.animate(e,false);a(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize)}},reset:function(){this.list.empty();this.list.css(this.lt,"0px");this.list.css(this.wh,"10px");this.options.initCallback!==null&&this.options.initCallback(this,"reset");this.setup()},reload:function(){this.tail!==null&&this.inTail&&this.list.css(this.lt,b.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=false;this.options.reloadCallback!==null&&this.options.reloadCallback(this);if(this.options.visible!==null){var f=this,h=Math.ceil(this.clipping()/this.options.visible),e=0,g=0;this.list.children("li").each(function(l){e+=f.dimension(this,h);if(l+1<f.first){g=e}});this.list.css(this.wh,e+"px");this.list.css(this.lt,-g+"px")}this.scroll(this.first,false)},lock:function(){this.locked=true;this.buttons()},unlock:function(){this.locked=false;this.buttons()},size:function(e){if(e!==undefined){this.options.size=e;this.locked||this.buttons()}return this.options.size},has:function(f,h){if(h===undefined||!h){h=f}if(this.options.size!==null&&h>this.options.size){h=this.options.size}for(var e=f;e<=h;e++){var g=this.get(e);if(!g.length||g.hasClass("jcarousel-item-placeholder")){return false}}return true},get:function(e){return a(".jcarousel-item-"+e,this.list)},add:function(h,p){var g=this.get(h),o=0,m=a(p);if(g.length===0){var l,n=b.intval(h);for(g=this.create(h);;){l=this.get(--n);if(n<=0||l.length){n<=0?this.list.prepend(g):l.after(g);break}}}else{o=this.dimension(g)}if(m.get(0).nodeName.toUpperCase()=="LI"){g.replaceWith(m);g=m}else{g.empty().append(p)}this.format(g.removeClass(this.className("jcarousel-item-placeholder")),h);m=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;o=this.dimension(g,m)-o;h>0&&h<this.first&&this.list.css(this.lt,b.intval(this.list.css(this.lt))-o+"px");this.list.css(this.wh,b.intval(this.list.css(this.wh))+o+"px");return g},remove:function(f){var g=this.get(f);if(!(!g.length||f>=this.first&&f<=this.last)){var e=this.dimension(g);f<this.first&&this.list.css(this.lt,b.intval(this.list.css(this.lt))+e+"px");g.remove();this.list.css(this.wh,b.intval(this.list.css(this.wh))-e+"px")}},next:function(){this.tail!==null&&!this.inTail?this.scrollTail(false):this.scroll((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!==null&&this.last==this.options.size?1:this.first+this.options.scroll)},prev:function(){this.tail!==null&&this.inTail?this.scrollTail(true):this.scroll((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!==null&&this.first==1?this.options.size:this.first-this.options.scroll)},scrollTail:function(e){if(!(this.locked||this.animating||!this.tail)){this.pauseAuto();var f=b.intval(this.list.css(this.lt));f=!e?f-this.tail:f+this.tail;this.inTail=!e;this.prevFirst=this.first;this.prevLast=this.last;this.animate(f)}},scroll:function(e,f){if(!(this.locked||this.animating)){this.pauseAuto();this.animate(this.pos(e),f)}},pos:function(D,B){var C=b.intval(this.list.css(this.lt));if(this.locked||this.animating){return C}if(this.options.wrap!="circular"){D=D<1?1:this.options.size&&D>this.options.size?this.options.size:D}for(var A=this.first>D,y=this.options.wrap!="circular"&&this.first<=1?1:this.first,w=A?this.get(y):this.get(this.last),z=A?y:y-1,x=null,v=0,t=false,s=0;A?--z>=D:++z<D;){x=this.get(z);t=!x.length;if(x.length===0){x=this.create(z).addClass(this.className("jcarousel-item-placeholder"));w[A?"before":"after"](x);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(z<=0||z>this.options.size)){w=this.get(this.index(z));if(w.length){x=this.add(z,w.clone(true))}}}w=x;s=this.dimension(x);if(t){v+=s}if(this.first!==null&&(this.options.wrap=="circular"||z>=1&&(this.options.size===null||z<=this.options.size))){C=A?C+s:C-s}}y=this.clipping();var h=[],q=0,r=0;w=this.get(D-1);for(z=D;++q;){x=this.get(z);t=!x.length;if(x.length===0){x=this.create(z).addClass(this.className("jcarousel-item-placeholder"));w.length===0?this.list.prepend(x):w[A?"before":"after"](x);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(z<=0||z>this.options.size)){w=this.get(this.index(z));if(w.length){x=this.add(z,w.clone(true))}}}w=x;s=this.dimension(x);if(s===0){throw Error("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...")}if(this.options.wrap!="circular"&&this.options.size!==null&&z>this.options.size){h.push(x)}else{if(t){v+=s}}r+=s;if(r>=y){break}z++}for(x=0;x<h.length;x++){h[x].remove()}if(v>0){this.list.css(this.wh,this.dimension(this.list)+v+"px");if(A){C-=v;this.list.css(this.lt,b.intval(this.list.css(this.lt))-v+"px")}}v=D+q-1;if(this.options.wrap!="circular"&&this.options.size&&v>this.options.size){v=this.options.size}if(z>v){q=0;z=v;for(r=0;++q;){x=this.get(z--);if(!x.length){break}r+=this.dimension(x);if(r>=y){break}}}z=v-q+1;if(this.options.wrap!="circular"&&z<1){z=1}if(this.inTail&&A){C+=this.tail;this.inTail=false}this.tail=null;if(this.options.wrap!="circular"&&v==this.options.size&&v-q+1>=1){A=b.margin(this.get(v),!this.options.vertical?"marginRight":"marginBottom");if(r-A>y){this.tail=r-y-A}}if(B&&D===this.options.size&&this.tail){C-=this.tail;this.inTail=true}for(;D-->z;){C+=this.dimension(this.get(D))}this.prevFirst=this.first;this.prevLast=this.last;this.first=z;this.last=v;return C},animate:function(f,h){if(!(this.locked||this.animating)){this.animating=true;var e=this,g=function(){e.animating=false;f===0&&e.list.css(e.lt,0);if(!e.autoStopped&&(e.options.wrap=="circular"||e.options.wrap=="both"||e.options.wrap=="last"||e.options.size===null||e.last<e.options.size||e.last==e.options.size&&e.tail!==null&&!e.inTail)){e.startAuto()}e.buttons();e.notify("onAfterAnimation");if(e.options.wrap=="circular"&&e.options.size!==null){for(var l=e.prevFirst;l<=e.prevLast;l++){if(l!==null&&!(l>=e.first&&l<=e.last)&&(l<1||l>e.options.size)){e.remove(l)}}}};this.notify("onBeforeAnimation");if(!this.options.animation||h===false){this.list.css(this.lt,f+"px");g()}else{this.list.animate(!this.options.vertical?this.options.rtl?{right:f}:{left:f}:{top:f},this.options.animation,this.options.easing,g)}}},startAuto:function(e){if(e!==undefined){this.options.auto=e}if(this.options.auto===0){return this.stopAuto()}if(this.timer===null){this.autoStopped=false;var f=this;this.timer=window.setTimeout(function(){f.next()},this.options.auto*1000)}},stopAuto:function(){this.pauseAuto();this.autoStopped=true},pauseAuto:function(){if(this.timer!==null){window.clearTimeout(this.timer);this.timer=null}},buttons:function(f,g){if(f==null){f=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="first"||this.options.size===null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap=="first")&&this.options.size!==null&&this.last>=this.options.size){f=this.tail!==null&&!this.inTail}}if(g==null){g=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="last"||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!==null&&this.first==1){g=this.tail!==null&&this.inTail}}var e=this;if(this.buttonNext.size()>0){this.buttonNext.unbind(this.options.buttonNextEvent+".jcarousel",this.funcNext);f&&this.buttonNext.bind(this.options.buttonNextEvent+".jcarousel",this.funcNext);this.buttonNext[f?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",f?false:true);this.options.buttonNextCallback!==null&&this.buttonNext.data("jcarouselstate")!=f&&this.buttonNext.each(function(){e.options.buttonNextCallback(e,this,f)}).data("jcarouselstate",f)}else{this.options.buttonNextCallback!==null&&this.buttonNextState!=f&&this.options.buttonNextCallback(e,null,f)}if(this.buttonPrev.size()>0){this.buttonPrev.unbind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev);g&&this.buttonPrev.bind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev);this.buttonPrev[g?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",g?false:true);this.options.buttonPrevCallback!==null&&this.buttonPrev.data("jcarouselstate")!=g&&this.buttonPrev.each(function(){e.options.buttonPrevCallback(e,this,g)}).data("jcarouselstate",g)}else{this.options.buttonPrevCallback!==null&&this.buttonPrevState!=g&&this.options.buttonPrevCallback(e,null,g)}this.buttonNextState=f;this.buttonPrevState=g},notify:function(e){var f=this.prevFirst===null?"init":this.prevFirst<this.first?"next":"prev";this.callback("itemLoadCallback",e,f);if(this.prevFirst!==this.first){this.callback("itemFirstInCallback",e,f,this.first);this.callback("itemFirstOutCallback",e,f,this.prevFirst)}if(this.prevLast!==this.last){this.callback("itemLastInCallback",e,f,this.last);this.callback("itemLastOutCallback",e,f,this.prevLast)}this.callback("itemVisibleInCallback",e,f,this.first,this.last,this.prevFirst,this.prevLast);this.callback("itemVisibleOutCallback",e,f,this.prevFirst,this.prevLast,this.first,this.last)},callback:function(v,s,t,r,p,n,q){if(!(this.options[v]==null||typeof this.options[v]!="object"&&s!="onAfterAnimation")){var o=typeof this.options[v]=="object"?this.options[v][s]:this.options[v];if(a.isFunction(o)){var m=this;if(r===undefined){o(m,t,s)}else{if(p===undefined){this.get(r).each(function(){o(m,this,r,t,s)})}else{v=function(e){m.get(e).each(function(){o(m,this,e,t,s)})};for(var h=r;h<=p;h++){h!==null&&!(h>=n&&h<=q)&&v(h)}}}}}},create:function(e){return this.format("<li></li>",e)},format:function(f,h){f=a(f);for(var e=f.get(0).className.split(" "),g=0;g<e.length;g++){e[g].indexOf("jcarousel-")!=-1&&f.removeClass(e[g])}f.addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+h)).css({"float":this.options.rtl?"right":"left","list-style":"none"}).attr("jcarouselindex",h);return f},className:function(e){return e+" "+e+(!this.options.vertical?"-horizontal":"-vertical")},dimension:function(f,h){var e=f.jquery!==undefined?f[0]:f,g=!this.options.vertical?(e.offsetWidth||b.intval(this.options.itemFallbackDimension))+b.margin(e,"marginLeft")+b.margin(e,"marginRight"):(e.offsetHeight||b.intval(this.options.itemFallbackDimension))+b.margin(e,"marginTop")+b.margin(e,"marginBottom");if(h==null||g==h){return g}g=!this.options.vertical?h-b.margin(e,"marginLeft")-b.margin(e,"marginRight"):h-b.margin(e,"marginTop")-b.margin(e,"marginBottom");a(e).css(this.wh,g+"px");return this.dimension(e)},clipping:function(){return !this.options.vertical?this.clip[0].offsetWidth-b.intval(this.clip.css("borderLeftWidth"))-b.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-b.intval(this.clip.css("borderTopWidth"))-b.intval(this.clip.css("borderBottomWidth"))},index:function(e,f){if(f==null){f=this.options.size}return Math.round(((e-1)/f-Math.floor((e-1)/f))*f)+1}});b.extend({defaults:function(e){return a.extend(d,e||{})},margin:function(g,n){if(!g){return 0}var e=g.jquery!==undefined?g[0]:g;if(n=="marginRight"&&a.browser.safari){var m={display:"block","float":"none",width:"auto"},l,h;a.swap(e,m,function(){l=e.offsetWidth});m.marginRight=0;a.swap(e,m,function(){h=e.offsetWidth});return h-l}return b.intval(a.css(e,n))},intval:function(e){e=parseInt(e,10);return isNaN(e)?0:e}});a.fn.jcarousel=function(f){if(typeof f=="string"){var g=a(this).data("jcarousel"),e=Array.prototype.slice.call(arguments,1);return g[f].apply(g,e)}else{return this.each(function(){a(this).data("jcarousel",new b(this,f))})}}})(jQuery);(function(f){var e=new Array;var c=new Array;var m=new Array;var o=new Array;var d=new Array;var h=new Array;var b=new Array;var g=new Array;var n=new Array;var a=new Array;var l=new Array;f.fn.coinslider=f.fn.CoinSlider=function(p){init=function(q){c[q.id]=new Array();m[q.id]=new Array();o[q.id]=new Array();d[q.id]=new Array();h[q.id]=new Array();g[q.id]=0;a[q.id]=0;l[q.id]=1;e[q.id]=f.extend({},f.fn.coinslider.defaults,p);f.each(f("#"+q.id+" img"),function(r,s){m[q.id][r]=f(s).attr("src");o[q.id][r]=f(s).parent().is("a")?f(s).parent().attr("href"):"";d[q.id][r]=f(s).parent().is("a")?f(s).parent().attr("target"):"";h[q.id][r]=f(s).next().is("span")?f(s).next().html():"";f(s).hide();f(s).next().hide()});f(q).css({"background-image":"url("+m[q.id][0]+")",width:e[q.id].width,height:e[q.id].height,position:"relative","background-position":"top left"}).wrap("<div class='coin-slider' id='coin-slider-"+q.id+"' />");f("#"+q.id).append("<div class='cs-title' id='cs-title-"+q.id+"' style='position: absolute; bottom:0; left: 0; z-index: 1000;'></div>");f.setFields(q);if(e[q.id].navigation){f.setNavigation(q)}f.transition(q,0);f.transitionCall(q)};f.setFields=function(q){tWidth=sWidth=parseInt(e[q.id].width/e[q.id].spw);tHeight=sHeight=parseInt(e[q.id].height/e[q.id].sph);counter=sLeft=sTop=0;tgapx=gapx=e[q.id].width-e[q.id].spw*sWidth;tgapy=gapy=e[q.id].height-e[q.id].sph*sHeight;for(i=1;i<=e[q.id].sph;i++){gapx=tgapx;if(gapy>0){gapy--;sHeight=tHeight+1}else{sHeight=tHeight}for(j=1;j<=e[q.id].spw;j++){if(gapx>0){gapx--;sWidth=tWidth+1}else{sWidth=tWidth}c[q.id][counter]=i+""+j;counter++;if(e[q.id].links){f("#"+q.id).append("<a href='"+o[q.id][0]+"' class='cs-"+q.id+"' id='cs-"+q.id+i+j+"' style='width:"+sWidth+"px; height:"+sHeight+"px; float: left; position: absolute;'></a>")}else{f("#"+q.id).append("<div class='cs-"+q.id+"' id='cs-"+q.id+i+j+"' style='width:"+sWidth+"px; height:"+sHeight+"px; float: left; position: absolute;'></div>")}f("#cs-"+q.id+i+j).css({"background-position":-sLeft+"px "+(-sTop+"px"),left:sLeft,top:sTop});sLeft+=sWidth}sTop+=sHeight;sLeft=0}f(".cs-"+q.id).mouseover(function(){f("#cs-navigation-"+q.id).show()});f(".cs-"+q.id).mouseout(function(){f("#cs-navigation-"+q.id).hide()});f("#cs-title-"+q.id).mouseover(function(){f("#cs-navigation-"+q.id).show()});f("#cs-title-"+q.id).mouseout(function(){f("#cs-navigation-"+q.id).hide()});if(e[q.id].hoverPause){f(".cs-"+q.id).mouseover(function(){e[q.id].pause=true});f(".cs-"+q.id).mouseout(function(){e[q.id].pause=false});f("#cs-title-"+q.id).mouseover(function(){e[q.id].pause=true});f("#cs-title-"+q.id).mouseout(function(){e[q.id].pause=false})}};f.transitionCall=function(q){clearInterval(b[q.id]);delay=e[q.id].delay+e[q.id].spw*e[q.id].sph*e[q.id].sDelay;b[q.id]=setInterval(function(){f.transition(q)},delay)};f.transition=function(q,r){if(e[q.id].pause==true){return}f.effect(q);a[q.id]=0;n[q.id]=setInterval(function(){f.appereance(q,c[q.id][a[q.id]])},e[q.id].sDelay);f(q).css({"background-image":"url("+m[q.id][g[q.id]]+")"});if(typeof(r)=="undefined"){g[q.id]++}else{if(r=="prev"){g[q.id]--}else{g[q.id]=r}}if(g[q.id]==m[q.id].length){g[q.id]=0}if(g[q.id]==-1){g[q.id]=m[q.id].length-1}f(".cs-button-"+q.id).removeClass("cs-active");f("#cs-button-"+q.id+"-"+(g[q.id]+1)).addClass("cs-active");if(h[q.id][g[q.id]]){f("#cs-title-"+q.id).css({opacity:0}).animate({opacity:e[q.id].opacity},e[q.id].titleSpeed);f("#cs-title-"+q.id).html(h[q.id][g[q.id]])}else{f("#cs-title-"+q.id).css("opacity",0)}};f.appereance=function(r,q){f(".cs-"+r.id).attr("href",o[r.id][g[r.id]]).attr("target",d[r.id][g[r.id]]);if(a[r.id]==e[r.id].spw*e[r.id].sph){clearInterval(n[r.id]);return}f("#cs-"+r.id+q).css({opacity:0,"background-image":"url("+m[r.id][g[r.id]]+")"});f("#cs-"+r.id+q).animate({opacity:1},300);a[r.id]++};f.setNavigation=function(q){f(q).append("<div id='cs-navigation-"+q.id+"'></div>");f("#cs-navigation-"+q.id).hide();f("#cs-navigation-"+q.id).append("<a href='#' id='cs-prev-"+q.id+"' class='cs-prev'>prev</a>");f("#cs-navigation-"+q.id).append("<a href='#' id='cs-next-"+q.id+"' class='cs-next'>next</a>");f("#cs-prev-"+q.id).css({position:"absolute",top:e[q.id].height/2-15,left:0,"z-index":1001,"line-height":"30px",opacity:e[q.id].opacity}).click(function(r){r.preventDefault();f.transition(q,"prev");f.transitionCall(q)}).mouseover(function(){f("#cs-navigation-"+q.id).show()});f("#cs-next-"+q.id).css({position:"absolute",top:e[q.id].height/2-15,right:0,"z-index":1001,"line-height":"30px",opacity:e[q.id].opacity}).click(function(r){r.preventDefault();f.transition(q);f.transitionCall(q)}).mouseover(function(){f("#cs-navigation-"+q.id).show()});f("<div id='cs-buttons-"+q.id+"' class='cs-buttons'></div>").appendTo(f("#coin-slider-"+q.id));for(k=1;k<m[q.id].length+1;k++){f("#cs-buttons-"+q.id).append("<a href='#' class='cs-button-"+q.id+"' id='cs-button-"+q.id+"-"+k+"'>"+k+"</a>")}f.each(f(".cs-button-"+q.id),function(r,s){f(s).click(function(t){f(".cs-button-"+q.id).removeClass("cs-active");f(this).addClass("cs-active");t.preventDefault();f.transition(q,r);f.transitionCall(q)})});f("#cs-navigation-"+q.id+" a").mouseout(function(){f("#cs-navigation-"+q.id).hide();e[q.id].pause=false});f("#cs-buttons-"+q.id).css({left:"50%","margin-left":-m[q.id].length*15/2-5,position:"relative"})};f.effect=function(q){effA=["random","swirl","rain","straight"];if(e[q.id].effect==""){eff=effA[Math.floor(Math.random()*(effA.length))]}else{eff=e[q.id].effect}c[q.id]=new Array();if(eff=="random"){counter=0;for(i=1;i<=e[q.id].sph;i++){for(j=1;j<=e[q.id].spw;j++){c[q.id][counter]=i+""+j;counter++}}f.random(c[q.id])}if(eff=="rain"){f.rain(q)}if(eff=="swirl"){f.swirl(q)}if(eff=="straight"){f.straight(q)}l[q.id]*=-1;if(l[q.id]>0){c[q.id].reverse()}};f.random=function(q){var s=q.length;if(s==0){return false}while(--s){var r=Math.floor(Math.random()*(s+1));var v=q[s];var t=q[r];q[s]=t;q[r]=v}};f.swirl=function(q){var s=e[q.id].sph;var t=e[q.id].spw;var B=1;var A=1;var r=0;var v=0;var z=0;var w=true;while(w){v=(r==0||r==2)?t:s;for(i=1;i<=v;i++){c[q.id][z]=B+""+A;z++;if(i!=v){switch(r){case 0:A++;break;case 1:B++;break;case 2:A--;break;case 3:B--;break}}}r=(r+1)%4;switch(r){case 0:t--;A++;break;case 1:s--;B++;break;case 2:t--;A--;break;case 3:s--;B--;break}check=f.max(s,t)-f.min(s,t);if(t<=check&&s<=check){w=false}}};f.rain=function(s){var w=e[s.id].sph;var q=e[s.id].spw;var v=0;var t=to2=from=1;var r=true;while(r){for(i=from;i<=t;i++){c[s.id][v]=i+""+parseInt(to2-i+1);v++}to2++;if(t<w&&to2<q&&w<q){t++}if(t<w&&w>=q){t++}if(to2>q){from++}if(from>t){r=false}}};f.straight=function(q){counter=0;for(i=1;i<=e[q.id].sph;i++){for(j=1;j<=e[q.id].spw;j++){c[q.id][counter]=i+""+j;counter++}}};f.min=function(r,q){if(r>q){return q}else{return r}};f.max=function(r,q){if(r<q){return q}else{return r}};this.each(function(){init(this)})};f.fn.coinslider.defaults={width:565,height:290,spw:7,sph:5,delay:3000,sDelay:30,opacity:0.7,titleSpeed:500,effect:"",navigation:true,links:true,hoverPause:true}})(jQuery);var CONTAINER="CONTAINER";var GRID="GRID";var PLAYING_VIDEO_ID;var PLAYING_VIDEOMAP_ID;var PLAYING_VIDEO_PERMURL;var PLAYING_VIDEO_DURATION;var PLAYING_VIDEO_PAUSE_TIME;var BLIP_LAST_COMPLETION_TIME;var PLAYING_VIDEO_SEEK_TIME;var IS_YOUTUBE_IFRAME_PLAYER;var AUTH_FORM_LOGIN_ID="loginform";var AUTH_FORM_REGISTER_ID="registerform";var AUTH_FORM_CLASS="authformholder";var HEADER_LOGIN="header_login";var HEADER_SIGNUP="header_signup";var HEADER_LOGIN_CLOSE="header_login_close";var HEADER_SIGNUP_CLOSE="header_signup_close";var FEATURE_HEIGHT=674;var ERROR_DIV_HEIGHT=26;var FPID="frontpage";var DVG=0;var CVG=0;var VCS_M="MANUAL";var VCS_A="AUTO";var PDID="rbvideoplayer";var APDID="videoplayer_alt";var SPC="smallerplayer";var TB="tbox";var TWS="twstatus";var TD="tweet-box";var LID=-1;var TWL="lid";var TWBM="bm";var TWTY;var rbObject={shareOnFB:function(d,c){if(d.preventDefault){d.preventDefault()}else{d.returnValue=false}var a=PLAYING_VIDEO_PERMURL;var b=PLAYING_VIDEO_ID;window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(a),"sharer","toolbar=0,status=0,width=626,height=436");jQuery("#videoId").val(b);ajax(c,["videoId"],"ajaxCallEval");return false},toggleEmail:function(){var a="emailShare";$("#"+a).slideToggle();jQuery("#"+a).animate({opacity:1});jQuery("#toEmailHint").css("display","None");$("#emailstatusbox").hide();jQuery("#from_email").attr("readonly","");jQuery("#to_email").attr("readonly","");jQuery("#message").attr("readonly","")},sendMail:function(e,b,c){anyError=false;fromEmail="";toEmail="";if(b!="inv"){fromEmail=jQuery("#from_email").val();fromEmail=jQuery.trim(fromEmail);toEmail=jQuery("#to_email").val();toEmail=jQuery.trim(toEmail);if(fromEmail==null||fromEmail==""){anyError=true;jQuery("#fromEmailErr").show()}else{jQuery("#fromEmailErr").hide()}if(toEmail==null||toEmail==""){anyError=true;jQuery("#toEmailErr").show()}else{jQuery("#toEmailErr").hide()}msg=jQuery("#message").val();jQuery("#messageEmail").val(msg)}else{fromEmail=jQuery("#invFromEmail").val();fromEmail=jQuery.trim(fromEmail);toEmailVal=jQuery("#toEmail").val();toEmailVal=jQuery.trim(toEmailVal);additionalEmails=$("textarea#additionalEmails").val();additionalEmails=jQuery.trim(additionalEmails);if((toEmailVal==null||toEmailVal==""||toEmailVal=="-1")&&(additionalEmails==null||additionalEmails=="")){anyError=true;jQuery("#invEmailErr").show()}else{jQuery("#invEmailErr").hide();toEmail=toEmailVal+", "+additionalEmails;fromEmail=jQuery("#invFromEmail").val()}}if(!anyError){jQuery("#fromEmail").val(fromEmail);jQuery("#toEmail").val(toEmail);if(b!="inv"){jQuery("#from_email").attr("readonly","readonly");jQuery("#to_email").attr("readonly","readonly");jQuery("#message").attr("readonly","readonly")}else{$("textarea#additionalEmails").attr("readonly","readonly")}jQuery("#videoId").val(b);var d="<img vertical-align=middle src="+c+' style="padding: 10 px" > </img>';var a="emailShare";jQuery("#"+a).animate({opacity:0.6},500);$("#emailstatusbox").attr("align","center").html(d).attr("class","emailStatusImg");$("#emailstatusbox").show();rbObject.callAjax(e,["fromEmail","toEmail","messageEmail","videoId"])}return false},callAjax:function(a,c){var b,d="";for(b=0;b<c.length;b++){if(b>0){d=d+"&"}d=d+encodeURIComponent(c[b])+"="+encodeURIComponent(document.getElementById(c[b]).value)}jQuery.ajax({type:"POST",url:a,data:d,success:rbObject.emailPostProcess})},emailPostProcess:function(a){vidId=jQuery("#videoId").val();$("#emailstatusbox").html(a).attr("align","center").attr("class","emailStatus").css("display","block");if(vidId!="inv"){jQuery("#fromEmailErr").hide();jQuery("#toEmailErr").hide();setTimeout(function(){rbObject.toggleEmail(vidId)},1500)}else{jQuery("#invEmailErr").hide();if(a=="Invitation has been sent successfully!"){setTimeout(function(){var b="emailShare_"+vidId;jQuery("#"+b).animate({opacity:1});newHtml="<p>Thank for you inviting friends. Sheep will redirect you to home page.</p>";$("#"+b).html(newHtml);setTimeout(function(){url="/";window.location.href=url},3000)},2500)}else{setTimeout(function(){$("#emailstatusbox").css("display","None")},2500)}}},sendVideoMail:function(c,b){var a=PLAYING_VIDEO_ID;return rbObject.sendMail(c,a,b)},sendInviteMail:function(b,a){return rbObject.sendMail(b,"inv",a)},showFieldHint:function(a){jQuery("#toEmailHint").css("display","inline")},hideFieldHint:function(a){jQuery("#toEmailHint").css("display","None")},toggleTweetBox:function(a){if($("#tbox:visible").length>0){$("#tbox").hide().empty()}else{rbObject.showVidTweetBox(a);$("#tbox").show()}},showVidTweetBox:function(){rbObject.showTweetBox(TWBM,PLAYING_VIDEO_ID)},showListTweetBox:function(a){rbObject.showTweetBox(TWL,a)},showTweetBox:function(b,c){var a=rbObject.getUrl({c:"share_util",f:"getTweet"});if(document.getElementById(("#"+TB).substr(1)).firstChild==null){$("#"+TWS).html("Shortening url and loading...").show();$("."+TD).show();u=a;u+="?"+b+"="+c;if(b==TWL){LID=parseInt(c)}TWTY=b;jQuery.ajax({type:"POST",url:u,success:rbObject.updateTweetBox})}},updateTweetBox:function(c){boxid="#"+TB;twid="#"+TWS;if(c=="None"){$("#twstatus").html("Oops...something went wrong!").fadeOut(2000)}else{var b=TWTY;var a="Tweet this list";if(b==TWBM){a="<span style='color: #CCC;'>Tweet this video</span>"}twttr.anywhere(function(d){d(boxid).tweetBox({height:50,width:640,defaultContent:c,label:a,onTweet:rbObject.removeTweetBox,complete:function(){var e=document.getElementById(boxid.substr(1));var f=e.getElementsByTagName("iframe")[0].contentWindow.jQuery;f("#tweet-box").focus();$(boxid+" iframe")[0].contentWindow.jQuery("#tweet-box").focus()}});$(twid).delay(1000).fadeOut(1000);if(!d.isConnected()){$("#twlogout").hide()}})}},removeTweetBox:function(){boxid="#tbox";twid="#twstatus";vid=PLAYING_VIDEO_ID;lid=LID;ttype=TWTY;$(boxid).fadeOut("slow").empty();$(twid).html("Done!").show().fadeOut(1500);$("."+TD).hide();$("#twlogout").show();mKey="";mVal=-1;if(ttype==TWBM){mVal=vid}else{mVal=lid}var a=encodeURIComponent("tt")+"="+encodeURIComponent(ttype)+"&"+encodeURIComponent("mv")+"="+encodeURIComponent(mVal);var b=rbObject.getUrl({c:"share_util",f:"updateTweetMet"});jQuery.ajax({type:"POST",url:b,data:a});return False},twitterSignout:function(a){a.preventDefault();twttr.anywhere.signOut();$("#twlogout").hide();$(".flash").html("Logged out of Twitter").show()},handleStarEvent:function(b,c){var a=PLAYING_VIDEOMAP_ID;query=encodeURIComponent("videomapId")+"="+encodeURIComponent(a);jQuery.ajax({type:"POST",url:c,data:query,success:function(f){if(f!=null&&"T"==f){var e="int_favorite_ac";var d="Remove from Favorites"}else{var e="int_favorite";var d="Add to Favorites"}$("#"+b).attr("class",e).attr("Title",d)}})},handleArchiveEvent:function(b,c){var a=PLAYING_VIDEOMAP_ID;query=encodeURIComponent("videomapId")+"="+encodeURIComponent(a);jQuery.ajax({type:"POST",url:c,data:query,success:function(f){if(f!=null&&"T"==f){var e="int_archive_ac";var d="Remove from Archives"}else{var e="int_archive";var d="Add to Archives"}$("#"+b).attr("class",e).attr("Title",d)}})},handleSubscribeEvent:function(a,b){channelId=a[0].getAttribute("id");toggle_on=(channelId.charAt(0)=="t");query=encodeURIComponent("channel_id")+"="+encodeURIComponent(channelId.substring(1))+"&"+encodeURIComponent("toggle_on")+"="+encodeURIComponent(toggle_on);jQuery.ajax({type:"POST",url:b,data:query,success:function(d){if(d!=null&&"True"==d){var c="#t";if(toggle_on){c="#u"}c+=channelId.substring(1);$(c).show();$("#"+channelId).hide()}}})},deleteBM:function(d,c){if(d.preventDefault){d.preventDefault()}else{d.returnValue=false}var f=window.event?window.event.srcElement:d.target;var b=rbObject.getUrl({c:"share_util",f:"delete_article"});var a=encodeURIComponent("aid")+"="+encodeURIComponent(c);jQuery.ajax({type:"POST",url:b,data:a,success:function(e){if(e!=null&&"T"==e){jQuery(".flash").html("Bookmark deleted from queue");jQuery(".flash").show();setTimeout(function(){jQuery(".flash").hide()},2500);$(f).parents(".infobubblebg").slideUp("slow")}}});return false},deleteVideo:function(e,a,b){var d=rbObject.getUrl({c:"share_util",f:"delete_video"});var c=encodeURIComponent("vmId")+"="+encodeURIComponent(e)+"&"+encodeURIComponent("lid")+"="+encodeURIComponent(a);if(b==GRID||b==CONTAINER){jQuery.ajax({type:"POST",url:d,data:c,success:function(f){if(f!=null&&"T"==f){jQuery(".flash").html("Video deleted from queue");jQuery(".flash").show();setTimeout(function(){jQuery(".flash").hide()},2500);switch(b){case GRID:$("#drag_vid_"+e).addClass("uservideoopacity");$("#drag_vid_"+e+" .actionsDiv>span.delFromGrid").hide();$("#drag_vid_"+e+" .actionsDiv>span.addFromGrid").show();break;case CONTAINER:$("#act_trash").css("display","none");$("#act_add").css("display","inline-block");$("#act_lists").css("display","none");break;default:break}}}})}return false},delVideoFromGrid:function(b,a){rbObject.deleteVideo(b,a,GRID);return false},delVideoFromContainer:function(){var a=PLAYING_VIDEOMAP_ID;rbObject.deleteVideo(a,-1,CONTAINER);return false},addVideoToQueue:function(d,g,c,b){var f=rbObject.getUrl({c:"share_util",f:"add_video"});var a=rbObject.getUrl({c:"lists",f:"video"});var e=encodeURIComponent("videoId")+"="+encodeURIComponent(d)+"&"+encodeURIComponent("lid")+"="+encodeURIComponent(b);jQuery.ajax({type:"POST",url:f,data:e,success:function(l){if(l!=null&&"F"!=l){flash_msg="Video added to queue";jQuery(".flash").html(flash_msg);jQuery(".flash").show();setTimeout(function(){jQuery(".flash").hide()},2500);switch(c){case GRID:$("#drag_vid_"+g).removeClass("uservideoopacity");$("#drag_vid_"+g+" .actionsDiv>span.addFromGrid").hide();$("#drag_vid_"+g+" .actionsDiv>span.delFromGrid").show();break;case CONTAINER:$("#act_trash").css("display","inline-block");$("#act_add").css("display","none");$("#act_lists").css("display","inline-block");PLAYING_VIDEOMAP_ID=l;if(a!=null){var h=encodeURIComponent("vm_id")+"="+encodeURIComponent(PLAYING_VIDEOMAP_ID);jQuery.ajax({type:"get",url:a,data:h,success:function(n){var m=($("#lists_div").length>0);if(!m){$("#userlistsform").html('<div id="lists_div"></div>')}jQuery("#lists_div").html(n)}})}break;default:break}}}});return false},addVideoFromGrid:function(c,d,b,a){if(a=="False"){b=-1}rbObject.addVideoToQueue(c,d,GRID,b);return false},addVideoFromContainer:function(){var a=PLAYING_VIDEO_ID;var b=PLAYING_VIDEOMAP_ID;rbObject.addVideoToQueue(a,b,CONTAINER,-1);return false},hideAuthForms:function(a){},showAuthFormErrors:function(){if($("DIV.error").length!=0){if($("DIV.error").parents("div#"+AUTH_FORM_LOGIN_ID).length!=0){rbObject.toggleFrontPageDivs(AUTH_FORM_LOGIN_ID,$("DIV.error").length)}else{if($("DIV.error").parents("div#"+AUTH_FORM_REGISTER_ID).length!=0){rbObject.toggleFrontPageDivs(AUTH_FORM_REGISTER_ID,$("DIV.error").length)}}}else{$("div#"+FPID).show()}},toggleFrontPageDivs:function(b,c){if(b==null||b==undefined||$.trim(b)==""){return}if(c>0){$("div#"+FPID).hide()}else{$("div#"+FPID).fadeToggle("fast","linear")}if($("div."+AUTH_FORM_CLASS).is(":visible")==true){$("div#"+AUTH_FORM_LOGIN_ID).hide();$("div#"+AUTH_FORM_REGISTER_ID).hide()}else{$("div#"+b).fadeToggle("fast","linear")}try{var d=$("div#"+b).height();var a=(FEATURE_HEIGHT-d-c*ERROR_DIV_HEIGHT)/2}catch(f){}if(b==AUTH_FORM_REGISTER_ID){$("div#"+AUTH_FORM_LOGIN_ID).hide()}else{$("div#"+AUTH_FORM_REGISTER_ID).hide()}},showSignInForm:function(c){if(c.preventDefault){c.preventDefault()}else{c.returnValue=false}var b;var d=window.event?window.event.srcElement:c.target;try{b=d.getAttribute("id");if(b==null||b==undefined||$.trim(b)==""){return true}else{if(!(b==HEADER_LOGIN||b==HEADER_SIGNUP||b==HEADER_LOGIN_CLOSE||b==HEADER_SIGNUP_CLOSE)){return true}}}catch(c){return true}var a=AUTH_FORM_REGISTER_ID;if(b==HEADER_LOGIN||b==HEADER_LOGIN_CLOSE){a=AUTH_FORM_LOGIN_ID}rbObject.toggleFrontPageDivs(a,0)},showRegisterForm:function(a){},showCngPassForm:function(a){},selectAllFriends:function(b){var a="";jQuery("input#toEmail").val(a);if(b){$('input[name="friendSel"][type="checkbox"]').each(function(){currentVal=this.value;if(currentVal!=null&&currentVal!=""&&currentVal!="-1"){if(a==""||a==null||a=="-1"){a=currentVal}else{a+=", "+currentVal}}});$('input[name="friendSel"][type="checkbox"]').attr("checked",true);jQuery("input#toEmail").val(a)}else{$('input[name="friendSel"][type="checkbox"]').attr("checked",false)}},handleChkBoxEvent:function(c,a){if(c.checked){if(a==""||a==null||a=="-1"){a=c.value}else{a+=", "+c.value}}else{a=a.replace(c.value+", ","");a=a.replace(c.value,"");var b=a.lastIndexOf(", ");if(b!=-1&&b==a.length-2){a=a.substring(0,b)}}return a},createlist:function(b){try{anyError=false;listName="";listName=jQuery.trim(jQuery("#list_name").val());if(listName==null||listName==""){anyError=true;jQuery("#listNameErr").show();jQuery("#listErrMsg").html("list Name is required.")}else{jQuery("#listNameErr").hide()}if(!anyError){listType=$("input[name='listtype']:checked").val();query=encodeURIComponent("listName")+"="+encodeURIComponent(listName)+"&"+encodeURIComponent("listType")+"="+encodeURIComponent(listType);jQuery.ajax({type:"POST",url:b,data:query,dataTypeString:"json",success:function(c){if(c!="SUCCESS"){jQuery("#listNameErr").show();jQuery("#listErrMsg").html(c)}else{jQuery("#listNameErr").hide()}}})}return false}catch(a){txt="There was an error on this page.\n\n";txt+="Error description: "+a.description+"\n\n";txt+="Click OK to continue.\n\n";return false}},handleInviteChkBox:function(b){var a=jQuery("input#toEmail").val();a=rbObject.handleChkBoxEvent(b,a);jQuery("input#toEmail").val(a)},addVideoToLists:function(b){try{var d=rbObject.getUrl({c:"share_util",f:"process_video_lists"});var a=rbObject.getSelectedLists();rbObject.processAddVideoToList(d,b,a,false)}catch(c){txt="addVideoToLists - Error : "+c.description+"\n\n";return false}},processDraggedVideo:function(f,c){try{var e=rbObject.getUrl({c:"share_util",f:"process_video_lists"});var b=f.replace("drag_vid_","");var a=c.replace("list_","");rbObject.processAddVideoToList(e,b,a,true)}catch(d){txt="There was an error on this page.\n\nError description: "+d.description+"\n\n";return false}},processAddVideoToList:function(e,c,a,b){try{query=encodeURIComponent("vm_id")+"="+encodeURIComponent(c)+"&"+encodeURIComponent("vidlists")+"="+encodeURIComponent(a)+"&"+encodeURIComponent("dragdrop")+"="+encodeURIComponent(b);jQuery.ajax({type:"POST",url:e,data:query,success:function(f){if(f!=null&&"ERROR"!=f){$("DIV#videolists").html(f).css("display","none");jQuery(".flash").html(f);jQuery(".flash").show();setTimeout(function(){jQuery(".flash").hide()},2500);if(!b){rbObject.toggleAddToListForm()}}}})}catch(d){txt="processAddVideoToList - Error : "+d.description+"\n\n";return False}},changeListType:function(d,f){var b=d.id;var a=b.replace("publiclist_","").replace("privatelist_","");var c="";if(b.indexOf("publiclist")==0){c="PUBLIC"}else{if(b.indexOf("privatelist")==0){c="PRIVATE"}}var e=encodeURIComponent("list_id")+"="+encodeURIComponent(a)+"&"+encodeURIComponent("list_type")+"="+encodeURIComponent(c);jQuery.ajax({type:"POST",url:f,data:e,success:function(g){if(g=="T"){if(c=="PRIVATE"){jQuery("#list_fb_"+a).css("display","none");jQuery("#list_tw_"+a).css("display","none")}else{jQuery("#list_fb_"+a).css("display","inline-block");jQuery("#list_tw_"+a).css("display","inline-block").css("cursor","pointer")}jQuery(".flash").html("Changes Saved");jQuery(".flash").show();setTimeout(function(){jQuery(".flash").hide()},2500)}}})},shareListOnFB:function(f,d,b,a){if(f.preventDefault){f.preventDefault()}else{f.returnValue=false}window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(b),"sharer","toolbar=0,status=0,width=626,height=436");var c=encodeURIComponent("list_id")+"="+encodeURIComponent(a);jQuery.ajax({type:"POST",url:d,data:c});return false},selectAllLists:function(a){$('input[name="listSel"][type="checkbox"]').attr("checked",a)},getSelectedLists:function(){var a="";$('input[name="listSel"][type="checkbox"]:checked').each(function(){currentVal=this.value;if(currentVal!=null&&currentVal!=""&&currentVal!="-1"){if(a==""||a==null||a=="-1"){a=currentVal}else{a+=", "+currentVal}}});return a},markEmailAsChecked:function(a,c){var b=encodeURIComponent("email_id")+"="+encodeURIComponent(a);jQuery.ajax({type:"POST",url:c,data:b});return false},toggleListAsPopular:function(a){var c=rbObject.getUrl({c:"analytics",f:"toggle_popular_list"});var b=encodeURIComponent("lid")+"="+encodeURIComponent(a);jQuery.ajax({type:"POST",url:c,data:b});return false},showHideDeleteAction:function(g,c,a){try{var b=$("#listsInfo_"+a+" h5").html();var f="Delete "+c+"?";$("#listsInfo_"+a+" h5").html(f);$("#listsInfo_"+a+' form input[type="submit"]').unbind("click");$("#listsInfo_"+a+' form input[type="submit"]').bind("click",function(){rbObject.processDeleteList(g,a,c)});if(b!=null&&b==f){$("#listsInfo_"+a).slideToggle()}else{$("#listsInfo_"+a).show()}}catch(d){txt=d.description}},processDeleteList:function(e,a,c){var b;$("#listsInfo_"+a+' form input[name="deleteList"][type="radio"]:checked').each(function(){b=this.value});if(b==null||b==""||b=="-1"||(b!="BOTH"&&b!="LIST")){return}var d=encodeURIComponent("list_id")+"="+encodeURIComponent(a)+"&"+encodeURIComponent("delt")+"="+encodeURIComponent(b)+"&"+encodeURIComponent("list_name")+"="+encodeURIComponent(c);jQuery.ajax({type:"POST",url:e,data:d,success:function(f){if(f!=null&&"T"==f){window.location.reload()}}})},vidGridActions:function(){$(".uservideo, .listsGridSingle").hover(function(){$(this).find(".actionsDiv").fadeIn("fast")},function(){$(this).find(".actionsDiv").fadeOut("fast")})},listEditActions:function(a){$(".shareAction").hide();$("ul.editAction:not(#editAction_"+a+" .editAction)").hide();$("#editAction_"+a+" .editAction").slideToggle();return false},listShareActions:function(a){$(".editAction").hide();$("ul.shareAction:not(#share_"+a+" .shareAction)").hide();$("#share_"+a+" .shareAction").slideToggle();return false},turnLightsOff:function(){$("#header").hide();$("#sidebar").hide();$("footer").hide();if($("#content").width()!=960&&$("#next").is(":visible")==false){$("#jcarousel").hide()}var a=$('<div id="lightsoff"/>');if(!document.getElementById("lightsoff")){$("body").append(a);switchStyle="position: absolute; left: 50%; top: 0; margin: 65px 0 0 250px; font-size: 82%;";$("#lightsoff").append('<span id="lightsOnOffState" style="'+switchStyle+'">Lights : <span style="border-bottom: 1px dotted #ccc; color: white; cursor: pointer" onclick="rbObject.turnLightsOff();"> <span class="lightsOnOffState">ON</span> </span> </span>')}$("#lightsoff").show();$("#content").width("100%");$(a).click(function(b){rbObject.turnLightsOn()});return false},turnLightsOn:function(){if($("#content").width()==960&&$("#next").is(":visible")==false){$("#content").width(730);$("#header").show();$("#sidebar").show();$("footer").show()}$("#jcarousel").show();if(document.getElementById("lightsoff")){$("#lightsoff").hide()}return false},getVideoPermURL:function(a){var c=PLAYING_VIDEO_PERMURL;if(c==null||c==undefined||$.trim(c)==""){return null}var b=c.lastIndexOf("/");return c.substring(0,b+1)+a},loadThumbTrain:function(b,a){web2py_ajax_page("get",b,null,a)},loadMoreThumbs:function(b,d,a){var c=encodeURIComponent("vc")+"="+encodeURIComponent(a);jQuery.ajax({type:"get",url:d,data:c,success:function(e){$("DIV#thumbtraintemp").html('<div id="templidiv" style="display: none;" ></div>');$("#templidiv").html(e);$("#templidiv li").each(function(f){a++;b.unlock();b.size(a);b.add(a,$(this))});$("DIV#thumbtraintemp").html("")}})},deleteAccount:function(b){var c=rbObject.getUrl({c:"account",f:"delete_account"});var a=$("textarea#feedback").val();if(a.length==0){a="-1"}var d=encodeURIComponent("userId")+"="+encodeURIComponent(b)+"&"+encodeURIComponent("feedback")+"="+encodeURIComponent(a);jQuery.ajax({type:"POST",url:c,data:d,success:function(e){if(e=="Account Deleted"){window.location="/"}}})},getUrl:function(e){var b="init";var h="default";var d="index";if(e.a!=null&&e.a!=undefined){b=e.a}if(e.c!=null&&e.c!=undefined){h=e.c}if(e.f!=null&&e.f!=undefined){d=e.f}var g="";if(window.location.host.indexOf("radbox.me")!=-1){g="/"+h+"/"+d}else{g="/"+b+"/"+h+"/"+d}return g},hideTweetBox:function(){$("."+TD).hide();$("#"+TB).empty();return false},toggleThumbs:function(){var c="#userlistsform";var a="#thumbs_div";var b=$(a).is(":visible")==true;$(a).toggle();$(c).hide();if(b){$("#"+PDID).removeClass("smallerplayer");$("#act_videos").attr("title","Show more videos")}else{$("#"+PDID).addClass("smallerplayer");$("#act_videos").attr("title","Hide videos")}},toggleAddToListForm:function(){var c="#userlistsform";var a="#thumbs_div";var b=$(c).is(":visible")==true;$(a).hide();$(c).toggle();if(b){$("#"+PDID).removeClass("smallerplayer")}else{$("#"+PDID).addClass("smallerplayer")}},};var rbPlayer={loadPlayer:function(c,d,g){var a={};a.fs=1;a.fullscreen=1;if(g==null||jQuery.trim(g)==""||g=="None"){if(c.search(/vimeo.com/i)!=-1){g="vimeo"}else{if(c.search(/youtube.com/i)!=-1){g="youtube"}else{if(c.search(/dailymotion.com/i)!=-1){g="dailymotion"}else{if(c.search(/blip.tv/i)!=-1){g="blip"}else{if(c.search(/wistia.com/i)!=-1){g="wistia"}else{if(c.search(/viddler.com/i)!=-1){g="viddler"}}}}}}}if(g=="vimeo"){a.api=1;a.autoplay=1}else{if(g=="youtube"){a.autoplay=1}else{if(g=="dailymotion"){a.autoPlay=1}else{if(g=="blip"||g=="blip.tv"||g=="bliptv"){a.autostart="true";a.enablejs="true"}else{if(g=="wistia"){a.autoPlay="true";a.endVideoCallback="playEnded"}else{if(g=="viddler"){a.enablecallbacks="t";a.autoplay="t"}else{a.api=1;a.autoplay=1;a.autoPlay=1;a.autostart="true";a.autoPlay="true";a.autoplay="t";a.endVideoCallback="playEnded";a.enablecallbacks="t";a.enablejs="true"}}}}}}var f={allowfullscreen:"true",allowscriptaccess:"always",wmode:"opaque"};var b={};b.align="middle";b.id="vidPlayer";var e=null;if(c!=null&&jQuery.trim(c)!=""){if(g=="youtube"){e="enablejsapi=1"}else{if(g=="dailymotion"){e="enableApi=1&autoPlay=1"}}}if(e!=null){if(c.indexOf("?")!=-1){c+="&"+e}else{c+="?"+e}}$("DIV#rbvideoplayer").html('<div id="videoPlaceHolder" style="width:640; height: 480;"></div>');height="580";width="100%";if(d=="True"){height="100%";width="100%"}swfobject.embedSWF(c,"videoPlaceHolder",width,height,"9.0.0",false,a,f,b)},onPlayerStateChange:function(b,a,q,z,l,w,c,p,r){try{var h="onPlayerStateChange";var n=(w=="True");var y=(r=="True");var d="";var x=PLAYING_VIDEOMAP_ID;var m=PLAYING_VIDEO_ID;var g=rbObject.getUrl({c:"player",f:"update_video_data"});if(b=="1"||b=="1u"){if(m=="-1"||m==""||m==null||m==undefined){return}var t=PLAYING_VIDEO_SEEK_TIME;if(n&&t!=null&&!isNaN(parseFloat(t))&&parseFloat(t)>0){PLAYING_VIDEO_SEEK_TIME="0";var o=CVG;seekVideo(t);CVG=parseFloat(o)}if(b=="1"){var f=rbPlayer.getVideoDuration();rbPlayer.updateTotalPlayingTime(m,f,g)}else{rbPlayer.updateTotalUnivPlayingTime(m,g)}if(y){rbPlayer.fireVideoEvent(1)}}else{if(b=="prev"){prevVidId=rbPlayer.getPrevVid();if(prevVidId!=null&&prevVidId!="-1"){if(n&&(p==null||$.trim(p)=="")){return}if(!n){p=rbObject.getVideoPermURL(prevVidId)}rbPlayer.playVideo(null,p,prevVidId,VCS_M,a,q,z,l,w);if(!n){rbPlayer.moveThumbsCarousel(-1)}}}else{if(b=="next"){rbPlayer.playNextVideo(VCS_M,a,q,z,l,w,c,y)}else{if(b=="0"){if(y){rbPlayer.fireVideoEvent(0)}d=encodeURIComponent("vmid")+"="+encodeURIComponent(x)+"&"+encodeURIComponent("ut")+"="+encodeURIComponent("ev");jQuery.ajax({type:"POST",url:g,data:d,async:false,success:function(e){if(e!=null&&"T"==e){PLAYING_VIDEO_PAUSE_TIME="0"}}});if((true)||(l=="True")){rbPlayer.playNextVideo(VCS_A,a,q,z,l,w,c,y)}}else{if(b=="3"){if(y){rbPlayer.fireVideoEvent(3)}}else{if(b=="2"||b=="2u"){if(x=="-1"||x==""||x==null||x==undefined){return}if(b=="2"){var s=rbPlayer.getCurrentPlayingTime();rbPlayer.updateCurrentPlayingTime(x,s,g)}else{if(b=="2u"){rbPlayer.updateCurrentUnivPlayingTime(x,g)}}if(y){rbPlayer.fireVideoEvent(2)}}}}}}}}catch(v){}},getCurrentPlayingTime:function(){var b=getFlashPlayer();if(ytUnivPlayer&&ytUnivPlayer.getCurrentTime){return ytUnivPlayer.getCurrentTime()}else{if(b&&b.getCurrentTime){return b.getCurrentTime()}else{if(b&&b.api_getCurrentTime){return b.api_getCurrentTime()}else{if(modVP&&modVP.getVideoPosition){return modVP.getVideoPosition()}else{var a=getHtml5Player();if(a&&a.currentTime){return a.currentTime}}}}}return"0"},updateCurrentPlayingTime:function(g,b,f){var d=0;var a=PLAYING_VIDEO_PAUSE_TIME;try{d=parseFloat(b)}catch(c){d=0}var h=PLAYING_VIDEO_DURATION;if(b!=null&&a!=b&&d!=0&&Math.abs(h-b)>1){query=encodeURIComponent("vmid")+"="+encodeURIComponent(g)+"&"+encodeURIComponent("pt")+"="+encodeURIComponent(b)+"&"+encodeURIComponent("ut")+"="+encodeURIComponent("pt");jQuery.ajax({type:"POST",url:f,data:query,success:function(e){if(e!=null&&"T"==e){PLAYING_VIDEO_PAUSE_TIME=b}}})}},updateCurrentUnivPlayingTime:function(c,b){if(c=="-1"||c==""||c==null||c==undefined){return}var a=getIframePlayer();$f(a.id).api("getCurrentTime",function(d,e){rbPlayer.updateCurrentPlayingTime(c,d,b)})},playVideo:function(l,b,m,n,h,c,q,r,g){try{if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}}catch(f){}var t=rbObject.getUrl({c:"watch",f:"get_video"});var d=rbObject.getUrl({c:"lists",f:"video"});var s=rbObject.getUrl({c:"player",f:"update_video_data"});var p=rbObject.getUrl({c:"share_util",f:"get_share_box"});var a=($(".playerwrapper").length>0);var o=(g=="True");try{ytUnivPlayer=null}catch(l){}if(a&&!o){query=encodeURIComponent("videoId")+"="+encodeURIComponent(m)+"&"+encodeURIComponent("lid")+"="+encodeURIComponent(h)+"&"+encodeURIComponent("loid")+"="+encodeURIComponent(c)+"&"+encodeURIComponent("t")+"="+encodeURIComponent(q);jQuery.ajax({type:"GET",url:t,data:query,dataTypeString:"json",success:function(A){if(A==null||A=="None"){window.location.href=b;return}jQuery("li#vid_thumb_"+PLAYING_VIDEO_ID).removeClass("current_vid_thumb");jQuery("li#vid_thumb_"+m).addClass("current_vid_thumb");PLAYING_VIDEO_ID=m;A=jQuery.parseJSON(A);var v=0;if(true){var E=A.title;var x=A.doc_title;if(E==null||E==""||E=="null"){E=x}$("#gotosrc").attr("href",A.doc_url);$("#gotosrcfromvidplayer").attr("href",A.doc_url);$("#gotosrc").html(E);$("#created_on").html(A.created_on);user_info=A.user_info;if(user_info=="Y"){if($("#int_favorite").length>0){favStatus=A.starred;if(favStatus!=null&&"T"==favStatus){var G="int_favorite_ac";var J="Remove from Favorites"}else{var G="int_favorite";var J="Add to Favorites"}$("#int_favorite").attr("class",G).attr("Title",J).css("display","inline-block")}if($("#int_archive").length>0){archStatus=A.archived;if(archStatus!=null&&"T"==archStatus){var G="int_archive_ac";var J="Remove from Archives"}else{var G="int_archive";var J="Add to Archives"}$("#int_archive").attr("class",G).attr("Title",J).css("display","inline-block")}delStatus=A.deleted;if(delStatus!=null&&"T"==delStatus){if($("#int_favorite").length>0){$("#int_favorite").css("display","none")}if($("#int_archive").length>0){$("#int_archive").css("display","none")}$("#int_trash").css("display","none");$("#int_addtoqueue").css("display","inline-block")}else{if($("#int_favorite").length>0){$("#int_favorite").css("display","inline-block")}if($("#int_archive").length>0){$("#int_archive").css("display","inline-block")}$("#int_trash").css("display","inline-block");$("#int_addtoqueue").css("display","none")}}else{if($("#int_favorite").length>0){$("#int_favorite").css("display","none")}if($("#int_archive").length>0){$("#int_archive").css("display","none")}$("#int_trash").css("display","none");$("#int_addtoqueue").css("display","inline-block")}}currVidCode=$("#rbvideoplayer").html();var B=(currVidCode!=null&&jQuery.trim(currVidCode)!="");if(B&&n==VCS_M){v=rbPlayer.getCurrentPlayingTime()}autoplay_support=A.autoplay_support;flashCode=A.flash_code;html5Code=A.html5_code;source=A.source;var y;y=flashCode;if(flashCode==null||jQuery.trim(flashCode)==""){y=html5Code}var D=A.provider;var I=false;if(y==null||jQuery.trim(y)==""){$("DIV#videoplayer_alt").css("display","inline-block");$("DIV#rbvideoplayer").css("display","none")}else{$("DIV#videoplayer_alt").css("display","none");$("DIV#rbvideoplayer").css("display","inline-block");IS_YOUTUBE_IFRAME_PLAYER="F";if(autoplay_support=="IFRAME"){if(source!=null&&$.trim(source)!=""){width="100%";height="100%";videoHtml='<iframe id="'+UNIVERSAL_PLAYER_ID+'" src="'+source+'" width="'+width+'" height="'+height+'" frameborder="0"></iframe>';$("DIV#rbvideoplayer").html(videoHtml)}if(D=="youtube"||(source.search(/youtube.com/i)!=-1)){IS_YOUTUBE_IFRAME_PLAYER="T";onYouTubePlayerAPIReady()}else{rbPlayer.initVimeoUnivPlayer()}}else{if(autoplay_support=="HTML5"){$("DIV#rbvideoplayer").html(y);rbPlayer.initHtml5Video(r,g)}else{if(autoplay_support!="FLASH"){$("DIV#rbvideoplayer").html(y);I=true}else{$("DIV#rbvideoplayer").html(y)}}}}rbPlayer.setLazyModeMessage(I);var z=PLAYING_VIDEOMAP_ID;var w=A.videomap_id;PLAYING_VIDEOMAP_ID=w;if(true){var F=encodeURIComponent("vm_id")+"="+encodeURIComponent(w);jQuery.ajax({type:"get",url:d,data:F,success:function(K){var e=($("#lists_div").length>0);if(!e){$("#userlistsform").html('<div id="lists_div"></div>')}jQuery("#lists_div").html(K)}});var H=encodeURIComponent("bm")+"="+encodeURIComponent(PLAYING_VIDEO_ID);jQuery.ajax({type:"get",url:p,data:H,success:function(K){var e=($("#sharebox").length>0);if(!e){$("#sharewrapper").html('<div id="sharebox"></div>')}jQuery("#sharebox").html(K)}})}if(B&&n==VCS_M){rbPlayer.updateCurrentPlayingTime(z,v,s);PLAYING_VIDEO_PAUSE_TIME=A.pause_time}PLAYING_VIDEO_PAUSE_TIME=A.pause_time;PLAYING_VIDEO_DURATION=A.total_duration;BLIP_LAST_COMPLETION_TIME=0;try{modVP=null}catch(C){}rbPlayer.enableDisableToolbar()}})}else{window.location.href=b}},getNextVid:function(){var a="-1";var b=jQuery("li#vid_thumb_"+PLAYING_VIDEO_ID).next();if(b!=null&&b.length>0){a=b.attr("id");if(a!=null&&jQuery.trim(a)!=""){a=a.replace("vid_thumb_","")}}return a},updateTotalPlayingTime:function(g,b,f){var a=0;var d=PLAYING_VIDEO_DURATION;try{a=parseFloat(b)}catch(c){a=0}var h=2;try{h=Math.abs(d-b)}catch(c){h=2}if(b!=null&&d!=b&&a!=0&&h>=1){query=encodeURIComponent("vid")+"="+encodeURIComponent(g)+"&"+encodeURIComponent("td")+"="+encodeURIComponent(b)+"&"+encodeURIComponent("ut")+"="+encodeURIComponent("td");jQuery.ajax({type:"POST",url:f,data:query,success:function(e){if(e!=null&&"T"==e){PLAYING_VIDEO_DURATION=b}}})}},updateTotalUnivPlayingTime:function(c,b){var a=getIframePlayer();$f(a.id).api("getDuration",function(d,e){rbPlayer.updateTotalPlayingTime(c,d,b)})},getVideoDuration:function(){var c="0";var b=getFlashPlayer();if(ytUnivPlayer&&ytUnivPlayer.getDuration){c=ytUnivPlayer.getDuration()}else{if(b&&b.getDuration){c=b.getDuration()}else{if(b&&b.api_getDuration){c=b.api_getDuration()}else{if(modVP&&modVP.getVideoDuration){c=modVP.getVideoDuration()}else{var a=getHtml5Player();if(a&&a.duration){c=a.duration}}}}}return c},initVimeoUnivPlayer:function(){$("#rbvideoplayer iframe").each(function(a,b){$f(b).addEvent("ready",vimeo_uniplayer_loaded)})},initHtml5Video:function(f,c){var d="initHtml5Video";try{var b=getHtml5Player();if(b){var a=(c=="True");if(a){b.autoplay=false}else{b.play()}if(f=="True"){b.width("90%");b.height("95%")}else{b.width("100%");b.height("100%")}if(a){b.controls=false}else{b.controls=true}if(b.addEventListener){b.addEventListener("loadedmetadata",updateVideoMetaData,false);b.addEventListener("play",videoPlayed,false);b.addEventListener("pause",videoPaused,false);b.addEventListener("ended",playEnded,false);if(a){b.addEventListener("error",handleMobileError,false)}else{b.addEventListener("error",handleWebError,false)}}}}catch(g){}},getPrevVid:function(){var a="-1";var b=jQuery("li#vid_thumb_"+PLAYING_VIDEO_ID).prev();if(b!=null&&b.length>0){a=b.attr("id");if(a!=null&&jQuery.trim(a)!=""){a=a.replace("vid_thumb_","")}}return a},setLazyModeMessage:function(a){if(a){$("#toolbar p").html("This video doesn't support auto-start and/or auto-play, please click &quot;Play&quot; to play and &quot;Next&quot; to load next video.")}else{$("#toolbar p").html("")}},toggleLazyMode:function(a){$("span.autoPlayState").toggle();$(".int_actions").toggle();$(".ext_actions").toggle();$("#header").toggle();$("#sidebar").toggle();$("#message").toggle();$("#next").toggle();$("#prev").toggle();$("footer").toggle();if($("#videoplayer").width()==640||a){$("#content").width("100%");rbPlayer.enableDisableToolbar()}else{$("#content").width(730)}return false},enableDisableToolbar:function(){var c=false;var b=false;if($("div#prev:visible").length>0){var a=rbPlayer.getPrevVid();if(a!=null&&a!="-1"){$("DIV#prev").removeClass("tbbuttonprevdis toolbardisabled");c=true}else{$("DIV#prev").addClass("tbbuttonprevdis toolbardisabled");c=false}}if($("div#next:visible").length>0){var d=rbPlayer.getNextVid();if(d!=null&&d!="-1"){$("DIV#next").removeClass("tbbuttonnextdis toolbardisabled").addClass("tbbuttonnextdef");b=true}else{$("DIV#next").removeClass("tbbuttonnextdef").addClass("tbbuttonnextdis toolbardisabled");b=false}}if(c||b){$("#act_videos").show()}else{$("#act_videos").hide()}},moveThumbsCarousel:function(a){if(a==null||a==undefined||isNaN(parseInt(a,10))){return}var b=jQuery("li#vid_thumb_"+PLAYING_VIDEO_ID).attr("jcarouselindex");if(b!=null&&b!=undefined){b=parseInt(b,10);if(isNaN(b)){return}b+=a;jQuery(".list_thumbs").jcarousel("scroll",b)}},toggleMobilePlayer:function(){$("#mobilevideoinfo").fadeToggle(300,"linear")},handleMobilePlayer:function(){var a=$("div#rbvideoplayer").html();if(a!=null&&$.trim(a)!=""&&$.trim(a)!="None"){setTimeout(rbPlayer.toggleMobilePlayer,3000)}else{setTimeout(nextVideo,3000)}},initMobilePlayer:function(){var a=getHtml5Player();if(a){rbPlayer.initHtml5Video("False","True")}rbPlayer.handleMobilePlayer()},fireVideoEvent:function(a){if(a==null||a==undefined||isNaN(parseInt(a,10))){return}a=parseInt(a,10);if((a>=0&&a<=3)||a==9){var b="rdbx://state="+a;location.href=b}},preservePlayerState:function(c,l,e,b,g,d,h,f){var a=getCurrentTime();if(h==null||h==undefined||isNaN(parseFloat(h))||h==0){h=a}var m=rbObject.getUrl({c:"player",f:"preserve"});query=encodeURIComponent("vids")+"="+encodeURIComponent(c)+"&"+encodeURIComponent("t")+"="+encodeURIComponent(l)+"&"+encodeURIComponent("du")+"="+encodeURIComponent(e)+"&"+encodeURIComponent("c")+"="+encodeURIComponent(b)+"&"+encodeURIComponent("u")+"="+encodeURIComponent(g)+"&"+encodeURIComponent("pvid")+"="+encodeURIComponent(d)+"&"+encodeURIComponent("pdu")+"="+encodeURIComponent(h)+"&"+encodeURIComponent("pt")+"="+encodeURIComponent(a)+"&"+encodeURIComponent("g")+"="+encodeURIComponent(f);jQuery.ajax({type:"POST",url:m,data:query,success:function(n){}})},onVideoError:function(a){var c=PLAYING_VIDEO_ID;if(c==null||c==undefined||isNaN(parseInt(c))||parseInt(c)==-1){return}var b=rbObject.getUrl({c:"player",f:"media_error"});query=encodeURIComponent("vid")+"="+encodeURIComponent(c)+"&"+encodeURIComponent("pt")+"="+encodeURIComponent(a);jQuery.ajax({type:"POST",url:b,data:query,async:false})},initVideoData:function(d,b,c,e,g,f,h,a){PLAYING_VIDEO_ID=d;PLAYING_VIDEOMAP_ID=b;PLAYING_VIDEO_PERMURL=c;PLAYING_VIDEO_DURATION=e;PLAYING_VIDEO_PAUSE_TIME=g;PLAYING_VIDEO_SEEK_TIME=f;IS_YOUTUBE_IFRAME_PLAYER=h;BLIP_LAST_COMPLETION_TIME=0;DVG=parseFloat(a)},playNextVideo:function(l,e,b,n,p,d,g,o){nextVidId=rbPlayer.getNextVid();var m=(d=="True");var c=0;var a=(nextVidId!=null&&nextVidId!="-1");var h=(g!=null&&$.trim(g)!="");if((a)||(!(a)&&m&&(DVG+CVG>60)&&h)){if(!m){g=rbObject.getVideoPermURL(nextVidId)}else{if(m&&CVG>0){if(g.indexOf("?")!=-1){g+="&"+encodeURIComponent("vg")+"="+encodeURIComponent(CVG)}else{g+="?"+encodeURIComponent("vg")+"="+encodeURIComponent(CVG)}}}if(m&&(l==VCS_A)){c=100}setTimeout(function(){rbPlayer.playVideo(null,g,nextVidId,l,e,b,n,p,d)},c);if(!m){rbPlayer.moveThumbsCarousel(1)}}else{pauseVideo();if(o){rbPlayer.fireVideoEvent(9)}var f=getFlashPlayer();if(f&&f.api_pause){f.api_pause()}}},};var Froogaloop=(function(){function c(p){return new c.fn.init(p)}var o={},e=false,n=Array.prototype.slice;c.fn=c.prototype={playerDomain:"",element:null,init:function(p){if(typeof p==="string"){p=document.getElementById(p)}this.element=p;return this},api:function(w,s){if(!this.element||!w){return false}var p=this,r=p.element,q=r.id!=""?r.id:null,t=!d(s)?s:null,v=d(s)?s:null;if(v){l(w,v,q)}m(w,t,r);return p},addEvent:function(q,t){if(!this.element){return false}var p=this,s=p.element,r=s.id!=""?s.id:null;l(q,t,r);if(q!="ready"){m("addEventListener",q,s)}if(e){return p}playerDomain=a(s.getAttribute("src"));if(window.addEventListener){window.addEventListener("message",b,false)}else{window.attachEvent("onmessage",b,false)}e=true;return p},removeEvent:function(q){if(!this.element){return false}var p=this,s=p.element,r=s.id!=""?s.id:null,t=f(q,r);if(q!="ready"&&t){m("removeEventListener",q,s)}}};function m(t,s,r){if(!r.contentWindow.postMessage){return false}var p=r.getAttribute("src").split("?")[0],q=JSON.stringify({method:t,value:s});r.contentWindow.postMessage(q,p)}function b(r){if(r.origin!=playerDomain){return false}var t=JSON.parse(r.data),s=t.value,x=t.event||t.method,q=t.data,p=p==""?null:t.player_id,w=g(x,p),v=[];if(!w){return false}if(s!==undefined){v.push(s)}if(q){v.push(q)}if(p){v.push(p)}return v.length>0?w.apply(null,v):w.call()}function l(p,r,q){if(q){if(!o[q]){o[q]={}}o[q][p]=r}else{o[p]=r}}function g(p,q){if(q){return o[q][p]}else{return o[p]}}function f(p,q){if(q&&o[q]){if(!o[q][p]){return false}o[q][p]=null}else{if(!o[p]){return false}o[p]=null}return true}function a(q){var t=q.split("/"),p="";for(var r=0,s=t.length;r<s;r++){if(r<3){p+=t[r]}else{break}if(r<2){p+="/"}}return p}function d(p){return !!(p&&p.constructor&&p.call&&p.apply)}function h(p){return toString.call(p)==="[object Array]"}c.fn.init.prototype=c.fn;return(window.Froogaloop=window.$f=c)})();var UNIVERSAL_PLAYER_ID="univPlayer";function onYouTubePlayerReady(b){var a=getFlashPlayer();if(a.addEventListener){a.addEventListener("onStateChange","onPlayerStateChange");a.addEventListener("onError","onYTPlayerError")}}function onYTPlayerError(a){if(a==101||a==150){handleWebError()}}function onDailymotionPlayerReady(b){var a=getFlashPlayer();if(a.addEventListener){a.addEventListener("onStateChange","onPlayerStateChange")}if(a&&a.playVideo){a.playVideo()}}function vimeo_player_loaded(){var a=getFlashPlayer();a.api_addEventListener("onFinish","vimeo_on_finish");a.api_addEventListener("onPause","vimeo_on_pause");onPlayerStateChange("1");if(a&&a.api_setLoop){a.api_setLoop(1)}}function vimeo_on_pause(a){if(typeof(a)=="string"&&a==UNIVERSAL_PLAYER_ID){onPlayerStateChange("2u")}else{onPlayerStateChange("2")}}function vimeo_on_finish(a){onPlayerStateChange("0");if(typeof(a)=="string"&&(a==null||$.trim(a)=="")){vidPlayer.api_pause()}}function vimeo_uniplayer_loaded(b){var a=getIframePlayer();$f(a).api("play");$f(a).addEvent("pause",vimeo_on_pause);$f(a).addEvent("finish",vimeo_on_finish);onPlayerStateChange("1u")}function updateVideoMetaData(){video=getHtml5Player();video.play()}function getHtml5Player(){var b=null;var a=$("#rbvideoplayer")[0].getElementsByTagName("video");if(a.length>0){b=a[0]}return b}function getIframePlayer(){var a=null;var b=$("#rbvideoplayer")[0].getElementsByTagName("iframe");if(b.length>0){a=b[0]}return a}function getFlashPlayer(){var c=null;var a=$("#rbvideoplayer")[0].getElementsByTagName("object");if(a.length>0){c=a[0]}else{var b=$("#rbvideoplayer")[0].getElementsByTagName("embed");if(b.length>0){c=b[0]}}return c}function videoPlayed(){onPlayerStateChange("1")}function videoPaused(){onPlayerStateChange("2")}function playEnded(){onPlayerStateChange("0")}function playPaused(){videoPaused()}function getUpdate(){var a=getFlashPlayer();if(a.addJScallback){a.addJScallback("complete","blipPlayEnded()")}}function blipPlayEnded(){var a=BLIP_LAST_COMPLETION_TIME;if(a==null||a==""||isNaN(parseFloat(a))){a=0}var b=$.now()/1000;if((b-parseFloat(a))>2){playEnded();BLIP_LAST_COMPLETION_TIME=b}}var modVP;function onTemplateLoaded(b){try{var d=brightcove.getExperience(b);modVP=d.getModule(APIModules.VIDEO_PLAYER);var a=d.getModule(APIModules.EXPERIENCE);a.addEventListener(BCExperienceEvent.CONTENT_LOAD,onContentLoad);modVP.addEventListener(BCMediaEvent.COMPLETE,playEnded);modVP.addEventListener(BCMediaEvent.STOP,videoPaused)}catch(c){}}function onContentLoad(a){modVP.play();onPlayerStateChange("1")}var ytUnivPlayer;function onYouTubePlayerAPIReady(){var a=(IS_YOUTUBE_IFRAME_PLAYER=="T");if(a){ytUnivPlayer=new YT.Player(UNIVERSAL_PLAYER_ID,{events:{onReady:onYTUnivPlayerReady,onStateChange:onYTUnivPlayerStateChange}})}else{ytUnivPlayer=null}}function onYTUnivPlayerReady(a){a.target.playVideo()}function onYTUnivPlayerStateChange(a){onPlayerStateChange(a.data)}function playVideo(){try{var a=getFlashPlayer();var b=getIframePlayer();var c=getHtml5Player();if(ytUnivPlayer&&ytUnivPlayer.playVideo){ytUnivPlayer.playVideo()}else{if(b){$f(b.id).api("play")}else{if(c&&c.play){c.play()}else{if(a){if(a.playVideo){a.playVideo()}else{if(a.api_play){a.api_play()}}}}}}}catch(d){}}function pauseVideo(){try{var a=getFlashPlayer();var b=getIframePlayer();var c=getHtml5Player();if(ytUnivPlayer&&ytUnivPlayer.pauseVideo){ytUnivPlayer.pauseVideo()}else{if(b){$f(b.id).api("pause")}else{if(c&&c.pause){c.pause()}else{if(a){if(a.pauseVideo){a.pauseVideo()}else{if(a.api_pause){a.api_pause()}}}}}}}catch(d){}}function seekVideo(b){if(b==null||b==undefined||isNaN(parseFloat(b,10))){return}CVG+=parseFloat(b)-parseFloat(getCurrentTime());try{var a=getFlashPlayer();var c=getHtml5Player();if(ytUnivPlayer&&ytUnivPlayer.seekTo){ytUnivPlayer.seekTo(b)}else{if(c&&c.currentTime){c.currentTime=b}else{if(a){if(a.seekTo){a.seekTo(b)}}}}}catch(d){}}function previousVideo(){onPlayerStateChange("prev")}function nextVideo(){onPlayerStateChange("next")}function getCurrentTime(){return rbPlayer.getCurrentPlayingTime()}function getTotalDuration(){return rbPlayer.getVideoDuration()}function getTitle(){return $("H1#videotitle").html()}function handleMobileError(){var a=getHtml5Player();if(a&&a.error!=null){rbPlayer.onVideoError("MOBILE");$("#videoErrorMessage").show();setTimeout(nextVideo,3000)}}function skipVideo(){try{CVG=parseFloat(getTotalDuration())-parseFloat(getCurrentTime());var a=PLAYING_VIDEOMAP_ID;if(!(a==null||a==undefined||isNaN(parseInt(a))||parseInt(a)==-1)){var c=rbObject.getUrl({c:"player",f:"skip"});query=encodeURIComponent("vmid")+"="+encodeURIComponent(a);jQuery.ajax({type:"POST",url:c,data:query,async:false})}nextVideo()}catch(b){}}function handleWebError(){rbPlayer.onVideoError("WEB")}function getVideoId(){return PLAYING_VIDEO_ID};
