/*	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
	
	>	FUNCTIONS.JS 
		(c) 2010 plainworks [Alexander Glante]


		PLAINWORKS
		COMMUNICATION DESIGN
	
		WWW.PLNWRX.COM
		INFO@PLNWRX.COM


	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
	>	CONTENT SCRIPT
																																						*/
		
		function shop_image(name,image)
		{
			// createLightboxHTML('Motive', '<img src=\"media/character/08/img01.gif\" />' , 800, 600);	
			createLightboxHTML('Motive', '<span class=\"shop-motive-big\">'+name+'</span><br /><img src=\"motive/'+image+'" />' , 600, 424);
		}
		
		function shop_image2(name,image)
		{
			// createLightboxHTML('Motive', '<img src=\"media/character/08/img01.gif\" />' , 800, 600);	
			createLightboxHTML('Motive', '<span class=\"shop-motive-big\">'+name+'</span><br /><img src=\"motive/'+image+'" />' , 424, 600);
		}
		
		
		function hide_pw_image()
		{
			setVisibility(getLayerRef('pw_image'),false);
			setVisibility(getLayerRef('about'),true);
		}
		
		function hide_pw_image2()
		{
			setVisibility(getLayerRef('pw_image2'),false);
			setVisibility(getLayerRef('about'),true);
		}
		
		function pw_image(theImage)
		{
			change(theImage,'pw-image-content');
			setVisibility(getLayerRef('about'),false);
			setVisibility(getLayerRef('pw_image'),true);
		}
		
		function pw_image2(theImage)
		{
			change(theImage,'pw-image-content2');
			setVisibility(getLayerRef('about'),false);
			setVisibility(getLayerRef('pw_image2'),true);
		}
		
		
		function hide_avg()
		{
			setVisibility(getLayerRef('avg_header'),false);
			setVisibility(getLayerRef('service'),true);
			document.getElementById("avg_scroll").innerHTML="";
		}
		
		var avg_header;
		function create_avgScroll() {
			setVisibility(getLayerRef('service'),false);
			setVisibility(getLayerRef('avg_header'),true);			
			avg_header=new dms_scroll("avg_scroll","avg_header",490,290);
			avg_header.initAjax('avg.html');
			avg_header.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
		}
		
		
		function hide_disclaimer()
		{
			setVisibility(getLayerRef('disclaimer_header'),false);
			setVisibility(getLayerRef('contact'),true);
			document.getElementById("disclaimer_scroll").innerHTML="";;
		}
		
		var disclaimer_header;
		function create_disclaimerScroll() {
			setVisibility(getLayerRef('contact'),false);
			setVisibility(getLayerRef('disclaimer_header'),true);
			disclaimer_header=new dms_scroll("disclaimer_scroll","disclaimer_header",300,350);
			disclaimer_header.initAjax('disclaimer.html');
			disclaimer_header.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
		}
		
		
		
		/* HMMMMM */
		
		function overview(what) 
		{ 
		  hideContent();
		  {
		  obj = document.getElementsByTagName("div");
		  
					if (obj[what].style.display == 'block'){
						obj[what].style.display = 'none';
					} else {
						obj[what].style.display = 'block';
					}
		  }	
		}
		
		function destroyScrollContent(what){
			document.getElementById(what).style.display = "none";
			if (document.getElementById(what+"_overview")) document.getElementById(what+"_overview").innerHTML="";
		}
		
		function hideContent() 
		{  
		  destroyScrollContent('font');
		  destroyScrollContent('character');
		  destroyScrollContent('corporate');
		  destroyScrollContent('illustration');
		  destroyScrollContent('book');
		  destroyScrollContent('print');
		  destroyScrollContent('screen');
		  setVisibility(getLayerRef('service'),false);
		  setVisibility(getLayerRef('about'),false);
		  setVisibility(getLayerRef('contact'),false);
		  setVisibility(getLayerRef('main-shade'),false);
		}
		
		function service()
		{
			setVisibility(getLayerRef('main-shade'),true);
			change('service.html','service');
			setVisibility(getLayerRef('service'),true);
			
		}
		
		function about()
		{
			setVisibility(getLayerRef('main-shade'),true);
			change('about.html','about');
			setVisibility(getLayerRef('about'),true);
		}
		
		function about_image()
		{
			setVisibility(getLayerRef('main-shade'),false);
			setVisibility(getLayerRef('about'),false);
		}
		
		function contact()
		{
			setVisibility(getLayerRef('main-shade'),true);
			change('contact.html','contact');
			setVisibility(getLayerRef('contact'),true);
		}
		
		function imprint()
		{
			setVisibility(getLayerRef('main-shade'),true);
			change('imprint.html','contact');
			setVisibility(getLayerRef('contact'),true);
		}


