var uriRe=/\b(?:(?:https?|ftp|telnet|ldap|irc|nntp|news|irc|ed2k):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/i;container=null;initialRun=true;logoutTimer=null;SWFAddress.addEventListener(SWFAddressEvent.INIT,handleInit);Shadowbox.loadSkin("classic","/~general/var/shadowbox/skin");Shadowbox.loadLanguage("nl","/~general/var/shadowbox/lang");Shadowbox.loadPlayer(["flv","img","swf"],"/~general/var/shadowbox/player");function toTitleCase(a){return a.substr(0,1).toUpperCase()+a.substr(1).toLowerCase()}function formatTitle(a){return"Discotheek ENERGY Budel "+(a!="/"?" / "+toTitleCase(a.substr(1,a.length-2).replace(/\//g," / ")):"")}function addBlockEffects(a){$("a",a).each(function(c,d){var b=$(d);if(b.hasClass("more")){var e=b.closest(".subblock, .block")[0];if(e!=null){var f=$(".inner",e)[0];if(f!=null){$(f).hover(function(){$(this).addClass("innerHover")},function(){$(this).removeClass("innerHover")})}}}})}function catchLinks(b,c){var a,e,d;c=c||SWFAddress.getValue();e=document.location.pathname;e=(e.indexOf("?")>0)?e.substr(0,e.indexOf("?")):e;$("a",b).each(function(g,h){var f=$(h);if(f.attr("rel")){if(f.attr("rel")=="_external"||uriRe.test(f.attr("rel"))){f.attr({target:"_blank"})}else{if(f.attr("rel").substr(0,9)!="shadowbox"&&f.attr("rel").substr(0,9)!="slideshow"){if(SWFAddress){a=f.attr("rel");d=a.replace(new RegExp(/^[\/\\](.*?)[\/\\].*/),"$1");if(d==c.replace(new RegExp(/^[\/\\](.*?)[\/\\].*/),"$1")||(c.replace("/","")==""&&d=="home")){f.closest("li").addClass("active")}else{f.closest("li").removeClass("active")}}f.click(swfAddressLink)}}}})}function catchForms(b){b=b||document;var c=SWFAddress.getParameters();c.ajax=true;var e="";for(var d in c){if(c[d]==null){continue}e+="&"+d+"="+c[d]}var a=$("#content");$(".dynamicform",b).each(function(g,h){var f={target:a,url:"/datasource.cfm?swfaddress="+($(this).attr("action")!=""?$(this).attr("action"):getCurrentPath()+e),success:function(k,j,i){updateLayout($("#content")[0]);Shadowbox.clearCache();Shadowbox.setup($("a[rel^=shadowbox]","#content"),{counterType:"skip",continuous:true,animSequence:"sync",slideshowDelay:5});setupSlideshow($("#content")[0])}};$(h).ajaxForm();$(h).submit(function(){a.prepend('<p class="loading">Bezig met laden...</p>');$(this).ajaxSubmit(f);return false})})}function getArguments(h,c){if(h==""||c==""){return h}var g=h,e=g.indexOf(c),d=[];if(e!=-1){g=g.substr(e+1);if(g!=""&&g.indexOf("=")!=-1){var b=g.split(c);var f=0;while(f<b.length){d[(b[f].split("=")[0])]=(b[f].split("=")[1]!=null)?b[f].split("=")[1]:"";f++}}}return d}function updateLayout(a){a=a||document;catchLinks(a);catchForms(a);addBlockEffects(a)}function playerReady(b){var a=b!=null&&swfobject!=null?swfobject.getObjectById(b.id):null;if(a&&typeof(a.addControllerListener)=="function"){a.addModelListener("STATE","playerStateChanged")}}function playerStateChanged(a){if(a&&typeof(a.newstate)!="undefined"){headerObj=swfobject.getObjectById("header-wrapper");if(headerObj){switch(a.newstate){case"PLAYING":if(typeof(headerObj.pause)=="function"){headerObj.pause()}break;case"IDLE":case"PAUSED":case"COMPLETED":}}}}function setupSlideshow(b){b=b||document;var a="9.0.18";$(".mediapreview",b).each(function(){var c=$(this),k=$(".thumblist",c),j=$(".itempreview",c),i=null;if(j.length==0){return}if($("a[rel*=type=video]",c).length>0&&swfobject.hasFlashPlayerVersion(a)){var f=getArguments($("a[rel*=type=video]",c).attr("rel"),";")["preview"];if(f==null){f=""}var e={file:$("a[rel*=type=video]",c).attr("href"),image:f,autostart:false,showicons:true,controlbar:"hidden",backcolor:"0x000000",frontcolor:"0xcccccc",lightcolor:"0xda251d"};var h={scale:"noScale",allowFullScreen:true};var l=$(document.createElement("div"));nodeId="mediass_"+new Guid().generate();l.attr("id",nodeId);j.html(l);swfobject.embedSWF("/~general/swf/player.swf",nodeId,j.css("width"),j.css("height"),a,"/~general/swf/expressInstall.swf",e,h,{id:nodeId});player=swfobject.getObjectById(nodeId)}$("li a[rel^=slideshow] > img",k).parent("a").click(function(){var o={type:"image"};var n=$.extend({},o,getArguments($(this).attr("rel"),";"));switch(n.type){case"image":var p=$("img",j);if(p.length==1){if(p.attr("src")!=$(this).attr("href")){var m=$('<img src="'+$(this).attr("href")+'" alt="'+$("img",this).attr("alt")+'" />');p.before(m);p.fadeOut(1000,function(){$(this).remove()})}}break;case"video":if(player){player.sendEvent("LOAD",{file:$(this).attr("href"),title:$("img",this).attr("alt")});player.sendEvent("PLAY")}break}});var d=$("a.prev",$(this)),g=$("a.next",$(this));k.serialScroll({target:"ul",items:"li",prev:d,next:g,onBefore:function(o,n,m,q,p){d.add(g).show();if(p<=1){d.hide()}else{if(p==q.length-2){g.hide()}}},offset:-($("li",k).height()+$("li",k).get(0).offsetTop),exclude:1,start:0,axis:"y",duration:600,force:true,stop:true,lock:false,constant:false,cycle:false,jump:true})})}function swfAddressLink(){container=$(this).closest(".content")[0];SWFAddress.setValue($(this).attr("rel"));this.blur();return false}function getCurrentPath(){var c="";if(SWFAddress&&document.location.href.indexOf("#")>-1){c=SWFAddress.getPath()}else{c=document.location.pathname;c=(c.indexOf("?")>0)?c.substr(0,c.indexOf("?")):c;var b=c.split("/");for(var a=b.length-1;a>0;--a){if(b[a].indexOf(".")>0){if(a<b.length-1){c.splice(a,(b.length-1)-a)}else{c=[]}break}}}return c}function handleInit(a){initialRun=true;$(document).ready(function(){updateLayout();Shadowbox.clearCache();Shadowbox.setup($("a[rel^=shadowbox]"),{counterType:"skip",continuous:true,animSequence:"sync",slideshowDelay:5});setupSlideshow()});SWFAddress.addEventListener(SWFAddressEvent.CHANGE,handleChange)}function handleChange(d){var h="";if(typeof(redirect)!="undefined"&&!isNaN(redirect)){clearTimeout(redirect)}if(initialRun&&SWFAddress.getValue().replace("/","")==""){if(document.location.href.indexOf("#")==-1){var g=getCurrentPath();var f=g.replace("/","");if(f.length>0){catchLinks(null,g)}}container=null;return}if(!initialRun&&(container!=null&&$(container).length>0)&&container.id!=""&&SWFAddress.getParameter("container")==""){d.parameters.container=$(container).id}if(SWFAddress.getParameter("container")!=""){if(!initialRun){var b=$("#"+SWFAddress.getParameter("container"));if(b.length>0){container=b[0]}}else{d.parameters.container=null}}d.parameters.ajax=true;for(var f in d.parameters){if(d.parameters[f]==null){continue}h+="&"+f+"="+d.parameters[f]}var a=["header","topbar"];for(var e in a){catchLinks(document.getElementById(e))}var c=(!initialRun&&container!=null&&$(container).length>0&&container.id!="")?$(container):$("#content");initialRun=false;c.prepend('<p class="loading">Bezig met laden...</p>');$.ajax({method:"get",url:"/datasource.cfm",data:"swfaddress="+d.path+h,cache:!$.browser.msie,beforeSend:function(){$("#loading").css("display","block")},complete:function(){if(container){window.scrollTo(window.scrollX,0)}$("#loading").css("display","none")},error:function(){},success:function(i){c.html(i);updateLayout(c[0]);var j=$("a[rel^=shadowbox]",c);Shadowbox.clearCache();Shadowbox.setup(j,{counterType:"skip",continuous:true,animSequence:"sync",slideshowDelay:5});if(typeof(pageTracker)!="undefined"&&pageTracker){pageTracker._trackPageview(d.path)}setupSlideshow(c[0])}});$.ajax({method:"get",url:"/getuser.cfm",data:"guType=loginLink",cache:!$.browser.msie,success:function(i){if($($(i)[2]).html()!=$("#user-login").children("a").html()){$("#user-login").html(i);catchLinks($("#user-login")[0])}}});container=null;SWFAddress.setTitle(formatTitle(d.path))}$(document).ready(function(){var a="9.0";if(swfobject.hasFlashPlayerVersion(a)){$.ajax({url:"/getsettings.cfm",data:{type:"header",format:"json"},type:"get",dataType:"json",success:function(c){var b=c.length>0?c[0]:{};var d={base:"/~general/swf/header/",scale:"noScale",wmode:"transparent",allowScriptAccess:"sameDomain"};swfobject.embedSWF("/~general/swf/header/EnergyHeader.swf","header-wrapper","100%","100%",a,"/~general/swf/expressInstall.swf",b,d,{id:"header-wrapper"})}})}addBlockEffects(document);Shadowbox.init({skipSetup:true})});
