function blendIn(){
	mO = new Fx.Morph($$('.text')[0], {
		duration: 300
	});
	mO.start({
		'opacity': 1
	});
}

window.addEvent('domready', function(){
	
	$$('.text').setStyle('opacity',0);
	$$('.text').setStyle('display','block');
	
	blendIn.delay(600);
	
	
	if(gmapv == 'true'){
		gmap();
	}
	col = ['#E12370','#0B909C','#F39000','#5CA400','#09347B','#7A7A7A']
	
	v = aktivnav == 'home' ? 5 : aktivnav;
	
	if(!$defined(col[aktivnav])) v = 5;
	
	//$('nav').setStyle('border-bottom','5px '+col[v]+ ' solid')
	
	// Request Class
	new verzRequest({});
	
	hovArr = [
			root + 'images/button_menu_1_b.jpg',
			root + 'images/button_menu_2_b.jpg',
			root + 'images/button_menu_3_b.jpg',
			root + 'images/button_menu_4_b.jpg'
		]
	
	Array.implement({
		shuffle: function() {
			for(var j, x, i = this.length; i; j = parseInt(Math.random() * i), x = this[--i], this[i] = this[j], this[j] = x);
			return this;
		}
	});
	
	if (Browser.Engine.name == "trident" && Browser.Engine.version == 6) {
		$('rcontent').setStyles({
			'padding-top': 72
		})
	}
	
	if (Browser.Engine.name == "trident" && Browser.Engine.version == 5) {
		$('rcontent').setStyles({
			'padding-top': 44
		})
	}
	
	if (Browser.Engine.name == "trident" && Browser.Engine.version < 5) { 
	
		DD_belatedPNG.fix('.bg');
	}
	
	//preload images
	new Asset.images(hovArr, {
		onComplete: function(){
				
			// Arcade Class
			arcadeJS = new arcade({
				picArr: [root + 'images/button_menu_1.jpg', root + 'images/button_menu_2.jpg', root + 'images/button_menu_3.jpg', root + 'images/button_menu_4.jpg']
			})
			
			if(menuname == '') menuname = 'HOME';

			if(aktivnav < 4 || menuname == 'HOME' ){
				arcadeJS.loadPart(menuname);
				//if(menuname != 'HOME')
				arcadeJS.getCase(menuname);
			}

		}
	});
	

/**
	 *deskJS-Functions
	 *
	 *Parameters:
	 *	verzDebug: Debugstatus für den JSON-Output (bolean)
	 *	verzLocal: Request auf lokale/externe Daten (bolean)
	 *	verzUser: DBName des Benutzer (string)
	 *
	 *Methods:
	 *	_loadStatus: Aufruf bei jeder Interaktion - Load, Request, usw (bereich, json-aktion)
	 *	_directLink: Aufruf durch direktlink Verz-Verz und Internen Seiten (mode = verz/site)
	 *	_afterRendering: Aufruf nach Einbindung der Plugins und Rendering des Templates
	 *	showNews:darstellen der kleinen Newstexte
	 *	showDetail: darstellen der detailierten Newstexte
	 *	googlemap: generierung Googlemap
	 *	updateTooltip: (Organigram) Tooltip positionieren
	 */
	deskJS = new Class({
		// Implements
		Implements: addDeskJS
		// options
		,options: {
			verzDebug: 1,
			verzLocal: 0,
			verzUser: 'arcade_cms_go4web'
		}
		// initialization
		,initialize: function(options){
			//Optionen setzen
			this.setOptions(options);
			// pluginload
			this._jsPreload({
				templating: false,
				slider: false,
				scrollspy: false,
				popup: false,
				sortOn: false
			});
			this._verzReqStr = {
				type: 'all'
				,user: this.options.verzUser
				,table: {
					listingdatas: 'ld'
					,listingrows: 'lr'
					,listings: 'l'
				}
				,condition: {
					'lr.rubrikname':'News'
				}
				,fields: 'lr.*,ld.*'
				,order: 'ld.datum DESC'
				,language: LANG
			}
			this._verzReq('showNews');
		}
		// Ladestatus der Plugins oder des Request
		,_loadStatus: function(part, action){}
		// Aufruf durch Verzeichnisverlinkung
		,_directLink: function(mode, DBstr, lrID, ldID){}
		,_afterRendering: function(){}
		
		/**
		 * User-Functions
		 *
		 *  Methods:
		 *
		 */
		,showNews:function(res){
			if (res.result.length > 0) {
				var item = res.result[0];
				var tmpText = item.ld.text.text[0].substring(0, 100);
				//ermittle letzte Position eine Lehrzeichens im tmpText
				var pos = tmpText.lastIndexOf(' ');
				reqType = 'case'
				var divNewsSmall = (
				'<div id="newsSmall">' +
					'<div class="rc_title">News - ' +item.ld.title +'</div>' +
					'<div class="rc_text" style="visibility:visible; opacity:1;">' +
						'<img width="176" alt="" border="0" src="' +root +'upload/176x_verz_' +item.ld.pictures["media"][0]["name"] +'" style="padding-bottom:1px;" />' +
						'<div id="txtNews">' +tmpText.substring(0, pos) +'...<br /><a id="lnk_NewsBig" href="" class="news">Erfahren Sie mehr</a>' +'</div>' +
					'</div>' +
				'</div>'
				);
				divNewsSmall = divNewsSmall.toDOM();
				divNewsSmall.inject($('case'), 'before');
				$('lnk_NewsBig').addEvents({
					'click': function(e){
						e.stop();
						this.showNewsBig(item);
					}.bind(this)
				});
			}
		}
		,showNewsBig: function(item){
			var mO = new Fx.Morph($$('.text')[0], {
				duration: 300,
				onComplete: function(){
					$$('.text')[0].innerHTML=(
					'<div class="headNewsBig">'+
						'<div class="newsBigTitle">'+item.ld.title+'<br>'+item.ld.subtitle+'</div>'+
					'</div>'+
					'<div class="newsBigTxtCont">'+
						'<div class="newsBigTxt">'+
							item.ld.text.text+
						'</div>'+
						'<div class="imgContNB">'+
							'<img src="'+root+'upload/152x_verz_'+item.ld.pictures.media[0].name+'" width="152">'+
						'</div>'+
						'<div style="background-color: rgb(235, 235, 235); width: 567px;">'+
							'<div style="float: left;"></div>'+
							'<div style="clear: both;"></div>'+
						'</div>'+
					'</div>'+
					'<div class="footerContNB">'+
						'arcade solutions ag &sdot; winkelriedstrasse 37 &sdot; 6003 luzern<br/>fon: +41 41 417 31 73 &sdot; fax: +41 41 417 31 74 &sdot; <a href="mailto:info@arcade.ch">info@arcade.ch</a> &sdot; <a href="http://www.arcade.ch">www.arcade.ch</a>'+	
					'</div>'
					);
					var mO2 = new Fx.Morph($$('.text')[0], {
						duration: 600
					});
					mO2.start({
						'opacity': 1
					});
				}.bind(this)
			});
			mO.start({
				'opacity': 0
			});
		}
	});
	deskJS = new deskJS();
});