/*	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
	>	BASIC SCRIPT
		simple dreamweaver functions (rollover etc.)																									*/
		
		
		function change(script,element) { 
			new Ajax.Updater(element, script, { method: 'get', requestHeaders:{ Accept:'text/html' }}); 
		} /* AJAX content loader */

		function MM_swapImgRestore() {
			var i,x,a=document.MM_sr; 
			for(i=0;i<a.length;i++){
				x=a[i]; x.src=x.oSrc;
			}
		}
		
		function MM_preloadImages() {
			var d=document; if(d.images){ 
				if(!d.MM_p) d.MM_p=new Array();
				var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
				if (a[i].indexOf("#")!=0){ 
					d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
				}
			}
		}
		
		function MM_findObj(n, d) {
			var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
				d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
			}
			if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
			for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
			if(!x && d.getElementById) x=d.getElementById(n); return x;
		}
		
		function MM_swapImage() {
			var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; 
			for(i=0;i<(a.length-2);i+=3)	
			if ((x=MM_findObj(a[i]))!=null){
				document.MM_sr[j++]=x; 
				if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
			}
		}
		
		function MM_reloadPage(init) {
			if (init==true) with (navigator) {
				if ((appName=="Netscape")&&(parseInt(appVersion)==4)){
					document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; 
				}
			}
			else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
		}
		
		MM_reloadPage(true);

		function MM_jumpMenu(targ,selObj,restore){ //v3.0
		  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
		  if (restore) selObj.selectedIndex=0;
		}

		function MM_jumpMenuGo(selName,targ,restore){ //v3.0
		  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
		}

/*	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
	>	LIGHTBOX WITH SCROLLBOX
		creates a lightbox object with an ajax-scrollbox inside																											*/


		var work_scroll;
		function showWork(work){
			/*
			
			*/
			var container=createLightboxContainer("PLNWRX_WORK","workBG",570,500);
			
			
			new Ajax.Request(work+"header.html", {
				method: 'get',
				onSuccess: function(transport) {
					work_scroll=new dms_scroll("workBG","work_scroll",565,413);
					document.getElementById("workBG").innerHTML=transport.responseText;
					work_scroll.initAjax(work+"cntd.html");
				},
				onFailure: function(transport) {alert("loding scroll content failed: "+url);}
			});
			
			
		}
		
		/*
		var avg_scroll;
		function showLB_small(lbs_content){
			var container=createLightboxContainer("PLNWRX_AVG","disclaimerBG",550,400);
			avg_scroll=new dms_scroll("disclaimerBG","avg_scroll",550,400);
			avg_scroll.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
			avg_scroll.initAjax(lbs_content);
		} */

		//scrollbox OHNE lightbox für die shoutbox	
		var shoutbox;
		function create_shoutScroll() {
			shoutbox=new dms_scroll("sb_show","shoutbox",290,280);
			shoutbox.initAjax('showshouts.php');
			shoutbox.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
			window.setInterval('shoutbox.setContentAjax("showshouts.php")',60000);
		}
		
		//scrollbox OHNE lightbox für facebook
		var facebook;
		function create_fbScroll() {
			facebook=new dms_scroll("fb-scroll","facebook",600,400);
			facebook.initAjax('facebook.php');
			facebook.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
			window.setTimeout("fb_spinner()", 2000);
		}
		
		function fb_spinner() {
			document.getElementById("fb_spinner").style.visibility='hidden';
		}
		
		//scrollbox OHNE lightbox für google+
		var google;
		function create_googleScroll() {
			facebook=new dms_scroll("google-scroll","google",600,400);
			facebook.initAjax('google.php');
			facebook.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
			window.setTimeout("g_spinner()", 2000);
		}
		
		function g_spinner() {
			document.getElementById("g_spinner").style.visibility='hidden';
		}
		
		//scrollbox OHNE lightbox für work-preview
		var work_preview_scroll;
		function book_previewScroll() {
			work_preview_scroll=new dms_scroll("book_overview","work_preview_scroll",-65,158);
			work_preview_scroll.initAjax('media/book.html');
			work_preview_scroll.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
		}
		
		function character_previewScroll() {
			work_preview_scroll=new dms_scroll("character_overview","work_preview_scroll",-65,158);
			work_preview_scroll.initAjax('media/character.html');
			work_preview_scroll.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
		}
		
		function corporate_previewScroll() {
			work_preview_scroll=new dms_scroll("corporate_overview","work_preview_scroll",-65,158);
			work_preview_scroll.initAjax('media/corporate.html');
			work_preview_scroll.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
		}
		
		function font_previewScroll() {
			work_preview_scroll=new dms_scroll("font_overview","work_preview_scroll",-65,158);
			work_preview_scroll.initAjax('media/font.html');
			work_preview_scroll.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
		}
		
		function illu_previewScroll() {
			work_preview_scroll=new dms_scroll("illustration_overview","work_preview_scroll",-65,158);
			work_preview_scroll.initAjax('media/illustration.html');
			work_preview_scroll.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
		}
		
		function print_previewScroll() {
			work_preview_scroll=new dms_scroll("print_overview","work_preview_scroll",-65,158);
			work_preview_scroll.initAjax('media/print.html');
			work_preview_scroll.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
		}
		
		function screen_previewScroll() {
			work_preview_scroll=new dms_scroll("screen_overview","work_preview_scroll",-65,158);
			work_preview_scroll.initAjax('media/screen.html');
			work_preview_scroll.setButtons("img/btn-up_inv.gif", "img/btn-dn_inv.gif", 14, 11);
		}
		

