/*	ColorBox v1.3.6 - a full featured, light-weight, customizable lightbox based on jQuery 1.3 */
//(function(c){function r(b,d){d=d==="x"?m.width():m.height();return typeof b==="string"?Math.round(b.match(/%/)?d/100*parseInt(b,10):parseInt(b,10)):b}function M(b){b=c.isFunction(b)?b.call(i):b;return a.photo||b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function Y(){for(var b in a)if(c.isFunction(a[b])&&b.substring(0,2)!=="on")a[b]=a[b].call(i);a.rel=a.rel||i.rel;a.href=a.href||i.href;a.title=a.title||i.title}function Z(b){i=b;a=c(i).data(q);Y();if(a.rel&&a.rel!=="nofollow"){g= c(".cboxElement").filter(function(){return(c(this).data(q).rel||this.rel)===a.rel});j=g.index(i);if(j<0){g=g.add(i);j=g.length-1}}else{g=c(i);j=0}if(!B){C=B=n;N=i;N.blur();c(document).bind("keydown.cbox_close",function(d){if(d.keyCode===27){d.preventDefault();e.close()}}).bind("keydown.cbox_arrows",function(d){if(g.length>1)if(d.keyCode===37){d.preventDefault();D.click()}else if(d.keyCode===39){d.preventDefault();E.click()}});a.overlayClose&&s.css({cursor:"pointer"}).one("click",e.close);c.event.trigger(aa); a.onOpen&&a.onOpen.call(i);s.css({opacity:a.opacity}).show();a.w=r(a.initialWidth,"x");a.h=r(a.initialHeight,"y");e.position(0);O&&m.bind("resize.cboxie6 scroll.cboxie6",function(){s.css({width:m.width(),height:m.height(),top:m.scrollTop(),left:m.scrollLeft()})}).trigger("scroll.cboxie6")}P.add(D).add(E).add(t).add(Q).hide();R.html(a.close).show();e.slideshow();e.load()}var q="colorbox",F="hover",n=true,e,x=!c.support.opacity,O=x&&!window.XMLHttpRequest,aa="cbox_open",H="cbox_load",S="cbox_complete", T="resize.cbox_resize",s,k,u,p,U,V,W,X,g,m,l,I,J,K,Q,P,t,E,D,R,y,z,v,w,i,N,j,a,B,C,$={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false,maxHeight:false,scalePhotos:n,scrolling:n,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:n,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:n,slideshow:false, slideshowAuto:n,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false};e=c.fn.colorbox=function(b,d){var h=this;if(!h.length)if(h.selector===""){h=c("<a/>");b.open=n}else return this;h.each(function(){var f=c.extend({},c(this).data(q)?c(this).data(q):$,b);c(this).data(q,f).addClass("cboxElement");if(d)c(this).data(q).onComplete=d});b&&b.open&&Z(h);return this};e.init=function(){function b(d){return c('<div id="cbox'+ d+'"/>')}m=c(window);k=c('<div id="colorbox"/>');s=b("Overlay").hide();u=b("Wrapper");p=b("Content").append(l=b("LoadedContent").css({width:0,height:0}),J=b("LoadingOverlay"),K=b("LoadingGraphic"),Q=b("Title"),P=b("Current"),t=b("Slideshow"),E=b("Next"),D=b("Previous"),R=b("Close"));u.append(c("<div/>").append(b("TopLeft"),U=b("TopCenter"),b("TopRight")),c("<div/>").append(V=b("MiddleLeft"),p,W=b("MiddleRight")),c("<div/>").append(b("BottomLeft"),X=b("BottomCenter"),b("BottomRight"))).children().children().css({"float":"left"}); I=c("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");c("body").prepend(s,k.append(u,I));if(x){k.addClass("cboxIE");O&&s.css("position","absolute")}p.children().bind("mouseover mouseout",function(){c(this).toggleClass(F)}).addClass(F);y=U.height()+X.height()+p.outerHeight(n)-p.height();z=V.width()+W.width()+p.outerWidth(n)-p.width();v=l.outerHeight(n);w=l.outerWidth(n);k.css({"padding-bottom":y,"padding-right":z}).hide();E.click(e.next);D.click(e.prev);R.click(e.close);p.children().removeClass(F); c(".cboxElement").live("click",function(d){if(d.button!==0&&typeof d.button!=="undefined")return n;else{Z(this);return false}})};e.position=function(b,d){function h(A){U[0].style.width=X[0].style.width=p[0].style.width=A.style.width;K[0].style.height=J[0].style.height=p[0].style.height=V[0].style.height=W[0].style.height=A.style.height}var f=m.height();f=Math.max(f-a.h-v-y,0)/2+m.scrollTop();var o=Math.max(document.documentElement.clientWidth-a.w-w-z,0)/2+m.scrollLeft();b=k.width()===a.w+w&&k.height()=== a.h+v?0:b;u[0].style.width=u[0].style.height="9999px";k.dequeue().animate({width:a.w+w,height:a.h+v,top:f,left:o},{duration:b,complete:function(){h(this);C=false;u[0].style.width=a.w+w+z+"px";u[0].style.height=a.h+v+y+"px";d&&d()},step:function(){h(this)}})};e.resize=function(b){function d(){a.w=a.w||l.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}function h(){a.h=a.h||l.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}function f(G){e.position(G,function(){if(B){if(x){A&&l.fadeIn(100);k[0].style.removeAttribute("filter")}if(a.iframe)l.append("<iframe id='cboxIframe'"+ (a.scrolling?" ":"scrolling='no'")+" name='iframe_"+(new Date).getTime()+"' frameborder=0 src='"+a.href+"' "+(x?"allowtransparency='true'":"")+" />");l.show();Q.show().html(a.title);if(g.length>1){P.html(a.current.replace(/\{current\}/,j+1).replace(/\{total\}/,g.length)).show();E.html(a.next).show();D.html(a.previous).show();a.slideshow&&t.show()}J.hide();K.hide();c.event.trigger(S);a.onComplete&&a.onComplete.call(i);a.transition==="fade"&&k.fadeTo(L,1,function(){x&&k[0].style.removeAttribute("filter")}); m.bind(T,function(){e.position(0)})}})}if(B){var o,A,L=a.transition==="none"?0:a.speed;m.unbind(T);if(b){l.remove();l=c('<div id="cboxLoadedContent"/>').html(b);l.hide().appendTo(I).css({width:d(),overflow:a.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(p);c("#cboxPhoto").css({cssFloat:"none"});O&&c("select:not(#colorbox select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("cbox_cleanup",function(){this.style.visibility="inherit"});a.transition=== "fade"&&k.fadeTo(L,0,function(){f(0)})||f(L);if(a.preloading&&g.length>1){b=j>0?g[j-1]:g[g.length-1];o=j<g.length-1?g[j+1]:g[0];o=c(o).data(q).href||o.href;b=c(b).data(q).href||b.href;M(o)&&c("<img />").attr("src",o);M(b)&&c("<img />").attr("src",b)}}else setTimeout(function(){var G=l.wrapInner("<div style='overflow:auto'></div>").children();a.h=G.height();l.css({height:a.h});G.replaceWith(G.children());e.position(L)},1)}};e.load=function(){var b,d,h,f=e.resize;C=n;i=g[j];a=c(i).data(q);Y();c.event.trigger(H); a.onLoad&&a.onLoad.call(i);a.h=a.height?r(a.height,"y")-v-y:a.innerHeight?r(a.innerHeight,"y"):false;a.w=a.width?r(a.width,"x")-w-z:a.innerWidth?r(a.innerWidth,"x"):false;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=r(a.maxWidth,"x")-w-z;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=r(a.maxHeight,"y")-v-y;a.mh=a.h&&a.h<a.mh?a.h:a.mh}b=a.href;J.show();K.show();if(a.inline){c('<div id="cboxInlineTemp" />').hide().insertBefore(c(b)[0]).bind(H+" cbox_cleanup",function(){c(this).replaceWith(l.children())}); f(c(b))}else if(a.iframe)f(" ");else if(a.html)f(a.html);else if(M(b)){d=new Image;d.onload=function(){var o;d.onload=null;d.id="cboxPhoto";c(d).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){h=function(){d.height-=d.height*o;d.width-=d.width*o};if(a.mw&&d.width>a.mw){o=(d.width-a.mw)/d.width;h()}if(a.mh&&d.height>a.mh){o=(d.height-a.mh)/d.height;h()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";f(d);g.length>1&&c(d).css({cursor:"pointer"}).click(e.next); if(x)d.style.msInterpolationMode="bicubic"};d.src=b}else c("<div />").appendTo(I).load(b,function(o,A){A==="success"?f(this):f(c("<p>Request unsuccessful.</p>"))})};e.next=function(){if(!C){j=j<g.length-1?j+1:0;e.load()}};e.prev=function(){if(!C){j=j>0?j-1:g.length-1;e.load()}};e.slideshow=function(){function b(){t.text(a.slideshowStop).bind(S,function(){h=setTimeout(e.next,a.slideshowSpeed)}).bind(H,function(){clearTimeout(h)}).one("click",function(){d();c(this).removeClass(F)});k.removeClass(f+ "off").addClass(f+"on")}var d,h,f="cboxSlideshow_";t.bind("cbox_closed",function(){t.unbind();clearTimeout(h);k.removeClass(f+"off "+f+"on")});d=function(){clearTimeout(h);t.text(a.slideshowStart).unbind(S+" "+H).one("click",function(){b();h=setTimeout(e.next,a.slideshowSpeed);c(this).removeClass(F)});k.removeClass(f+"on").addClass(f+"off")};if(a.slideshow&&g.length>1)a.slideshowAuto?b():d()};e.close=function(){c.event.trigger("cbox_cleanup");a.onCleanup&&a.onCleanup.call(i);B=false;c(document).unbind("keydown.cbox_close keydown.cbox_arrows"); m.unbind(T+" resize.cboxie6 scroll.cboxie6");s.css({cursor:"auto"}).fadeOut("fast");k.stop(n,false).fadeOut("fast",function(){c("#colorbox iframe").attr("src","about:blank");l.remove();k.css({opacity:1});try{N.focus()}catch(b){}c.event.trigger("cbox_closed");a.onClosed&&a.onClosed.call(i)})};e.element=function(){return c(i)};e.settings=$;c(e.init)})(jQuery);
(function(b,kb){var u="none",N="LoadedContent",c=false,w="resize.",o="y",q="auto",f=true,M="nofollow",t="on",l="x";function e(a,c){a=a?' id="'+j+a+'"':"";c=c?' style="'+c+'"':"";return b("<div"+a+c+"/>")}function p(a,b){b=b===l?m.width():m.height();return typeof a==="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function U(b){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function db(a){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!==t)a[c]=a[c].call(n);a.rel=a.rel||n.rel||M;a.href=a.href||b(n).attr("href");a.title=a.title||n.title;return a}function x(c,a){a&&a.call(n);b.event.trigger(c)}function lb(){var c,b=j+"Slideshow_",e="click."+j,f,k;if(a.slideshow&&h[1]){f=function(){F.text(a.slideshowStop).unbind(e).bind(V,function(){if(g<h.length-1||a.loop)c=setTimeout(d.next,a.slideshowSpeed)}).bind(W,function(){clearTimeout(c)}).one(e,k);i.removeClass(b+"off").addClass(b+t);c=setTimeout(d.next,a.slideshowSpeed)};k=function(){clearTimeout(c);F.text(a.slideshowStart).unbind(V+" "+W+" "+e).one(e,f);i.removeClass(b+t).addClass(b+"off")};F.bind(eb,function(){clearTimeout(c)});i.hasClass(b+t)||a.slideshowAuto&&!i.hasClass(b+"off")?f():k()}}function fb(c){if(!O){n=c;a=db(b.extend({},b.data(n,r)));h=b(n);g=0;if(a.rel!==M){h=b("."+H).filter(function(){return (b.data(this,r).rel||this.rel)===a.rel});g=h.index(n);if(g===-1){h=h.add(n);g=h.length-1}}if(!v){v=G=f;i.show();X=n;try{X.blur()}catch(e){}y.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":q}).show();a.w=p(a.initialWidth,l);a.h=p(a.initialHeight,o);d.position(0);Y&&m.bind(w+P+" scroll."+P,function(){y.css({width:m.width(),height:m.height(),top:m.scrollTop(),left:m.scrollLeft()})}).trigger("scroll."+P);x(gb,a.onOpen);Z.add(I).add(J).add(F).add(ab).hide();bb.html(a.close).show()}d.load(f)}}var hb={transition:"elastic",speed:300,width:c,initialWidth:"600",innerWidth:c,maxWidth:c,height:c,initialHeight:"450",innerHeight:c,maxHeight:c,scalePhotos:f,scrolling:f,inline:c,html:c,iframe:c,photo:c,href:c,title:c,rel:c,opacity:.9,preloading:f,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:c,loop:f,slideshow:c,slideshowAuto:f,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:c,onLoad:c,onComplete:c,onCleanup:c,onClosed:c,overlayClose:f,escKey:f,arrowKey:f},r="colorbox",j="cbox",gb=j+"_open",W=j+"_load",V=j+"_complete",ib=j+"_cleanup",eb=j+"_closed",Q=j+"_purge",jb=j+"_loaded",B=b.browser.msie&&!b.support.opacity,Y=B&&b.browser.version<7,P=j+"_IE6",y,i,C,s,cb,T,R,S,h,m,k,K,L,ab,Z,F,J,I,bb,D,E,z,A,n,X,g,a,v,G,O=c,d,H=j+"Element";d=b.fn[r]=b[r]=function(c,e){var a=this,d;if(!a[0]&&a.selector)return a;c=c||{};if(e)c.onComplete=e;if(!a[0]||a.selector===undefined){a=b("<a/>");c.open=f}a.each(function(){b.data(this,r,b.extend({},b.data(this,r)||hb,c));b(this).addClass(H)});d=c.open;if(b.isFunction(d))d=d.call(a);d&&fb(a[0]);return a};d.init=function(){var l="hover",n="clear:left";m=b(kb);i=e().attr({id:r,"class":B?j+"IE":""});y=e("Overlay",Y?"position:absolute":"").hide();C=e("Wrapper");s=e("Content").append(k=e(N,"width:0; height:0; overflow:hidden"),L=e("LoadingOverlay").add(e("LoadingGraphic")),ab=e("Title"),Z=e("Current"),J=e("Next"),I=e("Previous"),F=e("Slideshow").bind(gb,lb),bb=e("Close"));C.append(e().append(e("TopLeft"),cb=e("TopCenter"),e("TopRight")),e(c,n).append(T=e("MiddleLeft"),s,R=e("MiddleRight")),e(c,n).append(e("BottomLeft"),S=e("BottomCenter"),e("BottomRight"))).children().children().css({"float":"left"});K=e(c,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(y,i.append(C,K));s.children().hover(function(){b(this).addClass(l)},function(){b(this).removeClass(l)}).addClass(l);D=cb.height()+S.height()+s.outerHeight(f)-s.height();E=T.width()+R.width()+s.outerWidth(f)-s.width();z=k.outerHeight(f);A=k.outerWidth(f);i.css({"padding-bottom":D,"padding-right":E}).hide();J.click(d.next);I.click(d.prev);bb.click(d.close);s.children().removeClass(l);b("."+H).live("click",function(a){if(!(a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey)){a.preventDefault();fb(this)}});y.click(function(){a.overlayClose&&d.close()});b(document).bind("keydown",function(b){if(v&&a.escKey&&b.keyCode===27){b.preventDefault();d.close()}if(v&&a.arrowKey&&!G&&h[1])if(b.keyCode===37&&(g||a.loop)){b.preventDefault();I.click()}else if(b.keyCode===39&&(g<h.length-1||a.loop)){b.preventDefault();J.click()}})};d.remove=function(){i.add(y).remove();b("."+H).die("click").removeData(r).removeClass(H)};d.position=function(f,d){function b(a){cb[0].style.width=S[0].style.width=s[0].style.width=a.style.width;L[0].style.height=L[1].style.height=s[0].style.height=T[0].style.height=R[0].style.height=a.style.height}var e,h=Math.max(document.documentElement.clientHeight-a.h-z-D,0)/2+m.scrollTop(),g=Math.max(m.width()-a.w-A-E,0)/2+m.scrollLeft();e=i.width()===a.w+A&&i.height()===a.h+z?0:f;C[0].style.width=C[0].style.height="9999px";i.dequeue().animate({width:a.w+A,height:a.h+z,top:h,left:g},{duration:e,complete:function(){b(this);G=c;C[0].style.width=a.w+A+E+"px";C[0].style.height=a.h+z+D+"px";d&&d()},step:function(){b(this)}})};d.resize=function(b){if(v){b=b||{};if(b.width)a.w=p(b.width,l)-A-E;if(b.innerWidth)a.w=p(b.innerWidth,l);k.css({width:a.w});if(b.height)a.h=p(b.height,o)-z-D;if(b.innerHeight)a.h=p(b.innerHeight,o);if(!b.innerHeight&&!b.height){b=k.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}k.css({height:a.h});d.position(a.transition===u?0:a.speed)}};d.prep=function(o){var f="hidden";function n(t){var q,f,o,e,n=h.length,s=a.loop;d.position(t,function(){if(v){B&&p&&k.fadeIn(100);k.show();x(jb);ab.show().html(a.title);if(n>1){typeof a.current=="string"&&Z.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,n)).show();J[s||g<n-1?"show":"hide"]().html(a.next);I[s||g?"show":"hide"]().html(a.previous);q=g?h[g-1]:h[n-1];o=g<n-1?h[g+1]:h[0];a.slideshow&&F.show();if(a.preloading){e=b.data(o,r).href||o.href;f=b.data(q,r).href||q.href;e=b.isFunction(e)?e.call(o):e;f=b.isFunction(f)?f.call(q):f;if(U(e))b("<img/>")[0].src=e;if(U(f))b("<img/>")[0].src=f}}L.hide();if(a.transition==="fade")i.fadeTo(l,1,function(){if(B)i[0].style.filter=c});else if(B)i[0].style.filter=c;m.bind(w+j,function(){d.position(0)});x(V,a.onComplete)}})}if(v){var p,l=a.transition===u?0:a.speed;m.unbind(w+j);k.remove();k=e(N).html(o);k.hide().appendTo(K.show()).css({width:function(){a.w=a.w||k.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?q:f}).css({height:function(){a.h=a.h||k.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(s);K.hide();b("#"+j+"Photo").css({cssFloat:u,marginLeft:q,marginRight:q});Y&&b("select").not(i.find("select")).filter(function(){return this.style.visibility!==f}).css({visibility:f}).one(ib,function(){this.style.visibility="inherit"});a.transition==="fade"?i.fadeTo(l,0,function(){n(0)}):n(l)}};d.load=function(t){var m,c,s,q=d.prep;G=f;n=h[g];t||(a=db(b.extend({},b.data(n,r))));x(Q);x(W,a.onLoad);a.h=a.height?p(a.height,o)-z-D:a.innerHeight&&p(a.innerHeight,o);a.w=a.width?p(a.width,l)-A-E:a.innerWidth&&p(a.innerWidth,l);a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=p(a.maxWidth,l)-A-E;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=p(a.maxHeight,o)-z-D;a.mh=a.h&&a.h<a.mh?a.h:a.mh}m=a.href;L.show();if(a.inline){e().hide().insertBefore(b(m)[0]).one(Q,function(){b(this).replaceWith(k.children())});q(b(m))}else if(a.iframe){i.one(jb,function(){var c=b("<iframe name='"+(new Date).getTime()+"' frameborder=0"+(a.scrolling?"":" scrolling='no'")+(B?" allowtransparency='true'":"")+" style='width:100%; height:100%; border:0; display:block;'/>");c[0].src=a.href;c.appendTo(k).one(Q,function(){c[0].src="about:blank"})});q(" ")}else if(a.html)q(a.html);else if(U(m)){c=new Image;c.onload=function(){var e;c.onload=null;c.id=j+"Photo";b(c).css({border:u,display:"block",cssFloat:"left"});if(a.scalePhotos){s=function(){c.height-=c.height*e;c.width-=c.width*e};if(a.mw&&c.width>a.mw){e=(c.width-a.mw)/c.width;s()}if(a.mh&&c.height>a.mh){e=(c.height-a.mh)/c.height;s()}}if(a.h)c.style.marginTop=Math.max(a.h-c.height,0)/2+"px";h[1]&&(g<h.length-1||a.loop)&&b(c).css({cursor:"pointer"}).click(d.next);if(B)c.style.msInterpolationMode="bicubic";setTimeout(function(){q(c)},1)};setTimeout(function(){c.src=m},1)}else m&&K.load(m,function(d,c,a){q(c==="error"?"Request unsuccessful: "+a.statusText:b(this).children())})};d.next=function(){if(!G){g=g<h.length-1?g+1:0;d.load()}};d.prev=function(){if(!G){g=g?g-1:h.length-1;d.load()}};d.close=function(){if(v&&!O){O=f;v=c;x(ib,a.onCleanup);m.unbind("."+j+" ."+P);y.fadeTo("fast",0);i.stop().fadeTo("fast",0,function(){x(Q);k.remove();i.add(y).css({opacity:1,cursor:q}).hide();try{X.focus()}catch(b){}setTimeout(function(){O=c;x(eb,a.onClosed)},1)})}};d.element=function(){return b(n)};d.settings=hb;b(d.init)})(jQuery,this)

