/** (c)2011 Unwind Creative Technology - http://www.unwind.nl/ **/
function video_setup(){$(".video_player").each(function(){video_player_create($(this))})}var videoplayers=[];var video_loading_delta=50;var video_source_frameSize,video_source_loading_position,video_source_controls_position;var video_last_activePlayer=null;function formatTime(b){if(isNaN(b)){b=0}var c=Math.round(b);var a=Math.floor(c/60);c-=a*60;if(c<10){c="0"+c}return a+"."+c}function video_getPlayerInfoByID(a){for(var c in videoplayers){var b=videoplayers[c];if(b.ID==a){return b}}return null}function video_getPlayerWhichIsPlaying(){for(var b in videoplayers){var a=videoplayers[b];if(!a.instance.paused&&!a.instance.ended){return a}}return null}function video_getPlayerWhichIsFullscreen(){for(var b in videoplayers){var a=videoplayers[b];if($(a.instance).hasClass("fullscreen")){return a}}return null}function video_disable_controls(a){var b=video_getPlayerInfoByID(a);if(b){b.controlsElement.find(".video_disable_layer").stop().fadeTo("fast",0.85)}}function video_enable_controls(a){var b=video_getPlayerInfoByID(a);if(b){b.controlsElement.find(".video_disable_layer").stop().fadeOut("fast")}}function video_loading_show(a){var b=video_getPlayerInfoByID(a);if(!b){return}if(b.loading_animation_timer==-1){b.loading_animation_timer=setInterval("video_loading_tick("+a+");",video_loading_delta)}if(b.loading_state!="fadein"){b.loading_state="fadein"}}function video_loading_hide(a){var b=video_getPlayerInfoByID(a);if(!b){return}if(b.loading_state!="fadeout"){b.loading_state="fadeout"}}function video_loading_tick(a){var c=video_getPlayerInfoByID(a);if(!c){return}for(var b=0;b<4;b++){var d=Math.abs(Math.sin(c.loading_cnt-b*Math.PI/8));c.element.find(".loadinggraphic .v_lg_"+b).css({opacity:d,})}c.loading_cnt+=video_loading_delta/250;if(isNaN(c.loading_alpha)){c.loading_alpha=1}if(c.loading_state=="fadeout"){c.loading_alpha-=video_loading_delta/250;if(c.loading_alpha<=0){c.loading_alpha=0;c.loading_state="out"}}else{if(c.loading_state=="fadein"){c.loading_alpha+=c.loading_delta/250;if(c.loading_alpha>=1){c.loading_alpha=1;c.loading_state="in"}}}if(c.loading_state=="none"){if(c.loading_animation_timer!=-1){clearInterval(c.loading_animation_timer);c.loading_animation_timer=-1}}c.element.find(".loadinggraphic").css({opacity:c.loading_alpha*0.75}).show()}function video_isvideoplaying(){var a=video_getPlayerWhichIsPlaying();if(a&&a.instance){return !a.instance.paused}return false}function video_toggle_playpause(b){var c=video_getPlayerInfoByID(b);if(!c){return}if(c.instance.paused||c.instance.ended){if(c.instance.readyState<3){video_loading_show(b)}bg_pause();var a=video_getPlayerWhichIsPlaying();if(a){a.instance.pause()}video_last_activePlayer=c;if(c.instance.ended){c.instance.currentTime=0;c.instance.play()}else{c.instance.play()}}else{bg_play();c.instance.pause()}}function video_toggle_fullscreen(b,a){var d=video_getPlayerInfoByID(b);if(!d){return}video_last_activePlayer=d;if(a){d.controlsElement.find(".video_player_controls").stop(true).css("opacity",1).show()}if(typeof(d.instance.webkitEnterFullscreen)!="undefined"&&typeof(d.instance.webkitSupportsFullscreen)!="undefined"&&d.instance.webkitSupportsFullscreen){if(!d.instance.currentTime){return}if(!a){d.instance.webkitEnterFullscreen()}}else{var c=$("html").hasClass("fullscreen");if(a){if(!$("html").hasClass("fullscreen")){return}c=true}if(c){$("html").removeClass("fullscreen");$(d.instance).removeClass("fullscreen");d.controlsElement.removeClass("fullscreen");video_resize(b);d.controlsElement.css({"z-index":1});video_controls_autohide()}else{var e=video_getPlayerWhichIsPlaying();if(e&&e.ID!=d.ID){e.instance.pause()}video_source_frameSize=[d.element.width(),d.element.height()];video_source_loading_position=[parseInt(d.element.find(".loadinggraphic").css("left")),parseInt(d.element.find(".loadinggraphic").css("top"))];video_source_controls_position=[0,0];d.controlsElement.css({position:"fixed",top:"auto",left:100,bottom:-13,"z-index":1200});bg_pause();$("html").addClass("fullscreen");$(d.instance).addClass("fullscreen");video_resize(b)}}}function video_resize(e,j){var k=video_getPlayerInfoByID(e);if(!k){return}if($(k.instance).hasClass("fullscreen")){var b=$(window).width();var l=$(window).height();var h=$(window).width();var f=h/(16/9);if(f>l){var i=f-l;h-=i/(9/16);f-=i}var c=Math.round((b/2)-(h/2));var g=Math.round((l/2)-(f/2));h=Math.round(h);f=Math.round(f);$(k.instance).css({left:c,top:g,width:h,height:f});var m=33;var d=10;c=Math.round((b/2)-(m/2));g=Math.round((l/2)-(d/2));k.element.find(".loadinggraphic").css({position:"fixed",left:c,top:g});var a=k.controlsElement.width();c=Math.round((b/2)-(a/2));k.controlsElement.css({left:c})}else{if(video_source_frameSize){$(k.instance).css({width:video_source_frameSize[0],height:video_source_frameSize[1]});k.element.find(".loadinggraphic").css({position:"absolute",left:video_source_loading_position[0],top:video_source_loading_position[1]});k.controlsElement.css({position:"relative",bottom:"auto",left:video_source_controls_position[0],top:video_source_controls_position[1]})}}}function video_player_create(c){var a=parseInt(c.attr("id").replace(/^video_player_/,""));var d=$("#video_player_controls_"+a);var e={ID:a,element:c,controlsElement:d,instance:document.getElementById("video_player_instance_"+a),last_toggle_volume:0,loading_animation_timer:-1,loading_cnt:0,loading_state:"none",loading_alpha:0,showPosterWhenDone:false};for(var b=0;b<4;b++){e.element.find(".loadinggraphic .v_lg_"+b).css({"background-color":"white",position:"absolute",left:b*10,width:8,height:10,})}if(c.hasClass("video_player_small")){video_issmall=true;timelineWidth=226;e.showPosterWhenDone=true;e.draggable_volume=draggable_add(e.controlsElement.find(".handle_vol"),410,60,function(h,f,g){video_last_activePlayer=e;e.controlsElement.find(".video_bar_volume").css("width",f+9-750);if(e.instance){e.instance.volume=g}})}else{timelineWidth=566;e.draggable_volume=draggable_add(e.controlsElement.find(".handle_vol"),750,89,function(h,f,g){video_last_activePlayer=e;e.controlsElement.find(".video_bar_volume").css("width",f+9-750);if(e.instance){e.instance.volume=g}})}e.draggable_position=draggable_add(e.controlsElement.find(".handle_pos"),52,timelineWidth,function(h,f,g){video_last_activePlayer=e;if(e.instance){e.instance.currentTime=Math.round(g*e.instance.duration)}});d.find(".video_bar_timelinebackground").click(function(i){video_last_activePlayer=e;var h=6;var g=4;var f=i.pageX-e.controlsElement.find(".video_player_controls_container").offset().left;f-=50+h;if(f>=0&&f<=$(this).width()){if(f<=10){f=0}f/=$(this).width()-g;if(e.instance&&e.instance.duration>0){if(f>1){f=1}e.instance.currentTime=Math.round(f*e.instance.duration)}}});d.find(".video_player_controls_container").show();if(e.instance){videoplayers.push(e);if(!video_last_activePlayer){video_last_activePlayer=videoplayers[0]}video_enable_controls(e.ID);e.instance.volume=0.75;e.controlsElement.find(".button_playtoggle").click(function(){video_toggle_playpause(a)});e.controlsElement.find(".video_player_position_label").html(formatTime(0)+" / "+formatTime(0));e.controlsElement.find(".button_fullscreen").click(function(){video_toggle_fullscreen(a)});e.controlsElement.find(".button_voltoggle").click(function(){video_last_activePlayer=e;if(e.instance.volume==0){if(e.last_toggle_volume==0){e.last_toggle_volume=0.75}e.instance.volume=e.last_toggle_volume}else{e.last_toggle_volume=e.instance.volume;e.instance.volume=0}});$(e.instance).bind("volumechange",function(f){draggable_setPositionPercentage(e.draggable_volume,e.instance.volume);e.controlsElement.find(".video_bar_volume").css("width",5+Math.round(e.instance.volume*draggables[e.draggable_volume].width))});$(e.instance).bind("playing",function(f){video_loading_hide(e.ID);playlist_firstVideo=false;$(e.instance).fadeIn("slow");bg_pause();e.controlsElement.find(".button_playtoggle").addClass("playing")});$(e.instance).bind("pause",function(f){bg_play();e.controlsElement.find(".button_playtoggle").removeClass("playing")});$(e.instance).bind("timeupdate",function(g){playlist_firstVideo=false;var f=e.instance.currentTime/e.instance.duration;draggable_setPositionPercentage(e.draggable_position,f);e.controlsElement.find(".video_bar_playposition").css("width",5+Math.round(f*draggables[e.draggable_position].width));e.controlsElement.find(".video_player_position_label").html(formatTime(e.instance.currentTime)+" / "+formatTime(e.instance.duration))});$(e.instance).bind("ended",function(g){if(playlist.length==0){video_toggle_fullscreen(a,true)}bg_play();e.controlsElement.find(".button_playtoggle").removeClass("playing");if(e.showPosterWhenDone){var f=0;draggable_setPositionPercentage(e.draggable_position,f);e.controlsElement.find(".video_bar_playposition").css("width",5+Math.round(f*draggables[e.draggable_position].width));e.controlsElement.find(".video_player_position_label").html(formatTime(e.instance.currentTime)+" / "+formatTime(e.instance.duration));e.instance.poster=e.instance.poster}else{playlist_next()}});$(e.instance).bind("waiting",function(){playlist_firstVideo=false;video_loading_show(a)});$(e.instance).bind("canplaythrough",function(){video_loading_hide(a)});$(e.instance).bind("progress",function(g){playlist_firstVideo=false;var f=e.instance&&e.instance.buffered?e.instance.buffered.end()/e.instance.duration:0;e.controlsElement.find(".video_bar_bufferposition").css("width",5+Math.round(f*draggables[e.draggable_position].width+5))})}}var video_gotspacebarfocus=true;var video_controls_hide_timer=null;function video_controls_autohide(){for(var b in videoplayers){var a=videoplayers[b];video_controls_autohide_player(a.ID)}}function video_controls_autohide_player(a){var b=video_getPlayerInfoByID(a);if(!b){return}if($("html").hasClass("fullscreen")){b.controlsElement.stop(true).fadeTo("slow",0)}else{b.controlsElement.stop(true).fadeTo("fast",1)}}$(document).ready(function(){$(window).resize(function(){for(var a in videoplayers){video_resize(videoplayers[a].ID)}});$(window).mousemove(function(){if(video_controls_hide_timer){clearTimeout(video_controls_hide_timer)}video_controls_hide_timer=setTimeout("video_controls_autohide();",2000);for(var b in videoplayers){var a=videoplayers[b];a.controlsElement.stop(true);if(a.controlsElement.css("display")=="none"){a.controlsElement.css("opacity","0").show()}a.controlsElement.fadeTo("fast",1)}});doInputHandlers();$(window).keydown(function(b){if(b.which==27){var a=video_getPlayerWhichIsFullscreen();if(a){video_toggle_fullscreen(a.ID,true)}return false}else{if(b.keyCode==32&&video_gotspacebarfocus){var a=video_getPlayerWhichIsPlaying();if(a){video_toggle_playpause(a.ID)}else{if(video_last_activePlayer){video_toggle_playpause(video_last_activePlayer.ID)}}return false}}return true})});function doInputHandlers(){$("input, textarea, select").focus(function(){video_gotspacebarfocus=false});$("input, textarea, select").blur(function(){video_gotspacebarfocus=true})};/** (c)2011 Unwind Creative Technology - http://www.unwind.nl/ **/
$(document).ready(function(){tabs_parse();$("#planetx_fx_logo, #planetx_fx_logo_animated").click(function(){document.location="/"}).css("cursor","pointer");$("li.topnavitem").each(function(){var e=$(this);var g=$(this).attr("id");g=g.replace(/^main_/,"sub_");var f=$(this).offset().left;f-=$("li.topnavitem:first-child").offset().left;$(this).find("a").click(function(){$("#"+g).css("left",f);subnav_offset=0;subnav_show($("#"+g),e);return false})});$("li.topnavitem, .topnav_sub").mouseout(function(){subnav_hide_delayed()});$("li.topnavitem, .topnav_sub").mouseover(function(){subnav_hide_cancel()});$("body").mouseup(function(){subnav_hide_delayed("fast")});subnav_timer_start();var c=false;var b=false;$("#popup_clientlogin").hover(function(){c=true},function(){c=false});$("body").mouseup(function(){if(!c){$("li.client_login").removeClass("active");$("#popup_clientlogin").fadeOut("fast")}});$("#popup_spaceadminlogin").hover(function(){b=true},function(){b=false});$("body").mouseup(function(){if(!b){$("li.space_admin").removeClass("active");$("#popup_spaceadminlogin").fadeOut("fast")}});var d=$("html").attr("xml:lang");$("#popup_clientlogin").html('<form action="/'+d+'/clients/" method="post"><div class="popup_header"><div>Client login</div></div><div class="popup_content"><div class="label label_clientname"><label for="popup_clientlogin_input_login">Clientname</label></div><input name="u" autocomplete="off"  type="text" class="footer_login__input_login" value="" /><div class="label label_password"><label for="popup_clientlogin_input_password">Password</label></div><input name="p" autocomplete="off"  type="password" class="footer_login_input_password" value="" /><input type="submit" class="footer_login_submit" name="a" value="Login" /></div></form>');$("#popup_spaceadminlogin").html('<form action="http://spaceadmin.planetx.nl/user/login/" method="post"><div class="popup_header"><div>Space Admin login</div></div><div class="popup_content"><div class="label label_clientname"><label for="popup_clientlogin_input_login">Clientname</label></div><input autocomplete="off" type="text" name="username" class="footer_login__input_login" value="" /><div class="label label_password"><label for="popup_clientlogin_input_password">Password</label></div><input type="password" class="footer_login_input_password" name="password" value="" /><input type="submit" autocomplete="off" class="footer_login_submit" name="login" value="Login" /></div></form>');$("li.client_login").click(function(){if(!$(this).hasClass("active")){$(this).addClass("active");$("#popup_clientlogin").css("top",$(this).offset().top-250);$("#popup_clientlogin").fadeIn("fast");$("li.space_admin").removeClass("active");$("#popup_spaceadminlogin").fadeOut("fast")}else{$(this).removeClass("active");$("#popup_clientlogin").fadeOut("fast")}});$("li.space_admin").click(function(){if(!$(this).hasClass("active")){$(this).addClass("active");$("#popup_spaceadminlogin").css("top",$(this).offset().top-250);$("#popup_spaceadminlogin").fadeIn("fast");$("li.client_login").removeClass("active");$("#popup_clientlogin").fadeOut("fast")}else{$(this).removeClass("active");$("#popup_spaceadminlogin").fadeOut("fast")}});if(typeof pb!="undefined"){for(var a=0;a<pb.length;a++){bg_add(pb[a])}}$("#side_scroller_button_left, #side_scroller_button_right, #side_scroller_play_button, #social li, input").mousedown(function(){$(this).addClass("mousedown")});$("#side_scroller_button_left, #side_scroller_button_right, #side_scroller_play_button, #social li, input").mouseup(function(){$(this).removeClass("mousedown")});$("#side_scroller_help").hide().html("Click to play &#187;").delay(2000).fadeIn("slow").delay(2500).fadeOut("slow");$("#side_scroller_play_button").click(function(){side_scroller_load_project()});$("#side_scroller_readmore").click(function(){side_scroller_readmore()});$("#social li").show().click(function(){window.open($(this).find("a").attr("href"))});$("#side_scroller_thumbsource img").each(function(){sidescroller_image_add($(this))});$(window).bind("resize",function(){bg_realign()});sidescroller_load();video_setup();twitter_setup();doInputHandlers()});var bg_list=[];var bg_list_position=0;var _STATE_NONE=0;var _STATE_LOADING=1;var _STATE_DONELOADING=2;var _STATE_SHOWING=3;var bg_state=[_STATE_NONE,_STATE_NONE];var bg_showing_i=-1;var bg_showing_timer=-1;var bg_delay=10;var bg_fadeTimer=0;var bg_active=true;var bg_firstDoneLoadingCallback=null;function bg_pause(){bg_active=false}function bg_play(){bg_active=true}function bg_reset(){bg_list_position=0;bg_showing_i=-1;bg_showing_timer=-1;bg_fadeTimer=0;bg_list=Array();bg_state=[_STATE_NONE,_STATE_NONE]}function bg_add(a){bg_list.push(a)}function bg_supported(){if(navigator.userAgent.match(/iPhone|iPad|iPod/i)!=null){return false}return true}$(window).ready(function(){var b=$('<div id="bg_0"><img /></div>').css("visibility","hidden");var a=$('<div id="bg_1"><img /></div>').css("visibility","hidden");b.find("img").load(function(){bg_isloaded(0)});a.find("img").load(function(){bg_isloaded(1)});b.appendTo("body");a.appendTo("body");setInterval("bg_tick();",1000)});function bg_isloaded(a){bg_state[a]=_STATE_DONELOADING}function bg_realign(){if(bg_showing_i==-1){return}var b=$("#bg_"+bg_showing_i);var f=b.find("img");b.css("visibility","hidden");var d=$(window).width();var a=$(window).height();var c=b.css("display");b.css("display","block");b.css("visibility","visible");b.css("overflow","visible");b.css("width","auto");b.css("height","auto");f.css("display","block");f.css("position","relative");f.css("visibility","visible");f.css("overflow","visible");f.css("width","auto");f.css("height","auto");$("body").css("overflow","hidden");var h=f.width();var g=f.height();if(h<d){var e=d/h;h=Math.round(h*e);g=Math.round(g*e)}if(g<a){var e=a/g;h=Math.round(h*e);g=Math.round(g*e)}b.css({width:d,height:a,overflow:"hidden"});var j=Math.round((d-h)/2);var i=Math.round((a-g)/2);f.css({width:h,height:g,overflow:"hidden",left:j,top:i});b.css("display",c);f.css("display",c);$("body").css("overflow","visible")}function bg_tick(){if(!bg_supported()){return}if(!bg_active){return}if(video_isvideoplaying()){return}bg_showing_timer-=1;bg_fadeTimer-=1;if(bg_fadeTimer<0){bg_fadeTimer=0}if(bg_showing_timer<0){var a=-1;for(var c=0;c<2;c++){if(bg_state[c]==_STATE_DONELOADING){a=c;c=10}}if(a!=-1){if(bg_showing_i!=-1){bg_fadeTimer=5;bg_state[bg_showing_i]=_STATE_NONE;$("#bg_"+bg_showing_i).stop(true).fadeTo("slow",0)}bg_showing_i=a;bg_showing_timer=bg_delay;bg_state[bg_showing_i]=_STATE_SHOWING;bg_realign();$("#bg_"+bg_showing_i).find("img").show();$("#bg_"+bg_showing_i).stop(true).fadeTo("slow",1,function(){if(bg_firstDoneLoadingCallback){bg_firstDoneLoadingCallback();bg_firstDoneLoadingCallback=null}})}}var b=false;for(var c=0;c<2;c++){b=b||bg_state[c]==_STATE_LOADING}if(!b&&bg_fadeTimer<=0){for(var c=0;c<2;c++){if(bg_state[c]==_STATE_NONE){if(bg_list.length>0){if(bg_list_position>=bg_list.length){bg_list_position=0}bg_state[c]=_STATE_LOADING;$("#bg_"+c).hide().find("img").attr("src","").attr("src",bg_list[bg_list_position++]);c=100}}}}}var tab_wanted_url=null;var tabs_parsed=false;function tabs_parse(){if(tabs_parsed){return}tabs_parsed=true;$(".page_navigation .label a").click(function(){var a=$(this).attr("href")+"tab/";tab_load(a,$(this));return false})}function tab_load(a,b){tab_wanted_url=a;$(".tabs .page_navigation li").removeClass("active");var c=$(b).parent().parent();c.addClass("active");$("#tab_content_loader").show();$("#tab_content").hide();$.ajax(a,{success:function(d,e){if(tab_wanted_url==a){$(".tabs .page_navigation li").removeClass("active");c.addClass("active");$("#tab_content_loader").hide();$("#tab_content").html(d).show();doInputHandlers()}}})}var subnav_activeitem=null;var subnav_activeitem_timer=0;var subnav_activeitem_subitems=[];var subnav_timer_lastTick=-1;var subnav_timer_delaytime=25;var subnav_hide_timer=null;function subnav_hide(){subnav_offset=0;if(subnav_hide_timer){clearTimeout(subnav_hide_timer);subnav_hide_timer=null}if(subnav_activeitem){subnav_activeitem.css("visibility","hidden");subnav_activeitem=null}$("li.topnavitem").removeClass("active")}function subnav_hide_delayed(a){var b=5000;if(a=="fast"){b=100}subnav_hide_timer=setTimeout("subnav_hide();",b)}function subnav_hide_cancel(){if(subnav_hide_timer){clearTimeout(subnav_hide_timer);subnav_hide_timer=null}}var subnav_maxitems=10;var subnav_show_current_element,subnav_show_current_liElement;function subnav_show(d,g){subnav_show_current_element=d;subnav_show_current_liElement=g;d.css("width","100px");$("li.topnavitem").removeClass("active");g.addClass("active");if(subnav_hide_timer){clearTimeout(subnav_hide_timer);subnav_hide_timer=null}if(subnav_activeitem){subnav_activeitem.css("visibility","hidden");subnav_activeitem=null}if(!d.attr("isParsed")){var f=0;var c=$('<li class="arrow arrow_top first"><div class="icon"></div></li>');c.click(function(){topnav_scrollUp()});c.appendTo(d);var e=$('<li class="arrow arrow_bottom last"><div class="icon"></div></li>');e.click(function(){topnav_scrollDown()});e.appendTo(d);d.find("li").each(function(){if(!$(this).hasClass("arrow")){var j=parseInt($(this).find("div.title").width());var h=parseInt($(this).find("div.text").width());var i=150;if(j>0&&j>h){i=j}else{if(h>0&&h>=j){i=h}}if(i>f){f=i}$(this).css({position:"absolute"});var k=escape($(this).find("a").attr("href"));if(typeof k!=undefined&&k!="undefined"){$(this).css("cursor","pointer").click(function(){document.location=k;return false})}else{$(this).click(function(){subnav_hide_cancel();return false})}}else{$(this).css({position:"absolute",cursor:"pointer"})}});d.find(".container").css("width",f+125);d.find("li").css("width",f+125);d.attr("isParsed",true)}var b=d.find(".container").width();if(d.attr("id")=="sub_motion_graphics"){var a=540-b;a-=130-75;d.css("left",a)}else{if(d.attr("id")=="sub_music_videos"){var a=540-b;a-=130-75;d.css("left",a)}}subnav_activeitem_subitems=[];d.find("li").each(function(){$(this).hide();$(this).css("opacity",0);if(!$(this).hasClass("arrow")){subnav_activeitem_subitems.push($(this))}});d.css("visibility","visible");subnav_activeitem_timer=0;subnav_activeitem=d;bg_realign()}function _CLAMP(a){return a<0?0:a>1?1:a}function _CLAMP2(a){return _CLAMP(a/2)}function easeOutQuad(e,a,g,f){e/=f;return -g*e*(e-2)+a}function easeInOutQuint(e,a,g,f){e/=f/2;if(e<1){return g/2*e*e*e*e*e+a}e-=2;return g/2*(e*e*e*e*e+2)+a}function easeOutSine(e,a,g,f){return g*Math.sin(e/f*(Math.PI/2))+a}function subnav_timer_start(){var d=new Date().getTime();if(subnav_timer_lastTick==-1){subnav_timer_lastTick=d;setTimeout("subnav_timer_start();",subnav_timer_delaytime)}var m=d-subnav_timer_lastTick;m/=1000;m*=1.5;subnav_timer_lastTick=d;if(subnav_activeitem){subnav_activeitem_timer+=m;var e,b=subnav_maxitems;var g=true,h=subnav_offset>0?true:false;if(b+subnav_offset>=subnav_activeitem_subitems.length){b=subnav_activeitem_subitems.length-subnav_offset;g=false}var j=0;var n=400;var c=10;for(e=0;e<b;e++){var l=subnav_activeitem_subitems[e+subnav_offset];if(e==0&&!h){l.addClass("first")}else{l.removeClass("first")}if(e==b-1&&!g){l.addClass("last")}else{l.removeClass("last")}var k=_CLAMP2(((subnav_activeitem_timer*c)-e));var f=_CLAMP2((subnav_activeitem_timer*c)-(e+0.5));k=easeOutSine(k,0,1,1);f=easeOutSine(f,0,1,1);if(h&&e==0){subnav_activeitem.find(".arrow_top").css({opacity:k,"z-index":n,top:j}).show();j+=(subnav_activeitem.find(".arrow_top").height()+2)*f;n--}else{if(e==0){subnav_activeitem.find(".arrow_top").hide()}}l.css({opacity:k,"z-index":n,top:j}).show();j+=48*f;n--;if(g&&e==b-1){var k=_CLAMP2(((subnav_activeitem_timer*c)-(e+1)));k=easeOutSine(k,0,1,1);subnav_activeitem.find(".arrow_bottom").css({opacity:k,"z-index":n,top:j}).show();n--;if(k>=1){}}else{if(e==b-1){subnav_activeitem.find(".arrow_bottom").hide()}}}}setTimeout("subnav_timer_start();",subnav_timer_delaytime)}function topnav_scrollUp(){subnav_hide_cancel();subnav_offset-=subnav_maxitems;subnav_show(subnav_show_current_element,subnav_show_current_liElement)}function topnav_scrollDown(){subnav_hide_cancel();subnav_offset+=subnav_maxitems;subnav_show(subnav_show_current_element,subnav_show_current_liElement)}var draggables=[];var draggable_element=null;var draggable_element_drag_width=null;var draggable_dragstart_element_x=null;var draggable_dragstart_mouse_x=null;var draggable_callback=null;var global_mouse_x=-1;var global_mouse_y=-1;$(document).mousemove(function(c){global_mouse_x=c.pageX;global_mouse_y=c.pageY;if(draggable_element){var a=draggable_dragstart_element_x+(c.pageX-draggable_dragstart_mouse_x);if(a>draggable_element_drag_x_max){a=draggable_element_drag_x_max}else{if(a<draggable_element_drag_x_min){a=draggable_element_drag_x_min}}if(draggable_callback){var b=(a-draggable_element_drag_x_min)/(draggable_element_drag_x_max-draggable_element_drag_x_min);draggable_callback(draggable_element,a,b)}draggable_element.css("left",a)}});$(document).mouseup(function(){draggable_element=null});function draggable_add(a,c,b,e){a.css("left",c);a.mousedown(function(){if(global_mouse_x>=1){draggable_element_drag_x_min=c;draggable_element_drag_x_max=c+b;draggable_dragstart_element_x=parseInt(a.css("left"));draggable_dragstart_mouse_x=global_mouse_x;draggable_callback=e;draggable_element=a}});var d=draggables.length;draggables.push({baseX:c,width:b,element:a});return d}function draggable_setPositionPercentage(c,b){var d=draggables[c];if(draggable_element!=d.element){var a=d.baseX+Math.round(b*d.width);d.element.css("left",a)}}var sidescroller_source_images=[];var sidescroller_source_image_info=[];var sidescroller_elements=[];var sidescroller_lastTick=-1;var sidescroller_animationTime=0;var sidescroller_delaytime=20;var sidescroller_center_element=null;function sidescroller_image_add(a){var b={};b.id=a.attr("id").replace(/^project_/,"");b.title=a.attr("alt");b.href=a.parent().attr("href");sidescroller_source_image_info.push(b);sidescroller_source_images.push(a.attr("src"))}function sidescroller_goto_project(h){var d=-1;for(var c=0;c<sidescroller_elements.length;c++){if(sidescroller_center_element==sidescroller_elements[c]){d=c}}if(d!=-1){var f=d;var a=0;var e=0;var j=false;for(var c=0;c<sidescroller_elements.length;c++){var b=sidescroller_elements[d];var g=b.find("img").attr("id").replace(/^project_image_/,"");if(h==g){j=true;break}else{a++;d++;if(d==sidescroller_elements.length){d=0}}}d=f;for(var c=0;c<sidescroller_elements.length;c++){var b=sidescroller_elements[d];var g=b.find("img").attr("id").replace(/^project_image_/,"");if(h==g){j=true;break}else{e++;d--;if(d==-1){d=sidescroller_elements.length-1}}}if(!j){}else{if(a==0||e==0){}else{if(a<e){sidescroller_offset_wanted+=130}else{sidescroller_offset_wanted-=130}}}}}function side_scroller_getActiveProject(){if(sidescroller_center_element){return sidescroller_center_element.find("img").attr("id").replace(/^project_image_/,"")}return -1}function side_scroller_readmore(){if(sidescroller_center_element){document.location=sidescroller_center_element.find("img").attr("project_link")}}function side_scroller_load_project(){var a=side_scroller_getActiveProject();if(a!=-1){playlist_firstVideo=false;var b=videoplayers[0].instance;b.autoplay=true;playlist_load(a);b.play()}}function sidescroller_load(){$.preLoadImages(sidescroller_source_images,function(){var c,b=sidescroller_source_images.length;for(c=0;c<b;c++){var d=sidescroller_source_images[c];var a=$('<div class="thumb"><span></span><img /></div>');a.find("img").attr("src",d).attr("title",sidescroller_source_image_info[c].title).attr("id","project_image_"+sidescroller_source_image_info[c].id).attr("project_link",sidescroller_source_image_info[c].href).error(function(){$(this).attr("src","/images/slider_nothumb.jpg")});a.css("opacity",0).css("display","block");a.appendTo($("#side_scroller_thumbs"));a.click(function(){sidescroller_scrollTo($(this))});a.attr("id","sc_img_"+c);sidescroller_elements.push(a)}$("#side_scroller_button_right").mousedown(function(){sidescroller_offset_velocity=200});$("#side_scroller_button_right").mouseup(function(){sidescroller_offset_wanted=Math.ceil(sidescroller_offset/130)*130;sidescroller_offset_velocity=0});$("#side_scroller_button_left").mousedown(function(){sidescroller_offset_velocity=-200});$("#side_scroller_button_left").mouseup(function(){sidescroller_offset_wanted=Math.floor(sidescroller_offset/130)*130;sidescroller_offset_velocity=0});$("#side_scroller_thumbs").mouseover(function(){sidescroller_usemouseforalpha=true});$("#side_scroller_thumbs").mouseout(function(){sidescroller_usemouseforalpha=false});sidescroller_start()})}var sidescroller_offset_base=(-25)+(130/2)+130;var sidescroller_offset=0;var sidescroller_offset_wanted=0;var sidescroller_offset_velocity=0;var sidescroller_usemouseforalpha=false;var sidescroller_isshowingtitle=false;var sidescroller_isbuildingup=false;var sidescroller_title_current="";var sidescroller_href_current="";var sidescroller_title_wanted="";var sidescroller_title_animationTimer=0;var sidescroller_title_animationFadeTimer=0;function sidescroller_scrollTo(b){var a=-($("#side_scroller_thumbs").offset().left-global_mouse_x+(831/2));a/=130;a=130*Math.round(a);sidescroller_offset_wanted+=a}function sidescroller_start(){var f=new Date().getTime();if(sidescroller_lastTick==-1){sidescroller_lastTick=f;setTimeout("sidescroller_start();",sidescroller_delaytime)}var u=f-sidescroller_lastTick;u/=1000;u*=1.25;sidescroller_lastTick=f;sidescroller_animationTime+=u;var r,p=sidescroller_elements.length;var k=0;if(sidescroller_offset_velocity==0){var l=sidescroller_offset_wanted-sidescroller_offset;var t=l*u*5;if(Math.abs(t)>Math.abs(l)){t=l}var n=300;if(Math.abs(t)>n*u){t=t<0?-n*u:n*u}sidescroller_offset+=t}else{sidescroller_offset+=sidescroller_offset_velocity*u;sidescroller_offset_wanted=sidescroller_offset}if(sidescroller_offset>130){sidescroller_offset-=130;sidescroller_offset_wanted-=130;var s=[];for(r=0;r<p;r++){s.push(sidescroller_elements[r])}sidescroller_elements=[];o=1;for(r=0;r<p;r++){if(o>=p){o=0}sidescroller_elements.push(s[o]);o++}}else{if(sidescroller_offset<-130){sidescroller_offset+=130;sidescroller_offset_wanted+=130;var s=[];for(r=0;r<p;r++){s.push(sidescroller_elements[r])}sidescroller_elements=[];o=1;for(r=0;r<p;r++){if(o>=p){o=0}sidescroller_elements[o]=s[r];o++}}}var a=!(sidescroller_animationTime<0.5||Math.abs(sidescroller_offset_velocity)>2||Math.abs(sidescroller_offset_wanted-sidescroller_offset)>2);if(!a){if(sidescroller_isshowingtitle){sidescroller_isshowingtitle=false;sidescroller_isbuildingup=false;sidescroller_href_current="";sidescroller_title_wanted=""}}for(r=0;r<p;r++){var o=r-4;if(o<0){o=sidescroller_elements.length+o}var b=sidescroller_elements[o];var g=k-(sidescroller_offset_base+sidescroller_offset);b.css("left",g);var e=-2+(8*(sidescroller_animationTime-(o/8)));e+=-1+(8*(sidescroller_animationTime-(r/8)));if(e<0){e=0}else{if(e>1){e=1}}var q=Math.abs((((g-130)+sidescroller_offset_base)-(3*130))/50);if(q<=1&&a&&!sidescroller_isshowingtitle){sidescroller_isshowingtitle=true;sidescroller_title_wanted=b.find("img").attr("title");sidescroller_href_current=b.find("img").attr("project_link")}if(q<=0.5){if(Math.abs(sidescroller_offset-sidescroller_offset_wanted)<50){sidescroller_center_element=b}}if(q<=0){q=0}else{if(q>=1){q=1}}var c=b.find("img").attr("id").replace(/^project_image_/,"");if(c!=playlist_currentID){}if(Math.abs(sidescroller_offset-sidescroller_offset_wanted)>50){}e*=(0.4*(1-q))+0.6;if(sidescroller_usemouseforalpha){var h=1-Math.abs(b.offset().left-global_mouse_x+(130/2))/130;if(h<0||e<=0){h=0}e+=h}b.css("opacity",e);k+=130}sidescroller_title_animationTimer-=u*4;if(sidescroller_title_animationTimer<0){if(sidescroller_title_current!=sidescroller_title_wanted){var m=sidescroller_title_current.length>0&&sidescroller_title_wanted.indexOf(sidescroller_title_current)!=0;if(sidescroller_title_animationFadeTimer>0){sidescroller_title_animationFadeTimer-=u*3;if(sidescroller_title_animationFadeTimer<0){sidescroller_title_animationFadeTimer=0}$("#side_scroller_readmore").css("cursor","pointer").css("opacity",sidescroller_title_animationFadeTimer)}else{if(m){sidescroller_title_current=sidescroller_title_current.substr(0,sidescroller_title_current.length-1)}else{sidescroller_title_current+=sidescroller_title_wanted.charAt(sidescroller_title_current.length);if(sidescroller_title_current.length==sidescroller_title_wanted.length&&sidescroller_title_current==sidescroller_title_wanted){}if(!sidescroller_isbuildingup){sidescroller_isbuildingup=true}}}$("#side_scroller_title span").html(sidescroller_title_current);sidescroller_title_animationTimer=0.0125}else{if(sidescroller_title_wanted.length&&sidescroller_title_animationFadeTimer<1){sidescroller_title_animationFadeTimer+=u*3;if(sidescroller_title_animationFadeTimer>1){sidescroller_title_animationFadeTimer=1}if(sidescroller_href_current){$("#side_scroller_readmore").show().css("opacity",sidescroller_title_animationFadeTimer)}}}}setTimeout("sidescroller_start();",sidescroller_delaytime)}var playlist=[];var playlist_currentID=-1;var playlist_firstVideo=true;var playlist_autoplayed_count=0;function playlist_add(e,c,b,d){var a={id:e,videoName:b,poster:d,isIdent:c};playlist.push(a);playlist_autoplayed_count++}function playlist_start(){if(playlist.length>0){playlist_load(playlist[0].id)}}function playlist_next(){if(playlist.length==0){return}playlist_autoplayed_count--;if(playlist_autoplayed_count<0){playlist_autoplayed_count=playlist.length;return}var b=-1;for(var a=0;a<playlist.length-1;a++){if(playlist[a].id==playlist_currentID){b=playlist[a+1].id}}if(b==-1){b=playlist[0].id}if(b!=playlist_currentID){var c=videoplayers[0].instance;c.autoplay=true;sidescroller_goto_project(b);playlist_load(b)}}var playlist_firstItem=true;function playlist_load(f){var e=document.getElementById("video_player_instance");var c=null;for(var b=0;b<playlist.length;b++){if(parseInt(playlist[b].id)==parseInt(f)){c=playlist[b];break}}var a="/video/"+c.videoName;var d=c.videoName?true:false;if(d){video_enable_controls(videoplayers[0].ID)}else{video_disable_controls(videoplayers[0].ID)}var e=videoplayers[0].instance;if(e.canPlayType("video/mp4")){a+=".mp4"}else{if(e.canPlayType("video/ogv")){a+=".ogv"}else{if(e.canPlayType("video/webm")){a+=".webm"}else{a+=".mp4"}}}e.pause();if(!playlist_firstVideo&&d){video_loading_show(videoplayers[0].ID)}if(!playlist_firstVideo){e.poster="/images/empty.png"}if(!d){setTimeout("playlist_next();",4000);e.src=""}else{if(!playlist_firstItem&&removeHostname(e.src)!=a){e.src=a}}playlist_firstItem=false;if(!d&&removeHostname(e.poster)!=c.poster){e.poster=c.poster}playlist_currentID=f;$.getJSON("/api/project/"+f+"/backgrounds/",function(h){bg_reset();bg_play();if(h&&h.length>0){for(var g=0;g<h.length;g++){bg_add(h[g])}}else{}})}function removeHostname(a){if(a){a=a.replace(/^http(s:|:)\/\/.+?lanetx\.nl/,"")}return a}$(document).ready(function(){playlist_start()});(function(a){a.preLoadImages=function(g,f){var c=[],d,e,b=0;if(typeof g!="undefined"){if(a.isArray(g)){e=g.length;for(d=0;d<e;d++){c[d]=new Image();c[d].onload=function(){b++;if(b==e){if(a.isFunction(f)){f()}}};c[d].onerror=function(){b++;if(b==e){if(a.isFunction(f)){f()}}};c[d].src=g[d]}}else{c[0]=new Image();c[0].onload=function(){if(a.isFunction(f)){f()}};c[0].src=g}}c=undefined}})(jQuery);var twitterticker_tweets=[];var twitterticker_current=-1;var twitterticker_tweetWidth=0;var twitterticker_tweetOffset=0;var twitterticker_tweetDelta=30;var twitterticker_paused=false;function twitter_setup(){setTimeout("twitter_setup_forreal();",5000)}function twitter_setup_forreal(){$("#tweet").mouseover(function(){twitterticker_paused=true}).mouseout(function(){twitterticker_paused=false});var a="http://search.twitter.com/search.json?q="+escape("from:planetxfx")+"&rpp=5";$.ajax({url:a,dataType:"jsonp",success:function(f){if(f&&f.results){for(var d in f.results){var b=f.results[d];var h=b.text;h=h.replace(/\S\#/g," geenSpatieVoorHekje_kanWeg #");h=h.replace(/\#(\w+?)(\W|$)/g,'<span class="hash">#$1</span>$2');h=h.replace(/ geenSpatieVoorHekje_kanWeg /g,"");var e=/(HTTP:\/\/|HTTPS:\/\/)([a-zA-Z0-9.\/&?_=!*,\(\)+-]+)/i;var c='<a href="$1$2" target="_blank">$1$2</a>';h=h.replace(e,c);var g={text:h+' <span class="date">- '+$.timeago(b.created_at)+"</span>",};twitterticker_tweets.push(g)}twitterticker_next()}}})}function twitterticker_next(){twitterticker_current++;if(twitterticker_current>=twitterticker_tweets.length){twitterticker_current=0}var a=twitterticker_tweets[twitterticker_current];if(a){$("#tweet").hide().css("width","auto").html("<nobr>"+a.text+"</nobr>");$("#tweet_container").css("overflow","visible").css("width","10000");twitterticker_tweetWidth=$("#tweet").width();$("#tweet_container").css("overflow","hidden").css("width","320");twitterticker_tweetOffset=-320;twitterticker_tick()}}function twitterticker_tick(){if(!video_isvideoplaying()){if(!twitterticker_paused){var a=twitterticker_tweetDelta/1000;twitterticker_tweetOffset+=a*75/2;$("#tweet").css("left",-Math.round(twitterticker_tweetOffset)).show()}if(twitterticker_tweetOffset>=twitterticker_tweetWidth){twitterticker_next()}else{setTimeout("twitterticker_tick();",twitterticker_tweetDelta)}}else{setTimeout("twitterticker_tick();",twitterticker_tweetDelta)}};