/*	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
	>	LAYER SCRIPT
		show/hide layers (visible/invisible)																											*/


		function getLayerRef ( id, document) {
			if (!document)
			document = window.document;
			
			if (document.layers) {
				for (var l = 0; l < document.layers.length; l++)
				if (document.layers[l].id == id)
				return document.layers[l];
				for (var l = 0; l < document.layers.length; l++) {
					var result = getLayerRef(id, document.layers[l].document);
					if (result)
					return result;
				}
				return null;
				} 
			else if (document.all) {
				return document.all[id];
			} 
			else if (document.getElementById) {
				return document.getElementById(id);
			}
		}
		
		function setVisibility( objLayer,  visible ) {
			if(document.layers){
				objLayer.visibility  = 
				(visible == true) ? 'show' : 'hide';
			} 
			else {
				objLayer.style.visibility = 
				(visible == true) ? 'visible' : 'hidden';
			}
		}
		
		function main_imageAll() {
			parent.document.illustration.src='img/spacer.gif';
		}
	
		function main_imageReset() {
			parent.document.illustration.src='img/spacer.gif';
		}
		
		function set_mainImage(name) {
			parent.document.illustration.src = name;
			setVisibility(parent.getLayerRef('self'),false);
		}
		
		
		function show_facebook() {
				create_fbScroll();
				setVisibility(getLayerRef('sb-shade'),true);
				setVisibility(getLayerRef('facebook'),true);		
		}
		
		function hide_facebook() {
				setVisibility(getLayerRef('sb-shade'),false);
				setVisibility(getLayerRef('facebook'),false);
				top.document.getElementById("fb-scroll").style.height="25px";
				top.document.getElementById("fb-scroll").innerHTML="<br />\n <img alt=\"\" src=\"img/spinner.gif\" id=\"fb_spinner\" width=\"16\" height=\"16\" />\n <br />\n";		
		}
		
		function show_google() {
				create_googleScroll();
				setVisibility(getLayerRef('sb-shade'),true);
				setVisibility(getLayerRef('google'),true);		
		}
		
		function hide_google() {
				setVisibility(getLayerRef('sb-shade'),false);
				setVisibility(getLayerRef('google'),false);
				top.document.getElementById("google-scroll").style.height="25px";
				top.document.getElementById("google-scroll").innerHTML="<br />\n <img alt=\"\" src=\"img/spinner.gif\" id=\"fb_spinner\" width=\"16\" height=\"16\" />\n <br />\n";		
		}
		
		function show_shoutbox() {
				create_shoutScroll();
				setVisibility(getLayerRef('sb-shade'),true);
				setVisibility(getLayerRef('sb_main'),true);		
				setVisibility(getLayerRef('sb_hide'),true);
				disableKeyboard();
				setContentAjax("sb_input","addshout.php");
				shoutbox.setContentAjax("showshouts.php");
		}
		
		function hide_shoutbox() {
				document.getElementById("sb_show").innerHTML="";;
				setVisibility(getLayerRef('sb-shade'),false);
				setVisibility(getLayerRef('sb_main'),false);
				setVisibility(getLayerRef('sb_hide'),false);
				enableKeyboard();
		}
		
		function setContentAjax(id,url){ //Neuen Inhalt per Ajax aus URL laden
			var container=document.getElementById(id);
			new Ajax.Request(url, {
				method: 'get',
				onSuccess: function(transport) {container.innerHTML=transport.responseText;},
				onFailure: function(transport) {alert("loding scroll content failed: "+url);}
			});
		}
		
		function submitShout(){
			var name=encodeURI(document.frm_shout.name.value);
			var message=encodeURI(document.frm_shout.message.value);
			setContentAjax("sb_input","addshout.php?name="+name+"&message="+message);
			window.setTimeout('shoutbox.setContentAjax("showshouts.php")',1000);
			//alert("grml");
		}
		
		function shoutRecount(){
			var shoutMaxLen=200;
			var len=document.frm_shout.message.value.length;
			if (len>shoutMaxLen){
				document.frm_shout.message.value=document.frm_shout.message.value.substring(0,shoutMaxLen);
				len=document.frm_shout.message.value.length;
			}
			
			document.getElementById("shout_chars").innerHTML=(shoutMaxLen-len);
		}
		
		