var verzRequest = new Class({
	
	Implements: [Options, Events],
	
	options: {
		root: 'http://www.arcade.ch/upload/'
		,local: 0
		,debug: 1
	}
		
	,initialize: function(options){
		//menu
		this.setOptions(options);
		this.reqData = this.loadData();
	}
	
	,loadData: function(){
		
		return {
			type: 'all'
			,user: 'arcade_cms_go4web'
			,table: {
				listingdatas: 'ld'
				,listingrows: 'lr'
				,listings: 'l'
			}
			,condition: {}
			,fields: 'lr.*,ld.*'
			,order: 'ld.id DESC'
			,language: 'de'
		}
	}
	
	,replaceData: function(part, value){
		
		this.reqData[part] = value;
	}
	
	,reqResult: function(onCompletFunc){
		
		if(this.options.debug == 1) debugStr = '&debug=1';
		else debugStr = '';
		
		new Request({
			url: 'index.php'
			,method: 'post'
			,data: 'mode=verzeichnis&local=' + this.options.local + debugStr +'&request=' + encodeURIComponent(JSON.encode(this.reqData))
			,noCache: true
			,onComplete: function(response){
				var req = JSON.decode(response);
				this[onCompletFunc](req);
			}.bind(this)
		}).send();
	}
});



var arcade = new Class({
	
	Extends: verzRequest
	
	,options: {
		caseNrNow:0
	}
	
	,initialize: function(options){
		//menu hover
		$$('#navpos ul li').each(function(li,key){
			li.addEvents({
				'mouseover': function(){
					//li.getChildren('div')[0].getChildren('a')[0].getChildren('img')[0].src = root+'images/menu_'+(key+1)+'h.png';
				},
				
				'mouseout': function(){
					if(key != aktivnav){
						//li.getChildren('div')[0].getChildren('a')[0].getChildren('img')[0].src = root+'images/menu_'+(key+1)+'.png';
					}
				}
			})	
		});
		
		
		this.parent(options);
		
		this.picPreload();
		
		this.checkAccordions.delay(400,this)
	}
	
	
	,checkAccordions: function(){
		//console.log($$('.toggles'));

		
			
			$$('.toggles').setStyles({
				'height': 25
				,'margin-top': 1
				,'color': '#fff'
				,'font-size': 13
				,'padding':'5px 10px 0 10px'
				,'background-image': 'url(' + this.options.root.replace('upload/', '') + 'images/toggle.png)'
		
			})
			
			var self = this;
			
			$$('.toggles').addEvents({
				'click': function(){
					
					if(this.getStyle('background-image').indexOf('a.png') != -1){
						this.setStyles({
							'background-image': 'url(' + self.options.root.replace('upload/', '') + 'images/toggle.png)'
							,'background-position': 'right'
						})
					}else{
						$$('.toggles').setStyle('background-image', 'url(' + self.options.root.replace('upload/', '') + 'images/toggle.png)')
						
						this.setStyles({
							'background-image': 'url(' + self.options.root.replace('upload/', '') + 'images/toggle_'+aktivnav+'a.png)'
							,'background-position': 'right'
						})
					}
					
	
				},
				'mouseover': function(){
					
					$$('.toggles').each(function(tog){
						if(tog.getStyle('background-image').indexOf('a.png') == -1){
							tog.setStyle('background-image', 'url(' + self.options.root.replace('upload/', '') + 'images/toggle.png)')
						}
					})
					
					if (this.getStyle('background-image').indexOf('a.png') == -1) {
						this.setStyles({
							'background-image': 'url(' + self.options.root.replace('upload/', '') + 'images/toggle_' + aktivnav + '.png)',
							'background-position': 'right'
						})
					}
				},
				'mouseout': function(){
					
					if (this.getStyle('background-image').indexOf('a.png') == -1) {
										
										
						this.setStyles({
							'background-image': 'url(' + self.options.root.replace('upload/', '') + 'images/toggle.png)',
							'background-position': 'right'
						})
					}
				}
			})
			
			$$('.elements').each(function(el){

				el.set('html','<br/>'+el.get('html')+'<br/><br/>')
		
			})
		
	}
	
	,picPreload: function(){
		
		this.options.picArr.each(function(items, key){
			new Asset.images(items, {});
		});
	}
	
	,loadPart: function(part){
		


		this.part = part;
		
		this.symb = new Hash({
			'ICT SERVICES': '1'
			,'COMMUNICATION SERVICES': '2'
			,'DATACENTER SERVICES': '3'
			,'APPLICATION SERVICES': '4'
			,'HOME': '0'
		})
		
		this.reqData = {
			type: 'all'
			,user: 'arcade_cms_go4web'
			,table: {
				listingdatas: 'ld'
				,listingrows: 'lr'
				,listings: 'l'
			}
			,condition: {
				//'lr.rubrikname !=': 'HOME'
			}
			,fields: 'lr.*,ld.*'
			,order: 'RAND()'
			,language: 'de'
		}
		
		this.reqResult('showBlock');
	}
	
	,showBlock: function(req, next){
		
		
		this.scrollToTop();
			
		var newspld;
		
		if(req.count == 0) return;
		
		// News / Case
		var randNr = 0;
		
		if(req != '' && $defined(req.result[0])) checkRub = req.result[0].lr.rubrikname;
		else checkRub = "Case";
		
		
		var reqType = 'case';
		if(req.result != undefined){
			this.itmArr = []
			
			this.options.reqResCase = req.result

			this.options.reqResCase.each(function(itm,key){
				
				/*console.log(itm.lr.rubrikname)
				console.log('-->'+this.part)*/
				
				if(itm.lr.rubrikname == this.part){
					this.itmArr.push(key)
				}
				
			},this)
			
			
			//randNr = this.itmArr[0]
			
			
		}else{
			if(next != undefined){
				
				
				
				
				randNr = this.options.caseNrNow + next;
				
				maxCount = (this.itmArr.length -1);
				if (randNr < 0) randNr = maxCount;
				else if(randNr > maxCount) randNr = 0;
				
				this.options.caseNrNow = randNr;
			}
			

			
			newspld = this.options.reqResCase[this.itmArr[this.options.caseNrNow]].ld;
			newsplr = this.options.reqResCase[this.itmArr[this.options.caseNrNow]].lr;
		}
		
		
		
		/*
		if (this.part == 'HOME') {
			this.itmArr = [];
			this.itmArr[0] = 0
		}*/
		
		
		
		if(req.result){
			newspld = req.result[this.itmArr[randNr]].ld;
			newsplr = req.result[this.itmArr[randNr]].lr;
			
		}
		
		
		
		if(newspld){
			
			var txt = '';
			if(newspld.pictures != ''){
				newspic = newspld.pictures;
				if(newspic["media"]) txt += '<div style="height:100px;background-color:#fff;margin:0 0 5px 0"><table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"><tr><td align="center" valign="middle"><img src="' + this.options.root + '176x_verz_' + newspic["media"][0]["name"] + '" style="padding-bottom:1px;"></td></tr></table></div>';
			}
			if(newspld.title != '') txt += '<div style="padding-bottom: 3px; padding-top:5px; font-weight: bold; font-size:13px;color: #000000;">' + newspld.title + '</div>';
			if(newspld.kurztext != ''){
				newst = newspld.kurztext;
				tmpText = newst.text[0].substring(0, 200);
				//pos = tmpText.lastIndexOf(' ');
				txt += '<div>' + tmpText.substring(0, 200) + '...<br /><a href="javascript: arcadeJS.showCaseMain(' + this.itmArr[randNr] + ', \'' + reqType + '\');" class="news">Erfahren Sie mehr</a></div>';
			}
			
			
			if(newsplr.rubrikname == 'News') seleDiv = '#news .rc_text';
			else seleDiv = '#case .rc_text';
			
			
			mO = new Fx.Morph($$(seleDiv)[0], {
				duration: 300,
				onComplete: function(){
					
					$$(seleDiv)[0].set('html', txt);
					
					mO = new Fx.Morph($$(seleDiv)[0], {
						duration: 500
						
					});
					mO.start({
						'opacity': 1
					});	
					
				}
			});
			mO.start({
				'opacity': 0
			});
			
			
		}
	}
	
	,getCase: function(menuname){
		
		if(!$defined(this.tmp) && menuname != 'HOME'){
			this.tmp = 'tmp';
			
			var anchEl = new Element('a', {
				'href': '#'
				,'class': 'nav'
				,'html': 'Case Studies'
				,events:{
					'click': function(){
						$$('.text').setStyle('opacity',0);
						$$('.text').setStyle('display','block');
						blendIn.delay(600);
						this.scrollToTop();
						return false;
					}.bind(this)
				}
			});
			
			var addClick = function(){
				this.showList();
			};
			var boundaddClick = addClick.bind(this);
			anchEl.addEvent('click', boundaddClick);
									
			var liEl  = new Element('li',{
				'class': 'subno'
			});
			anchEl.inject(liEl);
			
			//$('left_cspace').getElements('ul')[0].grab(liEl);
			
			liEl.injectAfter($$('#submenu ul li')[0]);
			
			this.getCase.delay(300,this,menuname)
			
		}else{
			//alert(menuname);
			this.reqData = {
				type: 'all'
				,user: 'arcade_cms_go4web'
				,table: {
					listingdatas: 'ld'
					,listingrows: 'lr'
					,listings: 'l'
				}
				,condition: {
					'lr.rubrikname': menuname
				}
				,fields: 'lr.*,ld.*'
				,order: 'ld.datum DESC'
				,language: 'de'
			}
			
			this.part = menuname;
			this.reqResult('showCase');
		}
		
		
	}
	
	,showCase: function(req){
				
		if(req.result.length > 0){
			
			// Caseright
			if(req.result.length > 1){
				
				var casePage = new Element('div', {
					'html': '<div style="padding-top: 6px; color: rgb(167, 167, 167);"><a onclick="arcadeJS.showBlock(\'\', -1);" href="#"><img src="'+root+'images/studies_b.gif" alt="<" border="0"></a>&nbsp;&nbsp;weitere Case Studies&nbsp;&nbsp;<a onclick="arcadeJS.showBlock(\'\', 1);" href="#" title="vorwärts"><img src="'+root+'images/studies_f.gif" alt=">" border="0"></a></div>'
					,'styles': {
						'height': '27px'
						,'text-align': 'center'
						,'background': 'url(' + this.options.root.replace('upload/', '') + 'images/studies_bg.gif) no-repeat'
					}
				});
				casePage.inject($('case'));
			}
			
			// Casenavi
			$('case').setStyle('display', 'block');
			
			
			
			
		}else{
			$('rcontent').setStyles({
				'height':$('content').getStyle('height')
			});
				
		}
		
		
		col = ['#E12370','#0B909C','#F39000','#5CA400','#09347B','#7A7A7A']
		
		var hcol;
			
		$$('#submenu ul li a').each(function(li){
			li.addEvents({
				'mouseover': function(){
					
					if ($defined(col[aktivnav])) {
						hcol = col[aktivnav]
					}else {
						hcol = col[5]
					}
					
					if(this.getParent().getStyle('background-color') != hcol.toLowerCase()){
						this.setStyles({
							'color': col[aktivnav]
						})
					}
					
				},
				'mouseout': function(){
					
					if ($defined(col[aktivnav])) {
						hcol = col[aktivnav]
					}else {
						hcol = col[5]
					}
					
					if (this.getParent().getStyle('background-color') != hcol.toLowerCase()) {
						this.setStyles({
							'color': '#000'
						})
					}else{
						this.setStyles({
							'color': '#fff'
						})
					}
				},
				'click': function(){
					
					$$('#submenu ul li a').setStyle('color','#000')
					
					this.setStyles({
						'color': '#fff'
					})
				}
			})
		})
		
	}
	
	,activateCase: function(){
		
		if($('left_cspace')){
			var i;
			
			if($('left_cspace').getElements('ul')[1]) $('subnavdiv').destroy();
			$('left_cspace').getElements('li').each(function(i, k){
				if(($('left_cspace').getElements('li').length -2) == k){
					i.addClass('smenu');
					
					i.getChildren()[0].setStyle('color','#fff')
				}else{
					i.removeClass('smenu')
					i.getChildren()[0].setStyle('color','#000')
				}
			})
		}
	}
	
	
	//unterscheidung der einträge
	,showList: function(){
		this.activateCase()
		
		
		this.caseCount = 1;
		
		$$('.text')[0].empty()
		
		var others = [];
		
		$$('.title').set('html', $('caseRend').innerHTML);
		var n = 0;
		this.options.reqResCase.each(function(cStudy, key){
		
			if(cStudy.lr.rubrikname == this.part){
				this.outputList(cStudy,key);
			}else{
				
				if(cStudy.lr.rubrikname != 'HOME' && cStudy.lr.rubrikname != 'News'){
					
					others.push($H({
						name: cStudy
						,cKey: key
					}));
					
				}
				
				n++;
			}

		},this)

		this.caseCount = 1;
		
		others.shuffle();
		
		cont = new Element('div',{
			'html': '<b>Unsere Projekte aus anderen Dienstleistungsbereichen</b>'
			,'styles':{
				'clear': 'both'
				,'padding':'0px 0 20px 0'
			}
		}).inject($$('.text')[0])
		
		others.each(function(cStudy, key){
			
			if(key < 4){
				this.outputList(cStudy.name, cStudy.cKey);
			}
		},this);
		
		
	}
	
	
	//ausgabe der einträge
	,outputList: function(cStudy,no){
		
		
		
		this.caseCount++;
		
		m = this.caseCount % 2 == 0 ? 25 : 0;
		
		cont = new Element('div',{
			'styles':{
				'width': 355
				,'float': 'left'
				,'height': 330
				,'margin-right': m
			}
		}).inject($$('.text')[0])
		

		
		if($defined(cStudy.ld.pictures.media) && $defined(cStudy.ld.pictures.media[1])){
			pic = 'url(' + this.options.root + '355x_verz_'+cStudy.ld.pictures.media[1].name+')'
		}else{
			pic = 'none';
		}
		new Element('div',{
			'styles':{
				'width': 355
				,'background-image': pic
				,'height': 112
			}
		}).inject(cont)
		
		new Element('div',{
			'styles':{
				'width': 20
				,'height':35
				,'margin': '10px 10px 0 0'
				,'float': 'left'
				,'background-image': 'url(' + this.options.root.replace("upload/", "") + 'images/case_'+this.symb[cStudy.lr.rubrikname]+'.png)'
				,'background-repeat': 'no-repeat'
			}
		}).inject(cont)
		
		
		title = $defined(cStudy.ld.title) ? cStudy.ld.title : '';
		subtitle = $defined(cStudy.ld.subtitle) ? cStudy.ld.subtitle : '';
		
		
		new Element('div',{
			'html': '<b>'+title+'<br/>'+subtitle+'</b>'
			,'styles':{
				'float': 'left'
				,'margin': '10px 0 0 0'
				,'font-size': '12px'
			}
		}).inject(cont)
		
		
		new Element('div',{'styles':{'clear': 'both'}}).inject(cont)
		
		txt = $defined(cStudy.ld.text.text[0]) ? cStudy.ld.text.text[0] : '';
		
		txt = txt.substring(0, 180)+'...';
		
		new Element('div',{
			'html': '<div style="height:60px">'+txt+'</div><br/><hr>'
			,'styles':{
				'margin': '5px 0 0 0'
				
			}
		}).inject(cont)
		
		
		more = new Element('div',{
			'styles':{
				'width': 355
				,'text-align': 'right'
			}
		}).inject(cont)
		
		new Element('a',{
			'href': '#'
			,'html': 'Erfahren Sie mehr'
			,'class': 'news'
			,'events':{
				'click': function(){

					this.showCaseMain(no, 'case');
				}.bind(this)
			}
		}).inject(more)
			

	}
	
	,showCaseMain: function(nr, mode){
		this.scrollToTop();
		this.activateCase();
		if(mode == 'case') ldatas = this.options.reqResCase[nr].ld;
		else  ldatas = this.options.reqResNews[nr].ld;
		
		
		mO = new Fx.Morph($$('.text')[0], {
			duration: 300
			,onComplete: function(){
				
				$$('.text')[0].empty();
				
				
				if(this.part != 'HOME'){
					n = this.options.reqResCase[nr].lr.rubrikname;
				}else{
					n = this.part
				}
				
				header = new Element('div',{
					'html': ''
					,'styles':{
						'width': 736
						,'height': 55
						,'background-image': 'url(' + this.options.root.replace("upload/", "") + 'images/newsheader_'+this.symb[n]+'.jpg)'
					}
				}).inject($$('.text')[0])
				
				title = $defined(ldatas.title) ? ldatas.title : '';
				subtitle = $defined(ldatas.subtitle) ? ldatas.subtitle : '';
				txt = $defined(ldatas.text.text) ? ldatas.text.text : '';
				txt2 = $defined(ldatas.feedback.text) ? ldatas.feedback.text : '';
				
				 new Element('div',{
					'html': title+'<br/>'+subtitle
					,'styles':{
						'font-family': 'verdana'
						,'font-size': '13px'
						,'color': '#fff'
						,'padding': 10
					}
				}).inject(header)
				
				cont = new Element('div',{
					'styles':{
						'background-image': 'url(' + this.options.root.replace("upload/", "") + 'images/casebg.gif)'
						,'background-repeat': 'repeat-y'
						,'width': 736
						,'position': 'relative'
						,'clear': 'both'
					}
				}).inject($$('.text')[0])
		
				if($defined(ldatas.pictures.media)){
					hpic = '<img src="'+this.options.root + '152x_verz_'+ldatas.pictures.media[0].name+'" width="152">';
				}else{
					hpic = '';
				}
				
				new Element('div',{
					'html': txt
					,'styles':{
						'width': 548
						,'float': 'left'
						,'padding': '28px 20px 40px 0'
					}
				}).inject(cont)
				
				r = new Element('div',{
					'html': hpic+'<br/><br/>'+txt2+'<br/><br/>'
					,'styles':{
						'width': 152
						,'float': 'left'
						,'padding': 8
					}
				}).inject(cont)
				
				if($defined(ldatas.url) && ldatas.url != ''){
					new Element('a',{
						'href': 'http://'+ldatas.url
						,'html': ldatas.url
						,'class': 'news'
						,'target': '_blank'
					}).inject(r)
				}
				
				
				new Element('div',{
					'styles':{
						'clear': 'both'
						
					}
				}).inject(cont)
				

				cF = new Element('div',{
					'styles':{
						'background-color': '#ebebeb'
						,'width':567
					}
				}).inject(cont)
				
				
				if ($defined(ldatas.pdfs.media)) {
						
					new Element('div', {
						'html': '<a href="' + this.options.root + ldatas.pdfs.media[0].name+'">PDF Download Projektbeschrieb</a>'
						,'styles': {
							'position': 'absolute',
							'bottom': 10,
							'left': 8,
							'background-image': 'url(' + this.options.root.replace("upload/", "") + 'images/pdf.gif)',
							'background-repeat': 'no-repeat',
							'padding': '3px 0 0 23px'
						}
					}).inject(cF)
					
				}
				
				
				new Element('div',{
					'html': 'Haben Sie Fragen zum Projekt oder möchten Sie ein  ähnliches Vorhaben realisieren? Kontaktieren Sie uns!<br/><b>Telefon +41 41 417 31 73</b>'
					,'styles':{
						'width': 210
						,'background-color': '#ebebeb'
						,'padding':'15px 10px 10px 10px'
						,'float': 'left'
					}
				}).inject(cF)
						
				
				if($defined(ldatas.pictures.media) && $defined(ldatas.pictures.media[1])){
					hpic = '<img src="'+this.options.root + '337x_verz_'+ldatas.pictures.media[1].name+'" width="337">';
				}else{
					hpic = '';
				}
				
				new Element('div',{
					'html': hpic
					,'styles':{
						'float': 'left'
					}
				}).inject(cF)
				
				new Element('div',{
					'styles':{
						'clear': 'both'
					}
				}).inject(cF)
				
				new Element('div',{
					'html': 'arcade solutions ag &sdot; winkelriedstrasse 37 &sdot; 6003 luzern<br/>fon: +41 41 417 31 73 &sdot; fax: +41 41 417 31 74 &sdot; info@arcade.ch &sdot; www.arcade.ch'
					,'styles':{
						'background-image': 'url(' + this.options.root.replace("upload/", "") + 'images/casebg_footer.gif)'
						,'background-repeat': 'repeat-y'
						,'width': 716
						,'position': 'relative'
						,'clear': 'both'
						,'height': 51
						,'color': '#919191'
						,'padding':'15px 10px 0 10px'
					}
				}).inject($$('.text')[0])
				
				
				
				
				mO = new Fx.Morph($$('.text')[0], {
					duration: 600
					,onComplete: function(){
						
					}
				});
				mO.start({
					'opacity': 1
				});
				
			}.bind(this)
		});
		
		
		mO.start({
			'opacity': 0
		});
		
		
		
	}
	
	,randomNr: function(n){
		return (Math.floor(Math.random() * n));
	}
	
	,is_object: function(mixed_var){
    		if(mixed_var instanceof Array){
    			return false;
    		}else{
    			return (mixed_var !== null) && (typeof( mixed_var ) == 'object');
    		}
	}
	
	,scrollToTop: function(){
		
		var myFx = new Fx.Scroll(document.body, {
			offset: {
				'x': 0
				,'y': 0
			}
		}).toTop();
	}
});


function gmap(){

    if (GBrowserIsCompatible()) {
        var map = new GMap2($('map'));
        map.addControl(new GSmallZoomControl());
        map.addControl(new GMapTypeControl());
        
        map.setCenter(new GLatLng(47.0471548, 8.3068708), 15);
        var point = new GLatLng(47.0471548, 8.3068708);
        
        marker = new GMarker(point);
        map.addOverlay(marker);
	        
    }
}


Array.implement({
	shuffle: function() {
		
		for(var j, x, i = this.length; i; j = parseInt(Math.random() * i), x = this[--i], this[i] = this[j], this[j] = x);
		return this;
	}
	,is_array: function(input){
		return typeof(input)=='object'&&(input instanceof Array);
	}
});

