﻿
	// CREATIONAL
	
	// COPYRIGHT  : 2005-2010 : CREATIONAL : WWW.CREATIONAL.NL : ALL RIGHTS RESERVED
	
	// JAVASCRIPT : General Scripts
	
	
	// JAVASCRIPT : ADD OR REMOVE EVENTS
	function addEvent(obj,evType,fn,useCapture) { if (obj.addEventListener) { obj.addEventListener(evType,fn,useCapture); return true; } else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType,fn); return r; } else { alert("Handler could not be attached"); } }
	function removeEvent(obj,evType,fn,useCapture) { if (obj.removeEventListener){ obj.removeEventListener(evType,fn,useCapture); return true; } else if (obj.detachEvent){ var r = obj.detachEvent("on"+evType,fn); return r; } else { alert("Handler could not be removed"); } }	
	
	// JAVASCRIPT : E-MAIL OBFUSCATION
	function CL_emailExpand(t,e) { if (t === null || typeof t == 'undefined') { return ''; } if (t.indexOf('@') > -1 || t.indexOf('&#64;') > -1) { var p, pe, es; p = t.indexOf('&#64;'); if (p == -1) { p = t.indexOf('@'); } pe = t.indexOf('<',p); if (pe == -1) { pe = t.indexOf(' ',p); } if (pe == -1) { pe = t.indexOf('%20',p); } if (pe == -1) { pe = t.length; } es = t.substring(0,p); p = es.lastIndexOf('>'); if (p == -1) { p = es.lastIndexOf(' '); } if (p == -1) { p = es.lastIndexOf('%20'); if (p > -1) { p = p+2; } } else { p = p+1; } if (p == -1) { p = 0; } es = t.substring(p,pe); t = t.replace(es,e); } return t; }
	function rot13init() { var m = []; var s = "abcdefghijklmnopqrstuvwxyz",i; for (i = 0 ; i < s.length ; i++) { m[s.charAt(i)] = s.charAt((i+13)%26); } for (i = 0 ; i < s.length ; i++) { m[s.charAt(i).toUpperCase()] = s.charAt((i+13)%26).toUpperCase(); } return m; }
	function str_rot13(a,m) { var s = ""; for (var i = 0 ; i < a.length ; i++) { var b = a.charAt(i); s += (b>='A' && b<='Z' || b>='a' && b<='z' ? m[b] : b); } return s; }
	function CL_emailObfuscation() { if (!document.getElementsByTagName) { return false; } var lnks = document.getElementsByTagName('a'); var m = rot13init(), i = 0; function geo_decode(a) { var href = a.getAttribute('href'); var d = href.replace(/.*geo=([a-z0-9._%\-]+)\+([a-z0-9._%\-]+)\+([a-z.]+)/i, '$1' + '@' + '$2' + '.' + '$3'); if (href != d) { var p, s = '', e = d, l, t; p = d.indexOf('&'); if (p > -1) { e = d.substr(0,p); s = d.substr(p+1); s = s.replace('geo_s=','?subject='); } e = str_rot13(e,m); s = CL_emailExpand(s,e); a.setAttribute('href','mailto:' + e +s); l = a.innerHTML; a.innerHTML = CL_emailExpand(l,e); t = a.getAttribute('title'); if (t) { t = CL_emailExpand(t,e); a.setAttribute('title',t); } } } for (i; i < lnks.length ; i++) { var href = lnks[i].getAttribute('href'); if (href && href.indexOf('geo=') > -1) { geo_decode(lnks[i]); } } }

	// JAVASCRIPT : CLEAR AND SET SEARCH INPUT
	// ClassNames: 'search_input_active' and 'search_input'
	function CL_searchInputFocus() { if (document.searchForm.searchInput.value == searchInitialValue) { document.searchForm.searchInput.value = ""; document.searchForm.searchInput.className = "search_input_active"; } }
	function CL_searchInputFocusModule() { if (document.searchFormModule.searchInputModule.value == searchInitialValueModule) { document.searchFormModule.searchInputModule.value = ""; document.searchFormModule.searchInputModule.className = "search_input_active"; } }
	function CL_searchInputSet() { if (document.searchForm || document.searchFormModule) { var m1 = '', m2 = '', v = ''; if (arguments[0] === true) { m1 = 'Module'; m2 = '_module'; v = searchInitialValueModule; } else { v = searchInitialValue; } var d = navigator.userAgent.toLowerCase(); if (d.indexOf('safari') > -1) { var s = document.getElementById('searchInput'+m1); s.type = 'search'; s.setAttribute('results','0'); s.setAttribute('placeholder',v); s = document.getElementById('searchSubmit'+m1); s.style.display = 'none'; s = document.getElementById('search'+m2); s.style.background = 'none'; } 
		else { if (m1 == 'Module' && document.searchFormModule.searchInputModule) { if (document.searchFormModule.searchInputModule.value == "") { document.searchFormModule.searchInputModule.value = v; document.searchFormModule.searchInputModule.className = "search_input"; } } else if (document.searchForm.searchInput) { if (document.searchForm.searchInput.value == "") { document.searchForm.searchInput.value = v; document.searchForm.searchInput.className = "search_input"; } } } } }
	function CL_searchInputSetModule() { CL_searchInputSet(true); }
	// addEvent(window,'load',CL_searchInputSet);

	// JAVASCRIPT: DROPDOWN
	// ClassName: 'over'
	var menuname = "languages";
	function CL_startList() { if (document.getElementById(menuname)) { var r = document.getElementById(menuname); for (var i=0; i<r.childNodes.length; i++) { var n = r.childNodes[i]; if (n.nodeName=="LI") { n.onmouseover=function() { this.className+=" over"; }; n.onmouseout=function() { this.className=this.className.replace("over", ""); }; } } } }
	//addEvent(window,'load',CL_startList);
	
	// JAVASCRIPT : TOOLTIP
	// Based on code by Craig Erskine (grayg.com), Multi-tag support by James Crooke (www.cj-design.com), Inspired by code from Travis Beckham (www.squidfingers.com / www.podlob.com)
	var tt_tags = "a,label,div,img", tt_x = 0, tt_y = 15, tt_s = null, tt_e = null;	
	CL_tooltip = { name : "tooltip", offsetX : tt_x, offsetY : tt_y, tip : null };	
	CL_tooltip.init = function () { if (!document.getElementById) { return; } if (tt_s !== null) { return; } tt_s = true; var tu = "http://www.w3.org/1999/xhtml"; var tc = document.getElementById(this.name); 
		if (!tc) { tc = document.createElementNS ? document.createElementNS(tu, "div") : document.createElement("div"); tc.setAttribute("id", this.name); document.getElementsByTagName("body").item(0).appendChild(tc); } this.tip = document.getElementById(this.name); if (this.tip) { document.onmousemove = function(event) { CL_tooltip.move(event); }; } var a, tt, e; var el = tt_tags.split(","); for(var j = 0; j < el.length; j++) { if (tt_e === null) { e = document.getElementsByTagName(el[j]); } else { e = document.getElementById(tt_e).getElementsByTagName(el[j]); } if(e) { for (var i = 0; i < e.length; i ++) { a = e[i]; tt = a.getAttribute("title"); if(tt) { a.setAttribute("tiptitle", tt); a.removeAttribute("title"); a.removeAttribute("alt"); a.onmouseover = function() { CL_tooltip.show(this.getAttribute('tiptitle')); }; a.onmouseout = function() { CL_tooltip.hide(); }; } } } } };
	CL_tooltip.move = function (e) { var x=0, y=0; if (document.all) { x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft; y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop; x += window.event.clientX; y += window.event.clientY; } else { x = e.pageX; y = e.pageY; } this.tip.style.left = (x + this.offsetX) + "px"; this.tip.style.top = (y + this.offsetY) + "px"; };
	CL_tooltip.show = function (t) { if (!this.tip) { return; } t = t.replace('[','<strong>'); t = t.replace(']','</strong>'); t = t.replace(/ - /g,'<br />'); this.tip.innerHTML = t; this.tip.style.display = "block"; };
	CL_tooltip.hide = function () { if (!this.tip) { return; } this.tip.innerHTML = ""; this.tip.style.display = "none"; };
	CL_tooltipStart = function () { CL_tooltip.init (); };
	// addEvent(window,'load',CL_tooltipStart);
		
	// JAVASCRIPT : EXPAND / COLLAPSE
	// ClassNames: 'expandcollapse', 'expand' and 'expanded'
	// Required: Prototype.js
	function CL_expandCollapse() { var ttls = $$('#content .expandcollapse'); var txts = $$('#content .expand'); txts.each (function(txt){ txt.hide(); }); ttls.each (function(ttl) { ttl.onclick = function(ttl)	{ var obj = this; if (this.tagName == "SPAN") { obj = this.parentNode; } if (obj.next('.expand')) { var nt = obj.next('.expand'); if (nt.getStyle('display') == 'none' || nt.getStyle('display') === null) { nt.show(); this.addClassName('expanded'); } else { nt.hide(); this.removeClassName('expanded'); } } }; }); }
	// addEvent(window,'load',CL_expandCollapse);
	
	// JAVASCRIPT : MODULE TOGGLE LIST	
	// Required: Prototype.js
	function CL_moduleToggleList(obj) { var l = $(obj).next('ul'); if ($(l)) { if ($(l).getStyle('display') == 'none') { $(l).setStyle({display:'block'}); $(obj).update('-'); } else { $(l).hide(); $(obj).update('+'); } } }

	// JAVASCRIPT : RSS FEED
	function CL_getRssFeed(feed) { var file = '/inc/cl_feeds.inc.php'; if (feed.file) { file = feed.file; } var hash = new Hash(); hash.set(rss.url_query_link,feed.url); if (feed.limit) { hash.set(rss.url_query_limit,feed.limit); } if (feed.desc) { hash.set(rss.url_query_desc,feed.desc); } if (feed.date) { hash.set(rss.url_query_date,feed.date); } var pars = hash.toQueryString();
		var getFeed = new Ajax.Request(file,{ method: 'get', parameters: pars, onSuccess: function(oReq, oJSN) { var data = eval(oReq.responseText); if (data == 'ERROR') { if (!feed.count) { feed.count = 0; } if (!feed.timeout) { feed.timeout = 0; } if (!feed.retry) { feed.retry = 5; } feed.count = feed.count+1; feed.timeout = feed.timeout+feed.count*3000; if (feed.count < feed.retry) { setTimeout(function() { CL_getRssFeed(feed); },feed.timeout); } } else { CL_showRssFeed(feed,data); } }, onFailure: function() { if (!feed.count) { feed.count = 0; } if (!feed.timeout) { feed.timeout = 0; } if (!feed.retry) { feed.retry = 5; } feed.count = feed.count+1; feed.timeout = feed.timeout+feed.count*3000; if (feed.count < feed.retry) { setTimeout(function() {CL_getRssFeed(feed);},feed.timeout); } } }); }
	
	function CL_showRssFeed(feed,data) {
		
		var list = Builder.node('a',{ href : feed.link, id : 'feed', target : '_blank'},
								Builder.node('h4',feed.heading)
					);
		
		$(list).observe('mouseover',function(event){
				var el = Event.findElement(event,'a');
				CL_tooltipToggle(el,true,feed.tooltip_top,feed.tooltip_bottom);							 
				});
		$(list).observe('mouseout',function(event){ CL_tooltipToggle(false); });
		
		var tweet, title, pattern;
		
		$A(data).each(function(d){
			
			title = d.title;
			if (feed.strip) { title = title.replace(feed.strip,''); }
			
			tweet = Builder.node('span',title);															
			
			$(list).appendChild(tweet);
		
		});
		
		$(feed.id).appendChild(list);
		
		CL_resizeElements();
	}
	
	// JAVASCRIPT : JSONP AJAX REQUEST FOR PROTOTYPE
	// Required: Prototype.js
	Ajax.JSONRequest = Class.create(Ajax.Base, (function() { var id = 0, head = document.getElementsByTagName('head')[0] || document.body; return { 
		initialize: function($super, url, options) { $super(options); this.options.url = url; this.options.callbackParamName = this.options.callbackParamName || 'callback'; this.options.timeout = this.options.timeout || 10; this.options.invokeImmediately = (!Object.isUndefined(this.options.invokeImmediately)) ? this.options.invokeImmediately : true; if (!Object.isUndefined(this.options.parameters) && Object.isString(this.options.parameters)) { this.options.parameters = this.options.parameters.toQueryParams(); } if (this.options.invokeImmediately) { this.request();} }, 
		_cleanup: function() { if (this.timeout) { clearTimeout(this.timeout); this.timeout = null; } if (this.transport && Object.isElement(this.transport)) { this.transport.remove(); } }, 
		request: function() { var response = new Ajax.JSONResponse(this); var key = this.options.callbackParamName, name = '_prototypeJSONPCallback_' + (id++), complete = function() { if (Object.isFunction(this.options.onComplete)) { this.options.onComplete.call(this, response); } }.bind(this); this.options.parameters[key] = name; var url = this.options.url + ((this.options.url.include('?') ? '&' : '?') + Object.toQueryString(this.options.parameters)); 
		window[name] = function(json) { this._cleanup(); window[name] = undefined; if (Object.isFunction(this.options.onSuccess)) { response.status = 200; response.statusText = "OK"; response.setResponseContent(json); this.options.onSuccess.call(this, response); } complete(); }.bind(this); this.transport = new Element('script', { type: 'text/javascript', src: url }); if (Object.isFunction(this.options.onCreate)) { this.options.onCreate.call(this, response); } head.appendChild(this.transport); this.timeout = setTimeout(function() { this._cleanup(); window[name] = Prototype.emptyFunction; if (Object.isFunction(this.options.onFailure)) { response.status = 504; response.statusText = "Gateway Timeout"; this.options.onFailure.call(this, response); } complete(); }.bind(this), this.options.timeout * 1000); }, 
		toString: function() { return "[object Ajax.JSONRequest]"; } }; })());
	Ajax.JSONResponse = Class.create({ initialize: function(request) { this.request = request; }, request: undefined, status: 0, statusText: '', responseJSON: undefined, responseText: undefined, setResponseContent: function(json) { this.responseJSON = json; this.responseText = Object.toJSON(json); }, getTransport: function() { if (this.request) return this.request.transport; }, toString: function() { return "[object Ajax.JSONResponse]"; } });

	// JAVASCRIPT : TRACKING FOR FLASH PLAYER
	function CL_trackPlayer(tu) { var cu = window.location.href; if (cu.indexOf('?p=') > -1) { if (cu.indexOf('&') > -1) { cu = cu.substring(0,cu.indexOf('&')); } cu = cu.substring((cu.indexOf('?p=')+3)); } else { cu = cu.replace('http://',''); if (cu.indexOf('#/') > -1) { cu = cu.substring(cu.indexOf('#/')+1); } if (cu.indexOf('/') > -1) { cu = cu.substring(cu.indexOf('/')+1); } if (cu.lastIndexOf('/') == cu.length-1) { cu = cu.substring(0,cu.lastIndexOf('/')); }} if (tu.lastIndexOf('.') == tu.length-4) { tu = tu.substring(0,tu.lastIndexOf('.')); } tu = '/'+cu+tu; if (window._gaq) { _gaq.push(['_trackPageview',tu]); }}
	
	// JAVASCRIPT : DETECT MOBILE 
	function CL_isMobile() { return (/mobile|iphone|ipad|ipod|android|blackberry|playbook|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())); }
	
	// JAVASCRIPT : LOAD SCRIPT
	function CL_loadScript(url, callback){ var s = document.createElement("script"); s.type = "text/javascript"; if (s.readyState) { s.onreadystatechange = function() { if (s.readyState == "loaded" || s.readyState == "complete") { s.onreadystatechange = null; callback(); } }; } else { s.onload = function(){ callback(); }; } s.src = url; document.getElementsByTagName("head")[0].appendChild(s); }	

	// CUSTOM SCRIPTS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	// CUSTOM SCRIPTS > RESIZE //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	// JAVASCRIPT : RESIZER
	var resize = true;
	
	function CL_resizeElements() {
		
		CL_fullscreenResolution();		
		
		var vh = document.viewport.getHeight();
		var vw = document.viewport.getWidth();
	
		// content
		var vb = 30;
		var cih = $('content_inner').getHeight();
		var co = $('content_resize').cumulativeOffset();
		var cfh = $('content_footer').getHeight();
		var cd = vh-co.top-cfh;	
		if (cih > cd && resize === true) { 
			$('content_resize').setStyle({height:(cd-vb)+'px'}); 
		} else { 
			$('content_resize').setStyle({height:cih+'px'}); 
		}
		
		// scrolling
		if ($('content_resize_wrapper')) { 
			if (cih > cd && resize === true) {
				$('content_resize_wrapper').setStyle({height:(cd-vb)+'px'});	
				$('content_resize_scrollbar_track').setStyle({height:((cd-vb))+'px'});	
			} else {
				$('content_resize_wrapper').setStyle({height:cih+'px'});
				$('content_resize_scrollbar_track').setStyle({height:cih+'px'});
			}
			if (scrollbar) { scrollbar.redraw(); }
		}
		
		// left bar
		var lth = $('leftnav').getHeight() + $('logo').getHeight();
		var mh = $('map').getHeight();
		var fh = 0; if ($('feed')) { fh = $('feed').getHeight(); }
		var sh = 0; if ($('slogan')) { sh = $('slogan').getHeight(); }
		var lbh = 0; if ($('bottom_left')) { lbh = $('bottom_left').getHeight(); }
		var ld = vh-lth-lbh;
		var mfsh = mh+fh+sh;
		var mfh = mh+fh;
		
		if (ld<mfsh) {
			if ($('slogan')) { $('slogan').hide(); }
			if ($('map')) { if (ld < mfh) { $('map').hide(); } else { $('map').show(); } }
			if ($('feed')) { if (ld < fh) { $('feed').hide(); } else { $('feed').show(); } }
		} else {
			if ($('feed')) { if (ld > fh) { $('feed').show(); } }
			if ($('map')) { if (ld > mfh) { $('map').show(); } }
			if ($('slogan')) { if (ld > mfsh) { $('slogan').show(); } }
		}
		
		if ($('bottom_left')) { if (vh-lth-5 < lbh) { $('bottom_left').hide(); } else { $('bottom_left').show(); } }
		
		// right bar
		CL_sidebarItemsInit();
		
	
	}
	
	document.observe('dom:loaded',CL_resizeElements);
	Event.observe(window,'resize',CL_resizeElements);
	
	// CUSTOM SCRIPTS > INIT //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	// JAVASCRIPT : INIT
	var objCurrentMenu = null;
	var mainClassName = '';
	var isMobile = false;

	function CL_startInit() {
		
		// mobile
		isMobile = CL_isMobile();
		
		// home
		CL_navHome();
		
		// newsletter
		CL_navNewsletter();
		
		// leftnav
		CL_navLeft();		
		CL_positionMenuArrow();
		
		// subnav
		CL_navSub();
		
		// content
		CL_contentLinks();

		// backgrounds
		CL_navBackgrounds();		
		
	}
	
	document.observe('dom:loaded',CL_startInit);
	
	// CUSTOM SCRIPTS > NAV + LINKS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	// JAVASCRIPT : HOME NAV
	function CL_navHome() {
		
		if ($('logo')) {
			
			$('logo').observe('click',function(event){
					
					$('logo').stopObserving('mouseover');
					$('logo').stopObserving('mouseout');
					
					CL_tooltipToggle(false);
					
					var url = $('logo').readAttribute('href');
					if (url == '/' || url == '') { url = '/home'; }
					CL_getContent(url);
					
					$('logo').observe('mouseout',function(event){
						
						$('logo').observe('mouseover',function(event){ CL_tooltipToggle($('logo'),true,tooltip_home_top,tooltip_home_bottom); });			
						$('logo').observe('mouseout',function(event){ CL_tooltipToggle(false); });
					});
					
					Event.stop(event);
					
				});
			
			$('logo').observe('mouseover',function(event){ CL_tooltipToggle($('logo'),true,tooltip_home_top,tooltip_home_bottom); });
			$('logo').observe('mouseout',function(event){ CL_tooltipToggle(false); });

		}
	}
	
	// JAVASCRIPT : NEWSLETTER NAV
	function CL_navNewsletter() {
		
		if ($('newsletter')) {
			
			$('newsletter').observe('click',function(event){
					
					$('newsletter').stopObserving('mouseover');
					$('newsletter').stopObserving('mouseout');
					
					CL_tooltipToggle(false);
					
					var url = $('newsletter').readAttribute('href');
					if (url == '/' || url == '') { url = '/newsletter'; }
					CL_getContent(url);
					
					$('newsletter').observe('mouseout',function(event){
						
						$('newsletter').observe('mouseover',function(event){ CL_tooltipToggle($('newsletter'),true,tooltip_newsletter_top,tooltip_newsletter_bottom); });			
						$('newsletter').observe('mouseout',function(event){ CL_tooltipToggle(false); });
					});
					
					Event.stop(event);
					
				});
			
			$('newsletter').observe('mouseover',function(event){ CL_tooltipToggle($('newsletter'),true,tooltip_newsletter_top,tooltip_newsletter_bottom); });
			$('newsletter').observe('mouseout',function(event){ CL_tooltipToggle(false); });

		}
	}
	
	// JAVASCRIPT : LEFT NAV
	function CL_navLeft() {
		
		if ($('leftnav')) {
			
			var menus = $$('#leftnav a');
			
			menus.each(function(menu){
				if ($(menu).up('li').className == 'current') { objCurrentMenu=$(menu).up('li'); }
				menu.observe('click',function(event){
					
					var url = Event.findElement(event,'a').readAttribute('href');				
					CL_getContent(url);
					
					Event.stop(event);
					
				});
			});
		}
	}
	
	function CL_navLeftCurrent(id) {

		if (objCurrentMenu) { objCurrentMenu.removeClassName('current'); }

		if ($('tree_item_1_'+id)) {
					
			objCurrentMenu = $('tree_item_1_'+id);
			objCurrentMenu.addClassName('current');
			
		} else {
			objCurrentMenu = null;	
		}
		
		CL_positionMenuArrow();
	}
	
	// JAVASCRIPT : SUB NAV
	var objCurrentMenuSub = null;
	
	function CL_navSubCurrent(id) {

		if (objCurrentMenuSub) { objCurrentMenuSub.removeClassName('current'); }

		if ($('tree_item_1_'+id)) {		
			
			objCurrentMenuSub = $('tree_item_1_'+id);
			objCurrentMenuSub.addClassName('current');
			
		}
	}
	
	function CL_navSub() {
		
		if ($('subtree_01')) {
		
			var submenus = $$('#subtree_01 a');
			
			submenus.each(function(submenu){
				if ($(submenu).up('li').className == 'current') { objCurrentMenuSub=$(submenu).up('li'); }
				submenu.observe('click',function(event){
					
					var el = Event.findElement(event,'a');
					
					CL_navSubCurrent(el.readAttribute('id'));
		
					var url = el.readAttribute('href');					
					CL_getContent(url);
					
					Event.stop(event);
				});
			
			});
		}
		
	}
	
	// JAVASCRIPT : POSITION MENU ARROW
	function CL_positionMenuArrow() {
		var objTop = -25;
		var speed = 0.1;
		if (objCurrentMenu) {
			var o = objCurrentMenu.cumulativeOffset();
			objTop = o.top-5;
			speed = 0.3;
		}
		new Effect.Move('leftnav_arrow',{x:214,y:objTop,mode:'absolute',duration:speed});
	}
	
	// CUSTOM SCRIPTS > CONTENT //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	var hash;
	var contentloading = false;
	
	// JAVASCRIPT : HASH CHANGE: SWFAddress
	function CL_hashChange(event) {
		
		if (contentloading === false) {
			
			var url, alias = null, itemID = null, language = null, subpage = null;
			
			hash = SWFAddress.getValue();
			
			if (hash !== '' && hash.length > 1) {
				
				hash = hash.substring(1,hash.length);
			
				var chunks = hash.split('/');
				if (chunks[0].length == 2) {
					language = chunks[0];
					alias = chunks[1];
					if (chunks[2]) { itemID = chunks[2]; }
					if (chunks[3]) { subpage = chunks[3]; }
				} else {
					alias = chunks[0];
					if (chunks[1]) { itemID = chunks[1]; }
					if (chunks[2]) { subpage = chunks[2]; }
				}
				
				url = link_page;
				if (alias !== null) { url += '?'+url_query_alias+'='+alias; }
				if (itemID !== null) { url += '&'+url_query_item+'='+itemID; }
				if (language !== null) { url += '&'+url_query_language+'='+language; }
				if (subpage !== null) { url += '&'+url_query_subpage+'='+subpage; }

				CL_getContent(url);		
			}
		
		} else {

			contentloading = false;
		}
	}
	
	document.observe('dom:loaded',function() {
		SWFAddress.addEventListener(SWFAddressEvent.CHANGE, CL_hashChange);
	});
	
	// JAVASCRIPT : GET CONTENT BY AJAX REQUEST
	var timer = null;
	function CL_getContent(url) {
		
		// stop slideshow
		if (window.SlideShows[0] && SlideShows[0].playing) { SlideShows[0].playStop(false,$('slideshow_controls_playstop0')); }
		resize = true;
		
		//	variables
		var file = '/index.php', pars, gaURL = '';
		if (url.indexOf('.php') > -1) {
			file = url.substring(0,url.indexOf('?'));
			if (file.indexOf('/') != 0) { file = '/'+file; }
			pars = url.toQueryParams();	
			if (pars[url_query_language]) { gaURL = '/'+pars[url_query_language]; }
			if (pars[url_query_alias]) { gaURL = '/'+pars[url_query_alias]; }
			if (pars[url_query_item]) { gaURL = '/'+pars[url_query_item]; }
			if (pars[url_query_subpage]) { gaURL = '/'+pars[url_query_subpage]; }
			pars = Object.toQueryString(pars);			
		} else {
			var alias = null, itemID = null, language = null, subpage = null;
			url = url.replace('://','');
			var chunks = url.split('/');
			if (chunks.length > 0) {
				if (chunks[0].indexOf('http') > -1 || chunks[0].length == 2 || chunks[0] == '') {
					if (chunks[1].length == 2) {
						language = chunks[1];
						alias = chunks[2];
						if (chunks[3]) { itemID = chunks[3]; }
						if (chunks[4]) { subpage = chunks[4]; }
					} else {
						alias = chunks[1];
						if (chunks[2]) { itemID = chunks[2]; }
						if (chunks[3]) { subpage = chunks[3]; }
					}
				} else {
					alias = chunks[0];
					if (chunks[1]) { itemID = chunks[1]; }
					if (chunks[2]) { subpage = chunks[2]; }
				}
			}
			var hash = new Hash();
			if (alias !== null) { hash.set(url_query_alias, alias); gaURL = '/'+alias; }
			if (itemID !== null) { hash.set(url_query_item, itemID); gaURL += '/'+itemID; }
			if (language !== null) { hash.set(url_query_language, language); gaURL = '/'+language + gaURL; }
			if (subpage !== null) { hash.set(url_query_subpage, subpage); gaURL += '/'+subpage; }
			pars = hash.toQueryString();
		}

		// get content
		var getContent = new Ajax.Request(file,{ 
											method: 'get', 
											parameters: pars,
											onCreate: function() {

												timer = setTimeout(function(){
														
													if (windowclosed == true) {
														
															if ($('tooltip_loading')) { $('tooltip_loading').setStyle({display:'block'}); }
													
													} else {
															
														if ($('subnav')) { $('subnav').update('<span id="loading"></span><img src="/img/bol_loading_ani.gif" class="loading_ani" width="155" height="20" />'); }
													}
												},750);
												
											},
											onSuccess: function(oReq) {
												
												clearTimeout(timer);
												
												if ($('tooltip_loading')) { $('tooltip_loading').hide(); }
												
												$('main').update(oReq.responseText);
												
												//if (window._gaq) { _gaq.push(['_trackPageview',gaURL]); }
												
												if (windowclosed == true) {
													Effect.Appear('main',{duration:0.5,afterFinish:function(){															
															CL_contentRedraw();	
														}});
													Effect.Appear('leftnav_arrow',{duration:0.5});
													windowclosed = false;
												
												} else {
													CL_contentRedraw();
												}																						
												
											},
											onFailure: function(oReq) {
												
												if (oReq.status == 404) {
													
													clearTimeout(timer);
												
													if ($('tooltip_loading')) { $('tooltip_loading').hide(); }
													
													//$('main').update(oReq.responseText);
													
													if (windowclosed == true) {
														Effect.Appear('main',{duration:0.5,afterFinish:function(){															
																CL_contentRedraw();	
															}});
														Effect.Appear('leftnav_arrow',{duration:0.5});
														windowclosed = false;
													
													} else {
														CL_contentRedraw();
													}
												}
											}
							});
	}
	
	// JAVASCRIPT : CONTENT REDRAW
	var interval = null, intervaltimes = 0;
	function CL_contentRedraw() {
		CL_resizeElements();
		CL_emailObfuscation();
		CL_navSub();
		CL_contentLinks();
		if ($('content_inner').down('video')) { setTimeout(function() { playersVideoJS = VideoJS.setup('All');},100); }
		interval = setInterval('CL_movieRedraw()',500);
	}
	
	// JAVASCRIPT : MOVIE DETECT
	
	function CL_movieRedraw() {
		
		if (intervaltimes > 7) { clearInterval(interval); }
		
		if ($('content_inner').select('object') || $('content_inner').select('embed')) { CL_resizeElements(); clearInterval(interval); }
		
		intervaltimes++;
	}
	
	// JAVASCRIPT : CONTENT LINKS
	function CL_contentLinks() {
		
		if ($('content_inner')) {
			
			var linkfound = false;
			
			var links = $$('#content_inner a');
			
			links.each(function(linkitem){
				
				linkfound = false;
				
				var href = $(linkitem).readAttribute('href');
				
				if (href.indexOf('mailto') == -1) {
					
					if (href.indexOf(documents_path) > -1 && href.lastIndexOf('.') == href.length-4) {
						
						linkfound = false;
						
					} else {
					
						if (href.indexOf('http') === 0) {
	
							if (href.indexOf(http_host) > -1) {
								
								linkfound = true;
								
							}
						
						} else {
							
							if (href.indexOf('#') == -1) {
							
								linkfound = true;	
							}
						}
					}
				}
				
				if (linkfound === true) {

					linkitem.observe('click',function(event){
					
						var url = Event.findElement(event,'a').readAttribute('href');
						
						CL_getContent(url);
						
						Event.stop(event);
					
					});				
				
				}
				
			});
		}
	}
	
	// CUSTOM SCRIPTS > LAYER //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	// JAVASCRIPT : CLOSE LAYER WINDOW
	var windowclosed = false;
	function CL_windowClose() {
		$('main').fade({duration:0.5});
		$('leftnav_arrow').fade({duration:0.5});
		windowclosed = true;
		if (objCurrentMenu) {
			if ($(objCurrentMenu)) { $(objCurrentMenu).removeClassName('current'); }
			objCurrentMenu = null;
		}
	}

	// CUSTOM SCRIPTS > TOOLTIP //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	// JAVASCRIPT : TOOLTIP
	var ttMfx = null, ttMAfx = null, ttFx = null, ttAfx = null, ttTo;
	
	function CL_tooltipHide() {
		$('tooltip').hide();
		$('tooltip_arrow').hide();
	}
	
	function CL_tooltipToggle() {

		if (isMobile) { return; }

		var obj = false;
		if (arguments[0]) { obj = arguments[0]; }

		// hide tooltip
		if (obj==false) {
			if (windowclosed == false) {
				if (ttFx != null) { ttFx.cancel(); ttFx = null; }
				if (ttAfx != null) { ttAfx.cancel(); ttAfx = null; }
				ttMfx = new Effect.Appear('main',{duration:0.5,delay:0.5,afterFinish:function(){ if ($('content_inner').down('video')) { var h = $('content_inner').down('video').readAttribute('height'); $('content_inner').down('video').setStyle({height:h+'px'}); }}});
				ttMAfx = new Effect.Appear('leftnav_arrow',{duration:0.5,delay:0.5});
				
			}
			ttTo = setTimeout(CL_tooltipHide,100);
			
		// show	tooltip
		} else {
			clearTimeout(ttTo);
			if (windowclosed == false) {
				if (ttMfx != null) { ttMfx.cancel(); ttMfx = null; $('main').hide(); } else { $('main').fade({duration:0.5}); }
				if (ttMAfx != null) { ttMAfx.cancel(); ttMAfx = null; $('leftnav_arrow').hide(); } else { $('leftnav_arrow').fade({duration:0.5}); }
			}
			if (arguments[2]) { $('tooltip_top').update(arguments[2]) } else { $('tooltip_top').update(); }
			if (arguments[3]) { $('tooltip_bottom').update(arguments[3]) } else { $('tooltip_bottom').update(); }
			if (arguments[4]) { 
				$('tooltip_top').className = arguments[4]; 
				$('tooltip_bottom').className = arguments[4]; 
			} else { 
				$('tooltip_top').className = ''; 
				$('tooltip_bottom').className = ''; 
			}
			var l = parseInt($(obj).getHeight()/2);
			var t = parseInt($('tooltip').getHeight()/2);
			var o = $(obj).cumulativeOffset();
			var tt = parseInt(o.top-t+l);
			var vh = document.viewport.getHeight();
			var td = vh-(t*2);
			if (tt < 0) { tt = 20; }
			if (tt > td) { tt = td-20; }
			var lt = parseInt(o.top+l-12);
			if (arguments[1] == false) {
				$('tooltip').addClassName('right');
				$('tooltip_arrow').addClassName('right');
			} else {
				$('tooltip').removeClassName('right');
				$('tooltip_arrow').removeClassName('right');
			}
			$('tooltip').setStyle({top:tt+'px'});			
			$('tooltip_arrow').setStyle({top:lt+'px'});
			ttFx = Effect.Appear('tooltip',{duration:0.5});
			ttAfx = Effect.Appear('tooltip_arrow',{duration:0.5});
		}
		
	}
	
	// CUSTOM SCRIPTS > BACKGROUND + FULLSCREEN //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	function CL_navBackgrounds() {
		
		var num = 0;
		backgrounds.each(function(background){
			if (num > 0) {	$('backgrounds_numbers').appendChild(document.createTextNode('.')); }
			$('backgrounds_numbers').appendChild(
				Builder.node('a',{href:'#',id:String.interpret('backgrounds_'+num)},String.interpret(num+1))
			);
			if (num == fsIndex) { $('backgrounds_'+num).addClassName('current'); }
			
			$('backgrounds_'+num).observe('click',(function(event){
				$('backgrounds_'+fsIndex).removeClassName('current');															
				this.addClassName('current');
				var el = Event.findElement(event,'a');
				fsIndex = parseInt(el.id.replace('backgrounds_',''));
				CL_fullscreenResolution();
				Event.stop(event);
				}));
			$('backgrounds_'+num).observe('mouseover',(function(event){ var el = Event.findElement(event,'a'); CL_tooltipToggle(el,true,background[1],background[2]);Event.stop(event); }));
			$('backgrounds_'+num).observe('mouseout',(function(event){ CL_tooltipToggle(false);Event.stop(event); }));
			num++;
		});
	}

	// JAVASCRIPT : FULLSCREEN IMAGE	

	var fsBg, fsImage, fsIndex = 0;

	function CL_fullscreenResolution() {

		fsBg = $('bg').down('img');
		
		var vW = document.viewport.getWidth();
		var vH = document.viewport.getHeight();
		var fx = '_1024';
		
		if (vW > 1024 || vH > 683) { fx = '_1280'; } 
		if (vW > 1280 || vH > 853) { fx = '_1440'; }
		if (vW > 1440 || vH > 960) { fx = '_1680'; }
		if (vW > 1680 || vH > 1120) { fx = '_1920'; }
	
		if (vW < vH) { fsBg.setStyle({height:'100%'}); } else { fsBg.setStyle({height:'auto'}); }
	
		var src = backgrounds[fsIndex][0].replace('.jpg',fx+'.jpg');

		if (fsBg.src != src) {
			fsImage = new Image();
			fsImage.onload = function() { fsBg.src = src; };
			fsImage.src = src;
		}
		
	}
	
	// JAVASCRIPT : FULLSCREEN WINDOW
	var wHeight = 0, wWidth = 0, wX = 0, wY = 0;
	function CL_fullscreenWindow() {
		
		if (wWidth == 0) { 

			if (window.screenLeft) { wX = window.screenLeft; wY = window.screenTop; } else { wX = window.screenX; wY = window.screenY; }
			if (!window.innerWidth) { wWidth = document.body.clientWidth; wHeight = document.body.clientHeight; } else { wWidth = window.outerWidth; wHeight = window.outerHeight; }
		
			window.moveTo(0,0);
			if (window.screenX && window.screenX !== 0) { window.moveTo(1,1); }
			
			window.resizeTo(screen.availWidth,screen.availHeight); 

		} else {
		
			window.resizeTo(wWidth,wHeight);
			window.moveTo(wX,wY);
			wWidth = 0;
			
			setTimeout(CL_rightbarShow,1000);
		}
		
	}
	
	// CUSTOM SCRIPTS > SIDEBAR //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	// JAVASCRIPT : SIDEBAR ITEMS
	var siCS, siS, rsW, siTw, siTh, siNum=1, siInit = true;
	
	function CL_sidebarItemsInitVaribles() {
		siCS = 1;
		siS = 1;
		rsW = 150;
		siTw = 100;
		siTh = 55;
		siH = 114;
		if (siNum == 3) {
			siTw = 150;
			siTh = 75;
			siH = 68;
		}
	}
	
	function CL_sidebarItemsInit() {
	
		if (siInit === false) { siInit = true; return; }
	
		CL_sidebarItemsInitVaribles();
	
		var vh = document.viewport.getHeight();
		var rbh = $('bottom_right').getHeight();
		var rch = $('bottom_controls').getHeight();
		var dh = vh-rbh-rch;		
		var pq = sidebar_items.length;	
		var pqs = Math.floor(dh/siH);
		siS = Math.ceil(pq/pqs);
		var i=1, num = 1, section=1, txt = '';
	
		// panels
		$('sidebar_items').update();
	
		$('sidebar_items').appendChild(
			Builder.node('div',{id:String.interpret('sidebar_items_'+section),className:'sidebar_items_panel'})			   
		);
	
		$A(sidebar_items).each(function(sideitem){
			
			if (num>pqs) {
				num = 1;
				section++;
				$('sidebar_items').appendChild(
					Builder.node('div',{id:String.interpret('sidebar_items_'+section),className:'sidebar_items_panel'})			   
				);
				$('sidebar_items_'+section).setStyle({left:(section-1)*rsW+'px'});
			}
			
			$('sidebar_items_'+section).appendChild(
				Builder.node('a',{href:sideitem[4],id:String.interpret('sidebar_items_item_'+i)},[
					Builder.node('img',{src:sideitem[0],width:siTw,height:siTh}),
					sideitem[1]
					])		   
			);
			
			if (siNum == 3) { 
				$('sidebar_items_item_'+i).observe('mouseover',(function(event){ var el = Event.findElement(event,'a'); CL_tooltipToggle(el,false,sideitem[3],sideitem[2],'partner'); }));
			} else {
				$('sidebar_items_item_'+i).observe('mouseover',(function(event){ var el = Event.findElement(event,'a'); CL_tooltipToggle(el,false,sideitem[3],sideitem[2]); }));
			}
			$('sidebar_items_item_'+i).observe('mouseout',(function(event){ CL_tooltipToggle(false); }));
			
			$('sidebar_items_item_'+i).observe('click',(function(event){  
					
					var el = Event.findElement(event,'a');

					Event.stopObserving(el,'mouseover');
					Event.stopObserving(el,'mouseout');
					
					CL_tooltipToggle(false);
					
					siInit = false;
					var url = el.readAttribute('href');				
					CL_getContent(url);
					
					setTimeout(function() { siInit = false; CL_resizeElements(); },1000);
					
					el.observe('mouseout',function(event){
						
						if (Event.pointerX(event) < $('sidebar_right').offsetLeft) {
						
							var el = Event.findElement(event,'a');
							
							
							if (siNum == 3) { 
								el.observe('mouseover',(function(event){ var el = Event.findElement(event,'a'); CL_tooltipToggle(el,false,sideitem[3],sideitem[2],'partner'); }));
							} else {
								el.observe('mouseover',(function(event){ var el = Event.findElement(event,'a'); CL_tooltipToggle(el,false,sideitem[3],sideitem[2]); }));
							}
							el.observe('mouseout',(function(event){ CL_tooltipToggle(false); }));
						}
						
					});
					
					Event.stop(event);
					

				})				
			);
			
			num++;
			i++;
			
		});
		
		// controls
		$('sidebar_items_controls').update();
		$('sidebar_items_controls').appendChild(
			Builder.node('ul',{id:'sidebar_items_numbers'})	
		);
		var i = 0;
		for (i;i<section;i++) {
			if (i==0) { 
				$('sidebar_items_numbers').appendChild(
					Builder.node('li',{id:String.interpret('sidebar_items_no_'+(i+1)),className:'current'},
						Builder.node('a',{href:'#'},i+1)
					)	
				);
			} else {
				$('sidebar_items_numbers').appendChild(
					Builder.node('li',{id:String.interpret('sidebar_items_no_'+(i+1))},
						Builder.node('a',{href:'#'},i+1)
					)	
				);	
			}
		}
		
		if (siS > 1) {
			$('sidebar_items_controls').appendChild( Builder.node('a',{href:'#',id:'sidebar_items_previous',className:'bottom_previous'}) );
			$('sidebar_items_controls').appendChild( Builder.node('a',{href:'#',id:'sidebar_items_next',className:'bottom_next'}) );
			CL_sidebarItemsControlsObserve();
		} else {
			if ($('sidebar_items_previous')) { $('sidebar_items_previous').hide(); }	
			if ($('sidebar_items_next')) { $('sidebar_items_next').hide(); }
			if ($('sidebar_items_previous_disabled')) { $('sidebar_items_previous_disabled').show(); } else {
				$('sidebar_items_controls').appendChild( Builder.node('span',{id:'sidebar_items_previous_disabled',className:'bottom_previous_disabled'}) );	
			}
			if ($('sidebar_items_next_disabled')) { $('sidebar_items_next_disabled').show(); } else { 
				$('sidebar_items_controls').appendChild( Builder.node('span',{id:'sidebar_items_next_disabled',className:'bottom_next_disabled'}) );
			}
		}
		
	}
	
	// JAVASCRIPT : SIDEBAR ITEMS > SLIDE
	function CL_sidebarItemsSlide(direction) {
		
		if (siS==1) { return; }
		
		var move = 0;
		var speed = 0.5;
		var siCSOld = siCS;
		
		// next
		if (direction > 0) {
			siCS++;
			if (siCS > siS) { siCS = 1; move = (siS-1)*rsW; speed = 0.1; } else { move = -rsW; }
		// previous	
		} else {			
			siCS--;
			if (siCS < 1) { siCS = siS; move = (siS-1)*-rsW; speed = 0.1; } else { move = rsW; }
		}
		
		CL_sidebarItemsControlsStopObserve();

		var i = 0;
		for (i;i<siS-1;i++) {
			new Effect.Move('sidebar_items_'+(i+1),{x:move,duration:speed});
		}
		new Effect.Move('sidebar_items_'+(i+1),{x:move,duration:speed,afterFinish:CL_sidebarItemsControlsObserve});
		
		if ($('sidebar_items_no_'+siCSOld)) { $('sidebar_items_no_'+siCSOld).removeClassName('current'); }
		if ($('sidebar_items_no_'+siCS)) { $('sidebar_items_no_'+siCS).addClassName('current'); }
		
	}
	
	// JAVASCRIPT : SIDEBAR ITEMS > EVENT HANDLING
	function CL_sidebarItemsControlsStopObserve() {
		if ($('sidebar_items_previous')) { $('sidebar_items_previous').stopObserving('click'); }
		if ($('sidebar_items_next')) { $('sidebar_items_next').stopObserving('click'); }
	}
	
	function CL_sidebarItemsControlsObserve() {
		if ($('sidebar_items_previous')) { $('sidebar_items_previous').observe('click',(function(event){ CL_sidebarItemsSlide(-1); Event.stop(event); })); }
		if ($('sidebar_items_next')) { $('sidebar_items_next').observe('click',(function(event){ CL_sidebarItemsSlide(1); Event.stop(event); })); }
	}
	
	// JAVASCRIPT : SIDEBAR ITEMS > SWITCH ITEMS
	function CL_sidebarItemsReset(obj,num,classname) {
		
		siNum = num;
		
		if (num < 10) { num = '0'+num; }
		
		if (window['sidebar_items_'+num]) {
		
			sidebar_items = window['sidebar_items_'+num];
			
			$('sidebar_items').update();
			$('sidebar_items_controls').update();
	
			$('sidebar_items').className = classname;
	
			$(obj).up().siblings().each(function(el){ el.removeClassName('current'); });
			$(obj).up().addClassName('current');
			
			CL_sidebarItemsInit();
		}
	}
	
	// JAVASCRIPT: RIGHTBAR
	function CL_rightbarShow() {
		
		var vw = document.viewport.getWidth();
		var rbw = $('sidebar_right').getWidth();
		var mw = $('main').getWidth();
		var ml = $('main').offsetLeft;
		var mwl = mw+ml;
		var rbl = $('sidebar_right').offsetLeft;
		
		var move = 0;
		var speed = 1;
	
		// slide out
		if (rbl < mwl) {
		
			clearTimeout(rbTo);
		
			move = mwl+rbw;
			
			$('sidebar_right').setStyle({left:rbl+'px'});
			$('sidebar_right_inner').setStyle({left:rbl+'px'});
			
			new Effect.Move('sidebar_right',{x:move,duration:speed,mode:'absolute',afterFinish:function(){Event.observe(window,'resize',CL_rightbarShow);}});
			new Effect.Move('sidebar_right_inner',{x:move,duration:speed,mode:'absolute',afterFinish:function(){Event.observe(window,'resize',CL_rightbarShow);}});
		
			Event.stopObserving(window,'resize',CL_rightbarShow);
		
		// slide in
		} else if (vw > mwl+rbw && rbl !== vw-rbw) {
			
			rvTo = setTimeout(CL_rightbarSlidein,1000);
			
			$('sidebar_right').setStyle({left:vw+'px'});
			$('sidebar_right_inner').setStyle({left:vw+'px'});
		}
		
	}
	
	document.observe('dom:loaded',CL_rightbarShow);
	Event.observe(window,'resize',CL_rightbarShow);
	
	var rbTo;
	function CL_rightbarSlidein() {
		
		clearTimeout(rbTo);
		
		var vw = document.viewport.getWidth();
		var rbw = $('sidebar_right').getWidth();
		
		var move = vw-rbw;
		var speed = .3;
		
		new Effect.Move('sidebar_right',{x:move,duration:speed,mode:'absolute',afterFinish:function(){$('sidebar_right').setStyle({left:'auto',right:'0'});Event.observe(window,'resize',CL_rightbarShow);}});
		new Effect.Move('sidebar_right_inner',{x:move,duration:speed,mode:'absolute',afterFinish:function(){$('sidebar_right_inner').setStyle({left:'auto',right:'0'});Event.observe(window,'resize',CL_rightbarShow);}});
	
		Event.stopObserving(window,'resize',CL_rightbarShow);

	}
	
	// CUSTOM SCRIPTS > PROJECTS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	// JAVASCRIPT: PROJECT > SUBNAV
	function CL_projectSubNav(obj,num) {
	
		var url = obj.readAttribute('href');					
		CL_getContent(url);
		
	}
	
	// JAVASCRIPT: PROJECT > SHOW SERIES
	function CL_projectSeries(num) {
		
		$('main').addClassName('slideshow');
		$('main').removeClassName('projects');
		
		if ($(slidesSettings.id)) { $(slidesSettings.id).show(); }
		if ($('project_3')) { $('project_3').hide(); }
		if ($('project_footer_3')) { $('project_footer_3').show(); }
		if ($('project_footer_3A')) { $('project_footer_3A').hide(); }
		if ($('project_footer_3B')) { $('project_footer_3B').show(); }
				
		CL_slideshowRestart(num);
		CL_resizeElements();
	}
	
	// CUSTOM SCRIPTS > SLIDESHOW //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	// JAVASCRIPT: SLIDESHOWS
	var sCs, sS, sW, sSw, sTw, sTwm;	
	
	function CL_slideshowReset() {
		sCs = 1;
		sS = 1; 
		sW = 0; 
		sSw = 0; 
		sTw = 60; 
		sTwm = 7;
	}
	
	function CL_slideshowInit() {
		
		CL_slideshowReset();
		
		var currentslides = SlideShows[0].imgs;
	
		sW = $('slideshow_numbers').getWidth();
		if (sW == 0) { setTimeout(CL_slideshowInit,200); return; }
		
		sSw = sThWidth*currentslides.length;
		var sSs = Math.floor((sW+sTwm)/(sTw+sTwm));
		sS = Math.ceil(currentslides.length/sSs);

		$('slideshow_controls').appendChild( Builder.node('a',{href:'#',id:'slideshow_previous',className:'slideshow_previous'}) );
		$('slideshow_controls').appendChild( Builder.node('span',{id:'slideshow_previous_disabled',className:'slideshow_previous_disabled'}) );
		$('slideshow_controls').appendChild( Builder.node('a',{href:'#',id:'slideshow_next',className:'slideshow_next'}) );
		$('slideshow_controls').appendChild( Builder.node('span',{id:'slideshow_next_disabled',className:'slideshow_next_disabled'}) );
		CL_slidershowControlsObserve();

		if (sS > 1) {
			$('slideshow_inner').setStyle({width:sSw+'px'});
			if ($('slideshow_previous')) { $('slideshow_previous').show(); }	
			if ($('slideshow_next')) { $('slideshow_next').show(); }
			if ($('slideshow_previous_disabled')) { $('slideshow_previous_disabled').hide(); }
			if ($('slideshow_next_disabled')) { $('slideshow_next_disabled').hide(); }			
		} else {
			$('slideshow_inner').setStyle({width:'auto'});
			if ($('slideshow_previous')) { $('slideshow_previous').hide(); }	
			if ($('slideshow_next')) { $('slideshow_next').hide(); }
			if ($('slideshow_previous_disabled')) { $('slideshow_previous_disabled').show(); }
			if ($('slideshow_next_disabled')) { $('slideshow_next_disabled').show(); }
		}
	}
	
	function CL_slidershowControlsStopObserve() {
		if ($('slideshow_previous')) { $('slideshow_previous').stopObserving('click'); }
		if ($('slideshow_next')) { $('slideshow_next').stopObserving('click'); }
	}
	
	function CL_slidershowControlsObserve() {
		if ($('slideshow_previous')) { $('slideshow_previous').observe('click',(function(event){ CL_slideshowSlide(-1); Event.stop(event); })); }
		if ($('slideshow_next')) { $('slideshow_next').observe('click',(function(event){ CL_slideshowSlide(1); Event.stop(event);	})); }
	}
	
	function CL_slideshowSlide(direction) {
		
		if (sS === 1) { return; }
		
		var move = 0;
		var speed = 0.5;
		var d = 0;
		
		var sL = $('slideshow_inner').offsetLeft;
		
		// next
		if (direction > 0) {
			sCs++;
			if (sCs > sS) {
				sCs = 1; move = sSw-sW-sTwm; speed = 0.1; 
			} else {
				move = -1*(sW+sTwm);
				d = sSw-sW+sL-sTwm;
				if (d < sW) { move = -d; }				
			}
		// previous	
		} else {			
			sCs--;
			if (sCs < 1) { 
				sCs = sS; move = -1*(sSw-sW-sTwm); speed = 0.1; 
			} else { 
				move = sW+sTwm;
				d = sW+sL;
				if (d > 0) { move = -1*sL; }
			}
		}

		CL_slidershowControlsStopObserve();
		
		new Effect.Move('slideshow_inner',{x:move,duration:speed,afterFinish:CL_slidershowControlsObserve});
		
		
	}
	
	function CL_slideshowCurrent() {
		
		var i = SlideShows[0].nextIndex+1;
		
		if ($('slideshow_controls_item_number0_'+i)) {
		
			var sL = $('slideshow_inner').offsetLeft;
			var sTl = $('slideshow_controls_item_number0_'+i).offsetLeft;
		
			if ((sTl+sL > sW) || (sTl == 0 && sL < 0)) {
				CL_slideshowSlide(1);	
			}		
			
		}
	}
	
	var css;
	var sThWidth = 67;
	var slides = [];
	var slides01 = [], slides02 = [], slides03 = [], slides04 = [], slides05 = [], slides06 = [], slides07 = [], slides08 = [], slides09 = [], slides10 = [];
	
	function CL_slideshowRestart(num) {
		
		resize = false;
		
		if (num < 10) { num = '0'+num; }
		
		SlideShows = [];		

		if (window['slides'+num][0]) {

			if ($('project_1')) { $('project_1').update(); }
			if ($('slideshow_footer')) { $('slideshow_footer').show(); $('slideshow_footer').update(); }
			if ($('slideshow_controls')) { 
				$('slideshow_controls').show(); $('slideshow_controls').update();
				$('slideshow_controls').appendChild(
					Builder.node('div',{id:String.interpret('slideshow_numbers')},
						Builder.node('div',{id:String.interpret('slideshow_inner'),className:'scroll'})
					)
				);
			}

			slides = window['slides'+num];
			slides.id = slidesSettings.id;
			slides.fixedsize = slidesSettings.fixedsize; 
			slides.controls = slidesSettings.controls; 
			slides.controls_id = slidesSettings.controls_id;
			slides.playpause = slidesSettings.playpause;
			slides.description = slidesSettings.description;
			slides.desc_prefix = slidesSettings.desc_prefix;
			slides.desc_prefix_off = slidesSettings.desc_prefix_off;
			slides.thumbs = slidesSettings.thumbs;
			slides.thumbs_dir = slidesSettings.thumbs_dir;
			slides.txt_stop = slidesSettings.txt_stop;
			slides.txt_play = slidesSettings.txt_play;
			slides.onstart = slidesSettings.onstart;
			slides.callback = slidesSettings.callback;

			css = new CL_SlideShow(slides);
		
		}
	}