/*	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
	>	CLOCK SCRIPT
		needed for the big clock (if typing C)																											*/


		var clockStart = null;
	
		function initClock() {
			clockStart = setInterval("time();",1000);		
		}
	
		function time() {
			var now = new Date();
			var gmtHours = now.getTimezoneOffset()/-60;
			hours = now.getHours();
			minutes = now.getMinutes();
			seconds = now.getSeconds();
		
			if (seconds<10) seconds="0"+seconds;
			if (minutes<10) minutes="0"+minutes;
			if (hours<10) hours="0"+hours;
			if (gmtHours<0) gmtHours= +gmtHours;
			if (gmtHours>0) gmtHours="+" +gmtHours;	
			
			document.getElementById('time').innerHTML = hours+"&#160;"+minutes+"&#160;"+seconds;
			document.getElementById('gmt').innerHTML = gmtHours;
		}

/*	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
	>	DATE SCRIPT
		displays time and date on the main-page																											*/
		
	
/*		window.setTimeout("showTime()",1000);
		
		dayname = new Array("SUN","MON","TUE","WED","THU","FRI","SAT");
		
		function showTime() {
			
			var now = new Date();
			var day = now.getDate();
			var month = now.getMonth() + 1;
			var year = now.getYear();
			var gmtHours = now.getTimezoneOffset()/-60;
			
			if (year < 2000) year = year + 1900;
			if (gmtHours<0) gmtHours= +gmtHours;
			if (gmtHours>0) gmtHours="+" +gmtHours;	
	
			var hour = now.getHours();
			var minute = now.getMinutes();
			var seconds = now.getSeconds();
			var weekday = now.getDay();
			var preday = ((day < 10) ? "-0" : "-");
			var premonth = ((month < 10) ? "-0" : "-");
			var prehour = ((hour < 10) ? "0" : "");
			var preminute = ((minute < 10) ? ":0" : ":");
			var presecond = ((seconds < 10) ? ":0" : ":");
			var date = year + premonth + month + preday + day ;
			var time = prehour + hour + preminute + minute + presecond + seconds + " GMT" + gmtHours;
			var msnow = dayname[weekday] + "&#160;&#160;"  + date + "<br />" + time;
			
			document.getElementById('date').innerHTML = msnow
			
			var timer=setTimeout("showTime()",1000)
		}
		
/*	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
	>	SCREENSAVER SCRIPT
		start the screensaver after a time (timeout) of doing nothing																					*/	
	
	
		var timeout=1800;//3000;
		var inactivity=0;
		var screensaverTimer=null;
		var idleTimer=null;
		//var locked=false;
		var screensaverEnabled=true;
		
		function enableScreensaver(){screensaverEnabled=true; inactivity=0;}
		function disableScreensaver(){screensaverEnabled=false;}
		
		function initScreensaver(){
			idleTimer=setInterval("screensaverUpdate();",1000);
			document.onmousemove=function(){screensaverReset();}; 
			document.onkeydown=function(){screensaverReset();};
			
		}
		
		function screensaverStart(){
			keyboard_resetAll();
			setVisibility(getLayerRef('main-shade'),true);	
			setVisibility(getLayerRef('counter'),true);
			clearInterval(idleTimer); idleTimer=null;
			screensaverTimer=setInterval("screensaverUpdate();",100);
			locked=true;
			setTimeout("locked=false;",1000);
		}
		
		function screensaverUpdate(){
			if (screensaverTimer==null)inactivity+=10; 
			else {
				inactivity++;
				//update text
				//inactivity=parseInt(inactivity);
				var milis=inactivity%10;
				var seconds=parseInt(inactivity/10);
				var minutes=parseInt(seconds/60); seconds=seconds%60;
				var hours=parseInt(minutes/60); minutes%=60
				
				if (seconds<10) seconds="0"+seconds;
				if (minutes<10) minutes="0"+minutes;
				if (hours<10) hours="0"+hours;
				
				document.getElementById('countertext').innerHTML=hours+"&#160;"+minutes+"&#160;"+seconds+"."+milis;//inactivity;
			}
			if (inactivity>=timeout && screensaverTimer==null && screensaverEnabled) screensaverStart();
		}
		
		function screensaverStop(){
			if (screensaverTimer!=null){ //wenn screensaver aktiv
				clearInterval(screensaverTimer); screensaverTimer=null;
				idleTimer=setInterval("screensaverUpdate();",1000);
				setVisibility(getLayerRef('main-shade'),false);
				setVisibility(getLayerRef('counter'),false);	
			}
		}
		
		function screensaverReset(){
			//if (locked) return;
			if (screensaverTimer==null) inactivity=0;
			//screensaverStop();
		}