/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();


jQuery(function($){
  var base_url = '';
  var base_popup_url = 'http://fouryearsgo.appspot.com';
  
	var rendered_tools = false;
  var uservoiceOptions = {key:'fouryearsgo', host:'fouryearsgo.uservoice.com', forum:'41333', lang:'en', showTab:false};
  
  var mapinit = false;
	
	function init_tools() {
		if (!google || !google.translate || rendered_tools)
		  return;
		new google.translate.TranslateElement({
			pageLanguage: 'en'
		}, 'tools_google_translate_element');
		$('#tools_google_translate_element select').change(function(){$('#tools').hide();});
		rendered_tools = true;
  }
  function init_uservoice() {
    var s = document.createElement('script');
    s.src = ("https:" == document.location.protocol ? "https://" : "http://") + "cdn.uservoice.com/javascripts/widgets/tab.js";
    document.getElementsByTagName('head')[0].appendChild(s);
  }
  function init_map(mapDivID) {
    var width = "100%";
		var height = "100%";
		var flashvars = {configURL:base_url+"/wp-content/themes/4YG/config/config.xml?201002101620"};
		var params = {base:base_url+"/wp-content/themes/4YG/", wmode:"transparent", allowFullScreen:"true", allowScriptAccess:"always"};
		var attributes = {};
		swfobject.embedSWF(base_url+"/wp-content/themes/4YG/BootStrap.swf?" + Math.random(), mapDivID || 'map', width, height, "9.0.0.0", "", flashvars, params, attributes);
    mapinit = true;
  }
  function intro_show_map() {
    $('#intro_wrapper').fadeOut();
    init_map();
    return false;
  }
  function init_videos() {
    var divs = $('div.video_widget');
    var getFlash = $('#get_flash_template')[0].innerHTML;
    for (var i=0; i<divs.length; i++) {
      var id = 'video_' + Math.floor(Math.random()*1000000);
      divs[i].innerHTML = '<div class="video"><div id="'+id+'">'+getFlash+'</div></div>';
      $(divs[i]).append($('#video_template')[0].innerHTML);
      display_video(id);
    }
  }
  function init_social() {
    var divs = $('div.social_widget');
    for (var i=0; i<divs.length; i++) {
      var id = 'social_' + Math.floor(Math.random()*1000000);
      divs[i].innerHTML = $('#social_template')[0].innerHTML;
    }
  }
  function init_code_box(selector) {
    $(selector).click(function(){this.select();});
    $(selector).focus(function(){this.select();});
  }
  function display_video(videoDivID, autoplay, width, height) {
    width = width ? width : '100%';
    height = height ? height : '100%';
    autoplay = (autoplay != null) ? autoplay : false;
		var flashvars = {configURL: 'config/config_player.xml', 'autoplay':autoplay};
		var params = {base:base_url+"/wp-content/themes/4YG/", wmode:"transparent", allowFullScreen:"true", allowScriptAccess:"always"};
		var attributes = {};
		swfobject.embedSWF(base_url+"/wp-content/themes/4YG/BootStrap.swf?"+Math.random(), videoDivID, width, height, "9.0.0.0", "", flashvars, params, attributes);
  }
  function display_intro_video() {
    $('#intro_video').fadeIn(function(){
      var flash = $('#intro_video_flash')[0];
      flash.innerHTML = $('#get_flash_template')[0].innerHTML;
      displayVideo(flash.id, true, 930, 400);
    });
    /*$('#intro_video_placeholder').animate({ width: "900px", height: "400px", top: "-60px", left: "-30px" }, 
      function() {
        $('#intro_video').show()
        var flash = $('#intro_video_flash')[0];
        flash.innerHTML = $('#get_flash_template')[0].innerHTML;
        displayVideo(flash.id, true, 930, 400);
      }
    );*/
  }
  function popup_take_action() {
    $.fn.colorbox({
      href: base_url+'/wp-content/themes/4YG/take-action.html',
      innerWidth: 500,
      innerHeight: 500,
      opacity: 0.7
    });
    return false;
  }
  function popup_post() {
    $.fn.colorbox({
      href: base_popup_url+'/p/new?context=popup',
      iframe: true,
      innerWidth: 500,
      innerHeight: 500,
      opacity: 0.7
    });
    return false;
  }
  function popup_login() {
    $.fn.colorbox({
      href: base_popup_url+'/a/login?next=%2Fp%2Fnew%3Fcontext%3Dpopup&context=popup',
      iframe: true,
      innerWidth: 500,
      innerHeight: 500,
      opacity: 0.7
    });
    return false;
  }
  function popup_org_signup() {
    $.fn.colorbox({
      href: base_popup_url+'/org/signup?context=popup',
      iframe: true,
      innerWidth: 600,
      innerHeight: 600,
      opacity: 0.7
    });
    return false;
  }  
  function popup_map_about() {
    $.fn.colorbox({
      href: '/wp-content/themes/4YG/map-about.html',
      innerWidth: 500,
      innerHeight: 500,
      opacity: 0.7
    });
    return false;
  }
	function toggle_toolbar(){
		if (!rendered_tools)
			init_tools();
		var tools = $('#tools');
		var toolbar = $('#toolbar');
		var vis = tools.is(':visible');
		if (!vis) {
			tools.show();
			tools.css('top', toolbar.height()-tools.height());
		}
		tools.animate({
			top: (vis ? -tools.height() : toolbar.height())
		}, 250, function(){
			if (vis)
				tools.hide();
		});
		return false;
  }
  function get_location(callback) {
    SOCIALHIVE.geo.location.getLocation(
  	  function(position){
  	    callback(position.latitude, position.longitude);
  	  }
  	);
  }
  function get_map_location() {
    get_location(function(lat, lon){
      try {
        $('#map')[0].locationCallback(lat, lon);
      } catch(e) {}
    });
  }
  
  /*
	$('#intro_video_thumb').click(function(){
		$(this).animate({
			width: "600px",
			height: "400px",
			top: "-20px",
			left: "135px"
		}, 1000, function(){
		  console.log($('#intro_video'));
			$('#intro_video_thumb').hide();
			$('#intro_video').show();
			$('#overlay').show();
		});
	});
	*/
	
	if (!window.displayVideo)
	  window.displayVideo = display_video;
	if (!window.getLocation)
	  window.getLocation = get_map_location;
  if (!window.startJourney)
	  window.startJourney = popup_post;
  if (!window.mapAbout)
	  window.mapAbout = popup_map_about;
  if (!window.initMap)
	  window.initMap = init_map;
	if (!window.init_tools)
	  window.toolbarInitTools = init_tools;

  init_videos();
  init_social();
  $('#intro_video_placeholder').click(display_intro_video);
  $('a.login').click(popup_login);
  $('a.go_map').click(popup_post);
  $('a.go_map_homepage').click(function(){mapinit ? popup_post() : function(){intro_show_map(); setTimeout(popup_post, 1000);}(); return false;});
  $('#take-action').click(popup_take_action);
	$('#toolbar div.nav a.tools,#tools div.close').click(toggle_toolbar);
  $('a.org_signup').click(popup_org_signup);
	$('div.accordion').accordion({active:false, collapsible:true, autoHeight:false});
	$('#logos_banners').load('/wp-content/themes/4YG/logos_banners.html', function(){init_code_box('#spread_logos_banners input');});

	init_uservoice();
	$('a.uservoice').click(function(){window.UserVoice.Popin.show(uservoiceOptions);return false;});
});