/*	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
	>	QUOTES SCRIPT
		display a random quote																															*/


		var quotes = new Array()
		var author = new Array()
		
		quotes[0] = "One should respect public opinion in so far as is necessary to avoid starvation and to keep out of prison.";
		author[0] = "Bertrand Russell";
		
		quotes[1] = "Designers are meant to be loved, not to be understood.";
		author[1] = "Fabian Barall";
		
		quotes[2] = "If you think it&#8217;s expensive to hire a professional to do the job, wait until you hire an amateur.";
		author[2] = "Red Aidar";
		
		quotes[3] = "I had a monumental idea this morning, but I didn&#8217;t like it.";
		author[3] = "Samuel Goldwyn";
		
		quotes[4] = "God is to be found in the details.";
		author[4] = "Aby Warburg";
		
		quotes[5] = "Designers are not highly paid cake decorators.";
		author[5] = "Spencer Murell";
		
		quotes[6] = "You cannot not communicate.";
		author[6] = "Paul Watzlawick";
		
		quotes[7] = "It&#8217;s the detail, that makes a project shine!";
		author[7] = "Unknown";
	
		quotes[8] = "Enthusiasm is excitement with inspiration, motivation, and a pinch of creativity.";
		author[8] = "Bo Bennett";
		
		quotes[9] = "A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.";
		author[9] = "Douglas Adams";
		
		quotes[10] = "The details are not the details. They make the design.";
		author[10] = "Charles Eames";
		
		quotes[11] = "The client may be king, but he&#8217;s not the art director.";
		author[11] = "R. Glitschka";
		
		quotes[12] = "Rules can be broken, but never ignored.";
		author[12] = "David Jury";
		
		quotes[13] = "Here&#8217;s how we work. Somebody calls up with a project; we do some stuff; and the money follows.";
		author[13] = "Tim Brennan";
		
		quotes[14] = "However beautiful the strategy, you should occasionally look at the results.";
		author[14] = "Winston Churchill";
		
		quotes[15] = "It&#8217;s amazing how much you can get done in a day if you just sit and you do it.";
		author[15] = "Bill Tregle&#8217;s Dad";
		
		quotes[16] = "Colour does not add a pleasant quality to design &#8212; it reinforces it.";
		author[16] = "Pierre Bonnard";
		
		quotes[17] = "Just because you&#8217;ve always done it that way doesn&#8217;t mean it&#8217;s not incredibly stupid.";
		author[17] = "Despair Poster";
		
		quotes[18] = "You see things, and you say: &#8216;Why?&#8217; But I dream things that never were, and I say &#8216;Why not?&#8217;.";
		author[18] = "George Bernard Shaw";
		
		quotes[19] = "Creative without strategy is called &#8216;art&#8217;. Creative with strategy is called &#8216;advertising&#8217;.";
		author[19] = "Jef I. Richards";
		
		quotes[20] = "Graphic design is the paradise of individuality, eccentricity, heresy, abnormality, hobbies and humours.";
		author[20] = "George Santayana";
		
		quotes[21] = "Enquiry? My whole life is a enquiry!";
		author[21] = "Ian Sinclair";
		
		quotes[22] = "Every creator painfully experiences the chasm between his inner vision and its ultimate expression.";
		author[22] = "Isaac Bashevis Singer";
		
		quotes[23] = "The distance between insanity and genius is measured only by success.";
		author[23] = "Bruce Feirstein";
		
		quotes[24] = "An essential aspect of creativity is not being afraid to fail.";
		author[24] = "Dr. Edwin Land";
		
		quotes[25] = "Have no fear of perfection &#8212; you&#8217;ll never reach it.";
		author[25] = "Salvador Dali";
		
		quotes[26] = "It's art if can&#8217;t be explained. It&#8217;s fashion if no one asks for an explanation. It&#8217;s design if it doesn&#8217;t need explanation";
		author[26] = "Wouter Stokkel";
		
		quotes[27] = "The Macintosh may only have 10% of the market, but it is clearly the top 10%.";
		author[27] = "Douglas Adams";
		
		quotes[28] = "I love deathlines. I like the wooshing sound they make as they fly by.";
		author[28] = "Douglas Adams";
		
		quotes[29] = "A line is a dot that went for a walk.";
		author[29] = "Paul Klee";
		
		quotes[30] = "If you don&#8217;t know who you are or what you&#8217;re about or what you believe in it&#8217;s really pretty impossible to be creative.";
		author[30] = "Rainn Wilson";
		
		quotes[31] = "Success consists of going from failure to failure without loss of enthusiasm.";
		author[31] = "Winston Churchill";
		
		quotes[32] = "If I had asked people what they wanted, they would have said faster horses.";
		author[32] = "Henry Ford";
		
		quotes[32] = "Art is an idea that has found its perfect visual expression. And design is the vehicle by which this expression is made possible.";
		author[32] = "Paul Rand";
		
		quotes[32] = "We not study from the success; we study from the fail.";
		author[32] = "John Naisbitt";
	
	
		function showQuote () {
			index = Math.floor(Math.random() * quotes.length);
			document.getElementById('quotes').innerHTML = "<a href='#' class='quotes-link' onclick='nextQuote()'>" + "<ins>N</ins>EXT" + "</a><br /><br /><br /><br /><span class='quotes'>" + "&#8220;" + quotes[index] + "&#8221;</span><br /><br /><span class='text-magenta'>" + "&mdash; " + author[index] + "</span>"
		}
	
		function nextQuote () {
			index++; if (index>=quotes.length)index=0;
			document.getElementById('quotes').innerHTML = "<a href='#' class='quotes-link' onclick='nextQuote()'>" + "<ins>N</ins>EXT" + "</a><br /><br /><br /><br /><span class='quotes'>" + "&#8220;" + quotes[index] + "&#8221;</span><br /><br /><span class='text-magenta'>" + "&mdash; " + author[index] + "</span>"
		}

/*	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
	>	KEYBOARD SCRIPT
	
		keyESC					=	closes the page
		keyBACKSPACE			=	clear all

		keyS					=	show/hide the slideshow
		keyI					=	show/hide the sketchbook slideshow
		keyX					=	show/hide the x-ray effect
		keyH					=	show/hide the keyboard-help
		keyQ					=	show/hide the random quotes
		keyP					=	show/hide the streetart slideshow
		keyT					=	show tweets from plainworks
		keyR					=	reloads the page
		keyC					=	show/hide a clock

		keySHIFT+keyRETURN		=	makes the page look insane (warning!)
	
		keyCTRL+keyL			=	enables the inactivity counter

		key1					=	show/hide the slideshow font
		key2					=	show/hide the slideshow character
		key3					=	show/hide the slideshow corporate
		key4					=	show/hide the slideshow illustration
		key5					=	show/hide the slideshow print
		key6					=	show/hide the slideshow book
		key7					=	show/hide the slideshow screen																						*/	
		
		
		function hide_xRay() {
			setVisibility(getLayerRef('main-shade'),false);
			setVisibility(getLayerRef('x-ray'),false);
			lastkey=0;
			}


		document.onkeyup=keyboard;
		var lastkey=0;
		var keyboardEnabled=true;
		
		function disableKeyboard(){keyboardEnabled=false;}
		function enableKeyboard(){keyboardEnabled=true;}

		
		function keyboard(e) { 
			e=!e?event:e; 
			keyboardCode=e.keyCode?e.keyCode:e.which; 
		
			if(keyboardCode==27)keyESC(); 
			
			if (!keyboardEnabled) return;
			
			if(lastkey==keyboardCode) {
				keyboard_resetAll();
				lastkey=0;
				return;
			}
			
			lastkey=keyboardCode;
			
			if(keyboardCode==49)key1();
			if(keyboardCode==50)key2();
			if(keyboardCode==51)key3();
			if(keyboardCode==52)key4();
			if(keyboardCode==53)key5();
			if(keyboardCode==54)key6();
			if(keyboardCode==55)key7();
			
			if(keyboardCode==109)keyM();
			if(keyboardCode==77)keyM();
			
			if(keyboardCode==115)keyS(); 
			if(keyboardCode==83)keyS(); 
			
			if(keyboardCode==113)keyQ(); 
			if(keyboardCode==81)keyQ(); 
			
			if(keyboardCode==105)keyI(); 
			if(keyboardCode==73)keyI(); 
			
			if(keyboardCode==120)keyX();
			if(keyboardCode==88)keyX();
			
			if(keyboardCode==104)keyH(); 
			if(keyboardCode==72)keyH(); 
			
			if(keyboardCode==114)keyR();
			if(keyboardCode==82)keyR();
			
			if(keyboardCode==112)keyP();
			if(keyboardCode==80)keyP();
			
			if(keyboardCode==99)keyC();
			if(keyboardCode==67)keyC();
			
			if(keyboardCode==110)keyN();
			if(keyboardCode==78)keyN();
			
			if(keyboardCode==116)keyT(); 
			if(keyboardCode==84)keyT(); 
			
			if(keyboardCode==108 && e.ctrlKey) keySCREENSAVER();
			if(keyboardCode==76  && e.ctrlKey) keySCREENSAVER();
			
			if(keyboardCode==13 && e.shiftKey)keySURPRISE();
		} 
		
		function key1() { 
			keyboard_resetAll();
			create_slideshow('slide-font','media/font-slide.html');
		} 
		
		function key2() { 
			keyboard_resetAll();
			create_slideshow('slide-character','media/character-slide.html');
		} 
		
		function key3() { 
			keyboard_resetAll();
			create_slideshow('slide-corporate','media/corporate-slide.html');
		} 
		
		function key4() { 
			keyboard_resetAll();
			create_slideshow('slide-illu','media/illu-slide.html');
		} 
		
		function key5() { 
			keyboard_resetAll();
			create_slideshow('slide-print','media/print-slide.html');
		} 
		
		function key6() { 
			keyboard_resetAll();
			create_slideshow('slide-book','media/book-slide.html');
		} 
		
		function key7() { 
			keyboard_resetAll();
			create_slideshow('slide-screen','media/screen-slide.html');
		} 
		
		function keySURPRISE() { 
			keyboard_resetAll();
			document.getElementById('psycho').style.background = 'url(img/psychoBG.gif)';
			setVisibility(getLayerRef('psycho'),true);
		}
		
		function keySCREENSAVER() {
			//lastkey=0;
			screensaverStart();
		}
		
		function keyboard_resetAll() { 	
			setVisibility(getLayerRef('shade'),false);
			setVisibility(getLayerRef('service'),false);
			setVisibility(getLayerRef('about'),false);
		    setVisibility(getLayerRef('contact'),false);
			setVisibility(getLayerRef('main-shade'),false);
			setVisibility(getLayerRef('sb-shade'),false);
			setVisibility(getLayerRef('map'),false);
			setVisibility(getLayerRef('x-ray'),false);
			setVisibility(getLayerRef('psycho'),false);
			setVisibility(getLayerRef('quotes'),false);
			setVisibility(getLayerRef('clock'),false);
			setVisibility(getLayerRef('counter'),false);
			setVisibility(getLayerRef('sb_main'),false);
			setVisibility(getLayerRef('sb_hide'),false);
			setVisibility(getLayerRef('twitter'),false);
			setVisibility(getLayerRef('facebook'),false);
			setVisibility(getLayerRef('google'),false);
			setVisibility(getLayerRef('pw_image'),false);
			setVisibility(getLayerRef('pw_image2'),false);
			setVisibility(getLayerRef('avg_header'),false);
			setVisibility(getLayerRef('disclaimer_header'),false);
			document.getElementById('GPS').className = 'location-text';
			document.getElementById('psycho').style.background = 'url(img/spacer.gif)';
			if (document.getElementById('lb_container_PLNWRX')) destroyLightbox('PLNWRX');
			if (document.getElementById('lb_container_PLNWRX_WORK')) destroyLightbox('PLNWRX_WORK');
			if (document.getElementById('lb_container_PLNWRX_SLIDE')) destroyLightbox('PLNWRX_SLIDE');
			document.getElementById("disclaimer_scroll").innerHTML="";;
		    document.getElementById("avg_scroll").innerHTML="";;
		}
			
		function keyM() { 
			keyboard_resetAll();
			document.getElementById('GPS').className = 'location-magenta';
			setVisibility(getLayerRef('shade'),true);
			setVisibility(getLayerRef('map'),true);
		} 
		
		function keyS() { 
			keyboard_resetAll();
			create_slideshow('slide-all','slideshow.html');
		} 
		
		function keyX() { 
			keyboard_resetAll();
			setVisibility(getLayerRef('main-shade'),true);
			setVisibility(getLayerRef('x-ray'),true);
		} 
		
		function keyESC() {
			keyboard_resetAll();
			enableKeyboard();
		}
		
		function keyH() { 
			keyboard_resetAll();
			createLightboxAjax('PLNWRX', 'keyboard.html', 652, 470);
		}
		
		function keyR() { 
			lastkey=0;
			location.reload();
		}
		
		function keyP() {
			keyboard_resetAll();
			create_slideshow('slide-streetart','streetart.html');
		}
		
		function keyI() { 
			keyboard_resetAll();
			create_slideshow('slide-sketchbook','sketchbook.html');		
		} 
		
		function keyQ() { 
			keyboard_resetAll();
			setVisibility(getLayerRef('main-shade'),true);
			setVisibility(getLayerRef('quotes'),true);
			showQuote();
		} 
		
		function keyC() { 
			keyboard_resetAll();
			setVisibility(getLayerRef('main-shade'),true);
			setVisibility(getLayerRef('clock'),true);
		} 
		
		function keyN() { 
			lastkey=0;
			nextQuote ();
		} 
		
		function keyT() { 
			keyboard_resetAll();
			setVisibility(getLayerRef('main-shade'),true);
			setVisibility(getLayerRef('twitter'),true);
			initTwitter();
		} 

/*	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
	>	SLIDESHOW SCRIPT																																*/


		var imgStop=new Image().src='img/pause.png';
		var imgPlay=new Image().src='img/play.png';
		
		var autoplay=true;
		var index=-1;
		var imgsShown=0;
		
		var playspeed=2000;
		var isPlaying=false;

		function preloadSlide() {
			var k,i, tName, tPath;
			for(k=0;k<theimage.length;k++) {
				i=parseInt(Math.random()*(theimage.length-k));
				tPath=theimage[k][0]; tName=theimage[k][1]; tNum=theimage[k][2];
				theimage[k][0]=new Image().src=theimage[k+i][0]; theimage[k][1]=theimage[k+i][1]; theimage[k][2]=theimage[k+i][2];
				theimage[k+i][0]=tPath; theimage[k+i][1]=tName; theimage[k+i][2]=tNum;
			}
		}

		function slideshowInit(){
			if (autoplay) {
				//if (!window.playing) 
				setTimeout('PlaySlide();', playspeed); document.images.imgPlay.src=imgStop;
			}
			preloadSlide();
		}
		
		function SetSlide() {
			if (index<0) index=theimage.length-1;
			index=index%theimage.length;
			document.images.imgslide.src=theimage[index][0];
		}
		
		function randomImage() {
			index++;
			SetSlide();
			playing=setTimeout('randomImage();', playspeed);
		}
		
		function prevImage() {
			index--; SetSlide();
		}
		
		function nextImage() {
			index++; SetSlide();
		}
		
		function PlaySlide() {
			if (!isPlaying) {
				randomImage();
				document.images.imgPlay.src=imgStop;
			}
			else {
				playing=clearTimeout(playing);
				document.images.imgPlay.src=imgPlay;
			}
			isPlaying=!isPlaying;
		}
	
		function create_slideshow(name, url) {
			disableScreensaver(); isPlaying=false;
			new Ajax.Request("js/" +name+ ".js", {
				method: 'get',
				onSuccess: function(transport) {
					transport.responseText.evalScripts();
					createLightboxAjax('PLNWRX_SLIDE', url, 590, 485);
					setTimeout("slideshowInit();",1000);			
				}
			});
		}
		

/*	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
	>	SHOW / HIDE THE SHOP																																*/
		
		function show_shop() {
				setVisibility(getLayerRef('menue'),false);w
				setVisibility(getLayerRef('submenue'),false);
				document.getElementById("shop").style.display="block";
				/*setVisibility(getLayerRef('shop'),true);*/
				setContentAjax("shop","shop.html");
		}
		
		function hide_shop() {
				setVisibility(getLayerRef('menue'),true);
				setVisibility(getLayerRef('submenue'),true);		
				document.getElementById("shop").style.display="none";
				/*setVisibility(getLayerRef('shop'),false);*/
				
		}
		
		function show_plakat() {
				setVisibility(getLayerRef('menue'),false);
				setVisibility(getLayerRef('submenue'),false);
				setVisibility(getLayerRef('location'),false);
				setVisibility(getLayerRef('beta'),false);
				document.getElementById("header").innerHTML="<img alt=\"\" src=\"img/header_2010.gif\" width=\"189\" height=\"49\" />\n <br />\n<span class=\"plakatheader\">POSTERSHOP</span>\n";
				document.getElementById("shop").style.display="block";
				/*setVisibility(getLayerRef('shop'),true);*/
				setContentAjax("shop","plakat.html");
		}
		
		function hide_plakat() {
				setVisibility(getLayerRef('menue'),true);
				setVisibility(getLayerRef('submenue'),true);
				setVisibility(getLayerRef('location'),true);
				setVisibility(getLayerRef('beta'),true);
				document.getElementById("header").innerHTML="<img alt=\"\" src=\"img/header_2010.gif\" width=\"189\" height=\"49\" />\n";
				document.getElementById("shop").style.display="none";
				/*setVisibility(getLayerRef('shop'),false);*/
				
		}


/*	—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

>	END																																				*/

		

	
