// JavaScript Document

// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
// clever-mediagroup.de 
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
// 
// Autor: David M. Lillge
// Version: 2.0.144
// Date: 19-03-2011 DMJ
// 
// © Copyright Clever Mediagroup All Rights Reserved 
// http://www.clever-mediagroup.de/
// 
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---

var ego=({
	stoper: true,
	start: function(){
		$('#ajaxBlock').css('display', 'block');
		$('#footerPopup').animate({opacity: 0}, 0);
		$('#footerPopup').css('display', 'none');
		$('#content > #layer').animate({opacity: 0, top: -85}, 0);
		$('#app3HTML').animate({opacity: 0}, 0);
		$('#appShadow').add('#appLayer2').animate({opacity: 0}, 0);
		document.getElementById('inOverHeader').style.left = '-955px';
		this.location();
		this.page.resize();
		this.page.news();
		this.cach.input();
		this.links();
	},
	links: function(){
		$('a[name!="iframeY"]').click(function(){
			ego.stoper = false;
			return false;
		});
		$('#videoPop').click(function(){
			if (ego.apps.appLayer3) {
				ego.video(false);
				$('#app3HTML2').animate({opacity: 0}, 500);
				$('#linkGallery > a').addClass("activeApp");
				$('#linkVideo > a').addClass("activeApp");
				$('#linkInfos > a').removeClass('activeApp');
			} else {
				$('#appCloser').click();
			}
		});
		$('a.subNav').click(function(){
			if (ego.apps.appLayer3) {
				ego.apps.appLayer3 = false;
				$('#app2Closer').animate({opacity: 0}, 0);
				$('#app3HTML').animate({opacity: 0}, 0);
				$('#app3HTML2').animate({opacity: 0}, 0);
				$('#app3HTML2').html('');
				$('#app2HTML').html('');
				$('#appLayer3').css('visibility', 'hidden');
				ego.iframe = false;
			}
			if (!(ego.nav.aktiv)) {
				ego.nav.aktiv = true;
				ego.ajax.subNav($(this).attr('href'));
				$("a.activeSub").toggleClass("activeSub");
				$(this).toggleClass("activeSub");
			}
		});
		$('a.footerNav').click(function(){
			if (ego.page.starting) {
				$('#starter').add('#starterVideo').animate({opacity: 0}, 400, function(){
					$('#starterVideo').add('#starter').detach();
				});
				ego.page.starting = false;
			}
			if (ego.apps.appLayer3) {
				ego.apps.appLayer3 = false;
				$('#app2Closer').animate({opacity: 0}, 0);
				$('#app3HTML').animate({opacity: 0}, 0);
				$('#app3HTML2').animate({opacity: 0}, 0);
				$('#app3HTML2').html('');
				$('#app2HTML').html('');
				$('#appLayer3').css('visibility', 'hidden');
				ego.iframe = false;
			}
			if (!(ego.nav.aktiv)) {
				ego.nav.aktiv = true;
				ego.nav.positionOld = ego.nav.positionNew;
				ego.nav.positionNew = 1;
				ego.nav.action();
				ego.ajax.subNav($(this).attr('href'));
			}
		});
		$('a.main').click(function(){
			if (ego.page.starting) {
				$('#starter').add('#starterVideo').animate({opacity: 0}, 400, function(){
					$('#starterVideo').add('#starter').detach();
				});
				ego.page.starting = false;
			}
			if (ego.apps.appLayer3) {
				ego.apps.appLayer3 = false;
				$('#app2Closer').animate({opacity: 0}, 0);
				$('#app3HTML').animate({opacity: 0}, 0);
				$('#app3HTML2').animate({opacity: 0}, 0);
				$('#app3HTML2').html('');
				$('#app2HTML').html('');
				$('#appLayer3').css('visibility', 'hidden');
				ego.iframe = false;
			}
			if (!(ego.nav.aktiv)) {
				ego.nav.aktiv = true;
				ego.nav.positionOld = ego.nav.positionNew;
				ego.nav.positionNew = $(this).attr('name');
				$("a.activeSub").toggleClass("activeSub");
				ego.nav.action();
				ego.ajax.action($(this).attr('href'));
			}
		});
		$('a.subNav2').click(function(){
			if (!(ego.nav.aktiv)) {
				ego.nav.aktiv = true;
				ego.ajax.subNav($(this).attr('href'));
			}
		});
		
	},
	location: function(){
		var temp = location.hash;
		temp = temp.replace(/%C3%A4/g, "ae");
		temp = temp.replace(/%C3%84/g, "AE");
		temp = temp.replace(/%C3%B6/g, "oe");
		temp = temp.replace(/%C3%96/g, "OE");
		temp = temp.replace(/%C3%BC/g, "ue");
		temp = temp.replace(/%C3%9C/g, "UE");
		temp = temp.replace(/\u00e4/g, "ae");
		temp = temp.replace(/\u00c4/g, "AE");
		temp = temp.replace(/\u00f6/g, "oe");
		temp = temp.replace(/\u00d6/g, "OE");
		temp = temp.replace(/\u00fc/g, "ue");
		temp = temp.replace(/\u00dc/g, "UE");
		var temp = temp.split ('/');
		
		if(temp[0] == '') {
			temp[0]='#';
			temp[1]='home';
			location.href = '#/';
			this.page.show = true;
		}
		if(temp[0] == '#' && temp[1] == '') {temp[1] = 'home';}
		if (temp[0] == '#!') {
			var temp2 = '?v=';
			for (i=1; i<temp.length; i++) {
				temp2 = temp2+'/'+temp[i];
			}
			location.replace(temp2);
		}
		if (!(location.search == '')) {
			temp = location.search.split('=');
			location.replace('http://www.clever-mediagroup.de/#'+temp[1]);
		}
		this.iframe = false;
		if (temp[1]=='start') {
			this.page.start();
			this.ajax.breaker='home.php';
		} else {
			$('#ajaxBlock2').css('display', 'block');

			(temp[1]=='impressum')	&& (this.ajax.nowTemp.push('ueberuns.php') && (this.ajax.nowTemp.push('impressum.php') && (this.nav.positionNew = 1)));
			(temp[1]=='kontakt')	&& (this.ajax.nowTemp.push('ueberuns.php') && (this.ajax.nowTemp.push('kontakt.php') && (this.nav.positionNew = 1)) && (this.ajax.nowSub=8));
			(temp[1]=='links')		&& (this.ajax.nowTemp.push('ueberuns.php') && (this.ajax.nowTemp.push('links.php') && (this.nav.positionNew = 1)));
			
			(temp[1]=='home')		&& (this.ajax.nowTemp.push('home.php')			&& (this.nav.positionNew = 0) && (this.iframe=true));
			(temp[1]=='ueber-uns')	&& (this.ajax.nowTemp.push('ueberuns.php')		&& (this.nav.positionNew = 1));
			(temp[1]=='film')		&& (this.ajax.nowTemp.push('film.php')			&& (this.nav.positionNew = 2));
			(temp[1]=='foto')		&& (this.ajax.nowTemp.push('foto.php')			&& (this.nav.positionNew = 3));
			(temp[1]=='ton')		&& (this.ajax.nowTemp.push('ton.php')			&& (this.nav.positionNew = 4));
			(temp[1]=='web')		&& (this.ajax.nowTemp.push('web.php')			&& (this.nav.positionNew = 5));
			(temp[1]=='marketing')	&& (this.ajax.nowTemp.push('marketing.php')		&& (this.nav.positionNew = 6));
			(temp[1]=='print')		&& (this.ajax.nowTemp.push('print.php')			&& (this.nav.positionNew = 7));
			(temp[1]=='kuenstler')	&& (this.ajax.nowTemp.push('kuenstler.php')		&& (this.nav.positionNew = 8));
			(temp[1]=='referenzen')	&& (this.ajax.nowTemp.push('referenzen.php')	&& (this.nav.positionNew = 9));
		// über uns
			(temp[2] == 'philosophie')			&& (this.ajax.nowTemp.push('philosophie.php')	&& (this.ajax.nowSub=0));
			(temp[2] == 'location')				&& (this.ajax.nowTemp.push('location.php')		&& (this.ajax.nowSub=1));
			(temp[2] == 'mieten')				&& (this.ajax.nowTemp.push('mieten.php')		&& (this.ajax.nowSub=2));
			(temp[2] == 's-referenzen')			&& (this.ajax.nowTemp.push('sreferenzen.php')	&& (this.ajax.nowSub=3));
			(temp[2] == 'jobs')					&& (this.ajax.nowTemp.push('jobs.php')			&& (this.ajax.nowSub=4));
			(temp[2] == 'webcam')				&& (this.ajax.nowTemp.push('webcam.php')		&& (this.ajax.nowSub=5));
			(temp[2] == 'anfahrt')				&& (this.ajax.nowTemp.push('anfahrt.php')		&& (this.ajax.nowSub=6));
			(temp[2] == 'kontakt')				&& (this.ajax.nowTemp.push('kontakt.php') 		&& (this.ajax.nowSub=7));
		// film
			(temp[2] == 'werbespot')		&& (this.ajax.nowTemp.push('werbespot.php')			&& (this.ajax.nowSub=0));
			(temp[2] == 'imagefilm')		&& (this.ajax.nowTemp.push('imagefilm.php')			&& (this.ajax.nowSub=1));
			(temp[2] == 'produktvideo')		&& (this.ajax.nowTemp.push('produktvideo.php')		&& (this.ajax.nowSub=2));
			(temp[2] == 'reportage')		&& (this.ajax.nowTemp.push('reportage.php')			&& (this.ajax.nowSub=3));
			(temp[2] == 'virtual-tv')		&& (this.ajax.nowTemp.push('virtualtv.php')			&& (this.ajax.nowSub=4));
			(temp[2] == 'firmen-tv')		&& (this.ajax.nowTemp.push('firmentv.php')			&& (this.ajax.nowSub=5));
			(temp[2] == '3d-film')			&& (this.ajax.nowTemp.push('3dfilm.php')			&& (this.ajax.nowSub=6));
			(temp[2] == 'film-mietstudio')	&& (this.ajax.nowTemp.push('filmmietstudio.php')	&& (this.ajax.nowSub=7));
			
			(temp[2] == 'start-now')		&& (this.ajax.nowTemp.push('film_start_now.php')	&& (this.ajax.nowSub=8));
		// foto
			(temp[2] == 'fashion-shooting')		&& (this.ajax.nowTemp.push('fashionshooting.php')	&& (this.ajax.nowSub=0));
			(temp[2] == 'produktfotografie')	&& (this.ajax.nowTemp.push('produktfotografie.php')	&& (this.ajax.nowSub=1));
			(temp[2] == 'presse')				&& (this.ajax.nowTemp.push('presse.php')			&& (this.ajax.nowSub=2));
			(temp[2] == 'eventfotos')			&& (this.ajax.nowTemp.push('eventfotos.php')		&& (this.ajax.nowSub=3));
			(temp[2] == 'foto-360-panorama')	&& (this.ajax.nowTemp.push('foto360panorama.php')	&& (this.ajax.nowSub=4));
			(temp[2] == '3d-fotografie')		&& (this.ajax.nowTemp.push('3dfotografie.php')		&& (this.ajax.nowSub=5));
			(temp[2] == 'foto-mietstudio')		&& (this.ajax.nowTemp.push('fotomietstudio.php')	&& (this.ajax.nowSub=6));
		// ton
			(temp[2] == 'jingle')			&& (this.ajax.nowTemp.push('jingle.php')			&& (this.ajax.nowSub=0));
			(temp[2] == 'voice-over')		&& (this.ajax.nowTemp.push('voiceover.php')			&& (this.ajax.nowSub=1));
			(temp[2] == 'synchronisierung')	&& (this.ajax.nowTemp.push('synchronisierung.php')	&& (this.ajax.nowSub=4));
			(temp[2] == 'radiospot')		&& (this.ajax.nowTemp.push('radiospot.php')			&& (this.ajax.nowSub=2));
			(temp[2] == 'hoerbuch')			&& (this.ajax.nowTemp.push('hoerbuch.php')			&& (this.ajax.nowSub=3));
			(temp[2] == 'ton-mietstudio')	&& (this.ajax.nowTemp.push('tonmietstudio.php')		&& (this.ajax.nowSub=5));
		// web
			(temp[2] == 'webdesign')				&& (this.ajax.nowTemp.push('webdesign.php')					&& (this.ajax.nowSub=0));
			(temp[2] == 'moderierte-webseiten')		&& (this.ajax.nowTemp.push('moderiertewebseiten.php')		&& (this.ajax.nowSub=1));
			(temp[2] == 'web-360-panorama')			&& (this.ajax.nowTemp.push('web360panorama.php')			&& (this.ajax.nowSub=2));
			(temp[2] == 'seo-google-optimireung')	&& (this.ajax.nowTemp.push('seo.php')						&& (this.ajax.nowSub=3));
			(temp[2] == 'shopsysteme')				&& (this.ajax.nowTemp.push('shopsysteme.php')				&& (this.ajax.nowSub=4));
			(temp[2] == 'pflege-und-aktualisierung')	&& (this.ajax.nowTemp.push('aktualisierungsservice.php')	&& (this.ajax.nowSub=5));
		// marketing
			(temp[2] == 'klassisches-marketing')	&& (this.ajax.nowTemp.push('klassischesmarketing.php')	&& (this.ajax.nowSub=0));
			(temp[2] == 'onlinemarketing')			&& (this.ajax.nowTemp.push('onlinemarketing.php')		&& (this.ajax.nowSub=1));
			(temp[2] == 'virales-marketing')		&& (this.ajax.nowTemp.push('viralesmarketing.php')		&& (this.ajax.nowSub=2));
			(temp[2] == 'corporate-design')			&& (this.ajax.nowTemp.push('corporatedesign.php')		&& (this.ajax.nowSub=3));
			(temp[2] == 'logodesign')				&& (this.ajax.nowTemp.push('logodesign.php')			&& (this.ajax.nowSub=4));
			(temp[2] == 'm-werbemittel')			&& (this.ajax.nowTemp.push('marketingwerbemittel.php')	&& (this.ajax.nowSub=5));
		// Print
			(temp[2] == 'flyer')					&& (this.ajax.nowTemp.push('flyer.php')						&& (this.ajax.nowSub=0));
			(temp[2] == 'broschueren')				&& (this.ajax.nowTemp.push('broschueren.php')				&& (this.ajax.nowSub=1));
			(temp[2] == 'poster')					&& (this.ajax.nowTemp.push('poster.php')					&& (this.ajax.nowSub=2));
			(temp[2] == 'cd-dvd-druck')				&& (this.ajax.nowTemp.push('cddvddruck.php')				&& (this.ajax.nowSub=3));
			(temp[2] == 'pvc-banner')				&& (this.ajax.nowTemp.push('pvcbanner.php')					&& (this.ajax.nowSub=4));
			(temp[2] == 'folien')			&& (this.ajax.nowTemp.push('folienbuchstaben.php')			&& (this.ajax.nowSub=5));
			(temp[2] == 'textildruck')				&& (this.ajax.nowTemp.push('textildruck.php')				&& (this.ajax.nowSub=6));
			(temp[2] == 'werbemittel')				&& (this.ajax.nowTemp.push('werbemittel.php')				&& (this.ajax.nowSub=7));
			(temp[2] == 'fahrzeugbeschriftungen')	&& (this.ajax.nowTemp.push('fahrzeugbeschriftungen.php')	&& (this.ajax.nowSub=8));
		// künstler
			(temp[2] == 'datenbankeintrag')	&& (this.ajax.nowTemp.push('datenbankeintrag.php')	&& (this.ajax.nowSub=0));
			(temp[2] == 'model-schauspieler-suchen')	&& (this.ajax.nowTemp.push('datenbanksuchen.php')	&& (this.ajax.nowSub=1));
			(temp[2] == 'offenes-casting')	&& (this.ajax.nowTemp.push('offenescasting.php')	&& (this.ajax.nowSub=2));
			(temp[2] == 'stellenboerse')		&& (this.ajax.nowTemp.push('stellenboerse.php')		&& (this.ajax.nowSub=3));
			(temp[2] == 'veranstaltungen')	&& (this.ajax.nowTemp.push('veranstaltungen.php')	&& (this.ajax.nowSub=4));
			this.ajax.now();
		}
	},
	iframe: false,
	iframeBlock: false,
	video: function(x){
		if (ego.apps.appLayer3) {
			if (x) {
				$('#iframe').animate({width: 120, height: 68, left:504, top: 256}, 500);
				$('#videoPop').css('display', 'block');
			} else {
				$('#iframe').animate({width: 480, height: 270, left:58, top: 35}, 500);
				$('#videoPop').css('display', 'none');
			}
		} else {
			if (x == 'start') {
				$('#iframeStart').animate({width: 533, height: 300, left:0, top: 105}, 500);
			} else if (x) {
				$('#iframe').animate({width: 120, height: 68, left:601, top: 314}, 500);
				$('#videoPop').css('display', 'block');
			} else {
				$('#iframe').animate({width: 533, height: 300, left:0, top: 0}, 500);
				$('#videoPop').css('display', 'none');
			}
		}
	},
	page: ({
		h: 0,
		start: function(){
			ego.page.starting = true;
			$('#startClose').animate({opacity: 0}, 0);
			$('#mainTemplate').animate({opacity: 0}, 0);
			$('#starterVideo').animate({opacity: 0}, 0);
			$('#starter').animate({opacity: 0}, 0);
			$('#starter').css('display', 'block');
			$('#starter').animate({opacity: 1}, 2000,function(){
				var w=$(window).width();
				var h=$(window).height();
				if (w>1100 || h>700) {
					w=952; h=534; t=-1;
				} else if (w<1101 && h<701) {
					w=680; h=383; t=-1;
				}
				this.h=h;
				$('#starterVideo').css('display', 'block');
				$('#starterVideo').html('<iframe id="iframeStart" src="http://player.vimeo.com/video/20474331?title=0&amp;byline=0&amp;portrait=0&amp;color=e8208e&amp;autoplay=1" width="'+w+'" height="'+h+'" frameborder="0" style="position:relative; top:'+t+'px; overflow:hidden;"></iframe>');
				$('#iframeStart').animate({height:0}, 0);
				if (h == 534) {$('#iframeStart').animate({height: 534}, 0);} else {$('#iframeStart').animate({height: 383}, 0);}
				if(ego.stoper) {
					$('#starterVideo').animate({opacity: 1}, 1000, function(){
						setTimeout('ego.page.showBackground()',4000);
					});
				}
			});
		},
		showBackground: function(){
			if(ego.stoper) {
				ego.page.show = true;
				ego.page.background(false);
				setTimeout('ego.page.hideBigLogo()', 15500);
			}
		},
		hideBigLogo: function(){
			$('#startClose').animate({opacity: 0}, 1000);
			if(ego.stoper) {
				$('#startLogo').animate({opacity: 0}, 1000, function(){
					if(ego.stoper) {
						$('#mainTemplate').animate({opacity: 1}, 4000, function(){
							if(ego.stoper) {
								$('#underHeader > #subNav').animate({opacity: 0}, 0);
								setTimeout('ego.page.step4()', 13000);
							}
						});
					}
				});
			}
		},
		step4: function(){
			if(ego.stoper) {
				ego.video('start');
				setTimeout('ego.page.step5()', 500);
			}
		},
		step5: function (){
			if(ego.stoper) {
				if (ego.page.starting) {
				$('#starter').add('#starterVideo').animate({opacity: 0}, 400, function(){
					$('#starterVideo').add('#starter').detach();
				});
				ego.page.starting = false;
			}
			if (!(ego.nav.aktiv)) {
				ego.nav.aktiv = true;
				ego.nav.positionOld = ego.nav.positionNew;
				ego.nav.positionNew = 0;
				ego.nav.action();
				ego.ajax.action('home.php');
			}
				//$('#footerPopup').css('display', 'block');
				//$('#footerPopup').animate({opacity: 1}, 2000);
			}
		},
		showBG: false,
		resize: function () {
			var w=$(window).width();
			var h=$(window).height();
			var t = (h-645)/2;
			t = parseInt(t + 0.5);
			if (t>50) { t=50; }
			if (t<0) { t=0; }
			$('#topPedding').height(t);
			$('#starter').css('top', t+'px');
			$('#starterVideo').css('top', (t+95)+'px');
			var t = ((799-h)/2)+3;
			if (t<30) {t=30;}
			if (t>80) {t=80;}
			h = t+h-1;
			h = parseInt(h + 0.5);
			t=0-t;
			$('#background').height(h);
			$('#background').css('top', t+'px');
			var l = ((2635-w)/2)-36;
			w = l+w-1;
			w = parseInt(w + 0.5);
			l = 0-l;
			$('#background').width(w);
			$('#background').css('left', l+'px');
			this.background(false);
		},
		timeT: true,
		time: function (x) {
			if (this.timeT) {
				this.timeT = false;
				setTimeout('ego.page.time("wait")',1000);
				return true;
			} else if (x == 'wait') {
				this.timeT = true;
				this.background(true);
				return false;
			} else if (x == 'test') {
				return false;
			}
		},
		show: true,
		starting: false,
		background: function (x) {
			if ((x || this.time('test')) && this.show) {
				var w=$(window).width();
				var h=$(window).height();
				if ((w>1100 || h>700) && !(this.showBG)) {
					this.showBG = true;
					if (this.starting) {
						$('#background').animate({opacity: 1}, 5000);
					} else {
						$('#background').animate({opacity: 1}, 'fast');
					}
				} else if ((w<1101 && h<701) && this.showBG) {
					this.showBG = false;
					$('#background').animate({opacity: 0}, 'fast');
				}	
			} else if (!(this.show)) { $('#background').animate({opacity: 0}, 0); }
		},
		newsActiv: 0,
		news: function (){
			this.newsActiv++;
			if (!(this.newsActiv < ego.cach.news.length)) { this.newsActiv = 0; }
			$('#footer > #footerTemp').html(ego.cach.news[this.newsActiv]);
			$('#ActionLayer10').add('#ActionLayer11').click();
			setTimeout('ego.page.news()',6000);
		}
	}),
	nav: ({
  		aktiv: false,
		position: new Array(0, 84, 163, 221, 285, 346, 429, 514, 591, 689),
		positionOld: 0,
		positionNew: 0,
		action: function (){
			if (this.ready) {
				var temp = this.position[this.positionNew] - this.position[this.positionOld];
				this.temp[0] = $('#overHeaderRight').width();
				this.temp[1] = $('#overNavR').width();
				this.temp[3] = $('#overNavL').width();
				this.temp[5] = document.getElementById('inOverHeader').style.left;
				this.temp[5] = this.temp[5].replace(/px/g, "");
				this.temp[5] = this.temp[5]*1;
				this.temp[5] = this.temp[5] + temp;
				this.temp[0] = this.temp[0] - temp;
				if (this.temp[1] < 1) {this.temp[1] = -10}
				this.temp[1] = this.temp[1] - temp;
				if (this.positionNew == 0) {this.temp[3] = 0;}
				else if (this.positionOld == 0) {this.temp[3] = this.temp[3] + temp - 23;}
				else {this.temp[3] = this.temp[3] + temp;}
				$('#ActionLayer1').add('#ActionLayer3').add('#ActionLayer2').add('#ActionLayer4').click();	
				
			}
		},
		temp: new Array(),
		ready: false,
		free: function(level){
			if (level == 'main') {
				if (!(this.ready)) {
					this.ready = true;
					$('#ajaxBlock2').animate({opacity: 0}, 500, function(){
						$('#ajaxBlock2').css('display', 'none');
					});
					$('#ajaxBlock').css('display', 'none');
					$('#mainTemplate').css('display', 'block');
					if(ego.page.starting) {
						$('#startClose').css('visibility', 'visible');
						$('#startClose').animate({opacity: 1}, 1000);
					}
				}
			} else {
				if (ego.ajax.url2 == level) {
					$('#ActionLayer12').click();
				}
			}
		}
	}),
	cach: ({
		next: false,
		pageDOM: new Array(),
		pageMAP: new Array(),
		pagePIC: new Array(),
		news: new Array(),
		newsData: new Array(),
		complet: false,
		input: function (){
			this.checkMAP[0] = new Array();
			$('#ego > #map > div > a').map(function(){ ego.cach.pageMAP.push([$(this).attr('href'), $(this).attr('name'), false, $(this).parent().attr('id') ]); });
			$('#ego > #map > div').map(function(){ ego.cach.checkMAP[$(this).attr('id')] = false; ego.cach.checkMAP[0].push($(this).attr('id')); });
			ego.ajax.load.take();
			ego.ajax.load.pic();
			this.progress();
		},
		req: function (id){
			var data = this.pageDOM[this.pageMAP[id][0]]
			$('#ego > #temp').html('<div id="temp'+id+'">'+data+'</div>');
			this.pageDOM[this.pageMAP[id][0]] = new Array(
				$('#ego > #temp > #temp'+id+' > #url').html(),
				$('#ego > #temp > #temp'+id+' > #subNav').html(),
				$('#ego > #temp > #temp'+id+' > #layer').html(),
				$('#ego > #temp > #temp'+id+' > #page').html(),
				$('#ego > #temp > #temp'+id+' > #appLayer').html()
			);
			$('#ego > #temp > #temp'+id).detach();
			this.pageMAP[id][2] = true;
		},
		newsReq: function(id){
			var data = this.pageDOM[this.pageMAP[id][0]]
			$('#ego > #temp').html('<div id="temp'+id+'">'+data+'</div>');
			$('#ego > #temp > #temp'+id+' > a').map(function(){ ego.cach.news.push($(this).html()); });
			$('#ego > #temp > #temp'+id+' > p').map(function(){ ego.cach.newsData.push($(this).html()); });
			$('#footer > #footerTemp').html(this.news[ego.page.newsActiv]);
			$('#ActionLayer10').add('#ActionLayer11').click();
			$('#ego > #temp > #temp'+id).detach();
			this.pageMAP[id][2] = true;
		},
		checkMAP: new Array(),
		progress: function (){
			var allComplete = true;
			for (var i=0; i<this.checkMAP[0].length; i++){
				if(!( this.checkMAP[this.checkMAP[0][i]] )) {
					this.checkMAP[this.checkMAP[0][i]] = true;
					for (var j=0; j<this.pageMAP.length; j++) {
						if ((this.pageMAP[j][3] == this.checkMAP[0][i]) && (this.pageMAP[j][1] == 'dom' || this.pageMAP[j][1] == 'news')) {
							if (!(this.pageMAP[j][2])) { this.checkMAP[this.checkMAP[0][i]] = false; }
							if (!(this.pageMAP[j][2])) { allComplete = false; }
						}
					}
					if (this.checkMAP[this.checkMAP[0][i]]) { ego.nav.free(this.checkMAP[0][i]);}
				}
			}
			if (!(allComplete)) {
				setTimeout('ego.cach.progress()',100);
			}
		}
	}),
	ajax: ({
		nowPage: new Array(false, false, false, false),
		nowTemp: new Array(),
		nowActiv: 0,
		nowSub: null,
		now: function () {
			if (this.nowActiv < this.nowTemp.length) {
				this.url=this.nowTemp[this.nowActiv];
				if (this.nowActiv == 0){
					this.breaker=this.nowTemp[this.nowActiv];
					this.url2=this.nowTemp[this.nowActiv];
				}
				$.ajax({
					url: ego.ajax.url+'?v=ajax',
					success: function(data){
						$('#ego > #temp').html('<div id="tempNow">'+data+'</div>');
						if(!($('#ego > #temp > #tempNow > #subNav').html() == null)) {
							ego.ajax.nowPage[0] = $('#ego > #temp > #tempNow > #subNav').html();
						}
						if(!($('#ego > #temp > #tempNow > #layer').html() == null)) {
							ego.ajax.nowPage[1] = $('#ego > #temp > #tempNow > #layer').html();
						}
						if(!($('#ego > #temp > #tempNow > #page').html() == null)) {
							ego.ajax.nowPage[2] = $('#ego > #temp > #tempNow > #page').html();
						}
						if(!($('#ego > #temp > #tempNow > #appLayer').html() == null)) {
							ego.ajax.nowPage[3] = $('#ego > #temp > #tempNow > #appLayer').html();
						}
						if(!($('#ego > #temp > #tempNow > #url').html() == null)) {
							ego.ajax.nowPage[4] = $('#ego > #temp > #tempNow > #url').html();
						}
						$('#ego > #temp > #tempNow').detach();
						ego.ajax.nowActiv++;
						ego.ajax.now();
					}
				});
			} else { this.nowShow(); }
		},
		nowShow: function(){
			if(this.nowPage[1]) { 	$('#content > #layer > #layerAktiv').html(this.nowPage[1]);
									$('#content > #layer').animate({opacity: 1, top: 0}, 0);
									this.layer = true;
			}
			ego.cach.next=this.breaker;
			if (this.breaker == 'home.php') {
				$('#appLayer3').css('visibility', 'visible');
				$('#app2Closer').css('display', 'none');
				jQuery('#underHeader > #subNav').html('<div align="center" style="width:100%; color:#c9f;">Clever Mediagroup - Heerdter Landstrasse 245 - 40549 D&uuml;esseldorf - Tel.: 0211/50656191 - mail: info@clever-mediagroup.de</div>');
				setTimeout('iFrameHome()',800);
				setTimeout('homepage()',900);
			} else {
				if(this.nowPage[2]) { 	$('#content > #page').html(this.nowPage[2]); }
			}
			if(this.nowPage[3]) { 	$('#content > #layer > #layerAktiv > #picture > #picture2').html(this.nowPage[3]);								
									$('#content > #layer > #layerAktiv > #picture > #picture2').animate({width: 950}, 0);
									$('#content > #layer > #layerAktiv > #picture > #picture2 > #fotoPics').animate({opacity: 1, left: 0}, 0);
									this.subLayer = true;
			}
			var temp = ego.nav.position[ego.nav.positionNew] - ego.nav.position[ego.nav.positionOld];
			var temp2 = new Array();
			temp2[0] = $('#overHeaderRight').width();
			temp2[1] = $('#overNavR').width();
			temp2[3] = $('#overNavL').width();
			if (window.MY_BROWSER == 'Firefox') { temp2[4] = temp2[4]+5; }
			temp2[0] = temp2[0] - temp;
			if (this.temp[1] < 1) {this.temp[1] = -20}
			temp2[1] = temp2[1] - temp;
			if (this.positionNew == 0) {temp2[3] = 0;}
			else {	temp2[3] = temp2[3] + temp - 23;}
			temp2[5] = document.getElementById('inOverHeader').style.left;
			temp2[5] = temp2[5].replace(/px/g, "");
			temp2[5] = temp2[5]*1;
			temp2[5] = temp2[5] + temp;
			$('#overHeaderRight')	.animate({width: temp2[0]}, 0);
			$('#overNavR')			.animate({width: temp2[1]}, 0);
			$('#overNavL')			.animate({width: temp2[3]}, 0);
			$('#inOverHeader')		.animate({left: temp2[5]}, 0);
			
			ego.links();
			if(!(this.nowSub == null)) { $('a.subNav:eq('+this.nowSub+')').toggleClass('activeSub'); }
			var temp3 = ego.ajax.nowPage[4].split ('/');
			if (temp3[0] == '#') {
				temp3.shift();
			}
			if (temp3.length > 0) {
				temp3 = temp3.join(" - ");
				temp3 = "Clever I Mediagroup - " + temp3;
				$('title').html(temp3);
			} else { $('title').html("Clever I Mediagroup"); }
			
			if (this.breaker == 'home.php') {
				//$('#footerPopup').css('display', 'block');
				//$('#footerPopup').animate({opacity: 1}, 2000);
				$('#iFrameBlock').css('display', 'none');
			} else {
				$('#footer').css('display', 'none');
				$('#footer2').css('display', 'block');
			}
		},
		layer: false,
		temp: false,
		url: false,
		url2: false,
		c: false,
		load: ({
			progress: false,
			aktive: 0,
			take: function(){
				var temp = false;
				
				if (ego.cach.next && ego.cach.checkMAP['main']) {
					for (var i=0; i<ego.cach.pageMAP.length; i++){
						if ((ego.cach.pageMAP[i][3] == ego.cach.next) && !(ego.cach.pageMAP[i][2]) && (ego.cach.pageMAP[i][1] == 'dom' || ego.cach.pageMAP[i][1] == 'news')) {
							this.aktive = i;
							i = ego.cach.pageMAP.length;
							temp = true;
						}
					}
					if (!(temp)) { ego.cach.next = false; }
				}
				if (!(temp)) {
					for (var i=0; i < ego.cach.pageMAP.length; i++) {
						if(!(ego.cach.pageMAP[i][2]) && (ego.cach.pageMAP[i][1] == 'dom' || ego.cach.pageMAP[i][1] == 'news')) {
							this.aktive = i;
							i = ego.cach.pageMAP.length;
							temp = true;
						}
					}
				}
				if(temp) {
					$.ajax({
						url: ego.cach.pageMAP[ego.ajax.load.aktive][0]+'?v=ajax',
						success: function (data){
							ego.cach.pageDOM[ego.cach.pageMAP[ego.ajax.load.aktive][0]] = data;
							if (ego.cach.pageMAP[ego.ajax.load.aktive][1] == 'news') {
								ego.cach.newsReq(ego.ajax.load.aktive);
							} else {
								ego.cach.req(ego.ajax.load.aktive);
							}
							ego.ajax.load.take();
						}
					});
				}
			},
			picActiv: 0,
			pic: function (){
				if (this.picActiv < ego.cach.pageMAP.length) {	
					if (ego.cach.pageMAP[this.picActiv][1] == 'pic') {
						ego.cach.pagePIC[this.picActiv] = new Image();
						ego.cach.pagePIC[this.picActiv].src = ego.cach.pageMAP[this.picActiv][0];
						this.wait();
					} else {
						this.picActiv++;
						this.pic();
					}
				}
			},
			wait: function (){
				if (ego.cach.pagePIC[this.picActiv].complete == true) {
					ego.cach.pageMAP[this.picActiv][2] = true;
					this.picActiv++;
					this.pic();
				} else { setTimeout("ego.ajax.load.wait()", 100); }
			}
		}),
		breaker: '',
		action: function(url){
			if (ego.nav.ready) {
				$('#appCloser').click();
				$("a.activeSub").toggleClass("activeSub");
				this.url=url;
				this.url2=url;
				this.breaker=url;
				ego.cach.next=this.url2;
				if (url == 'home.php') {
					$('#footer2').animate({opacity: 0}, 400, function(){
						$('#footer').css('display', 'block');
						$('#footer2').css('display', 'none');
						//$('#footerPopup').css('display', 'block');
						//$('#footerPopup').add('#footer').animate({opacity: 1}, 400);
						$('#footer').animate({opacity: 1}, 400);
					});
					$('#content > #page').animate({opacity: 0}, 400, function(){
						$('#PageText2').animate({opacity: 1}, 0);
						$('#PageText').animate({opacity: 1}, 0);
						
						if (ego.ajax.layer) {
							ego.ajax.layer = false;
							$('#ActionLayer9').add('#ActionLayer12').click();
						} else {
							$('#ActionLayer12').click();
						}
						$('#app2Closer').css('display', 'none');
						$('#appLayer3').css('visibility', 'visible');
						
						setTimeout('iFrameHome()',800);
						ego.ajax.subLayer = false;
						location.href = '#/'+ego.cach.pageDOM[ego.ajax.url][0];
						$('title').html("Clever I Mediagroup");
						ego.nav.aktiv = false;
						setTimeout('homepage()',2000);
					});
				} else {
					//$('#footerPopup').add('#footer').animate({opacity: 0}, 400, function(){
					$('#footer').animate({opacity: 0}, 400, function(){
						//$('#footerPopup').css('display', 'none');
						$('#footer').css('display', 'none');
						$('#footer2').css('display', 'block');
					});
					$('#app2Closer').css('display', 'block');
					$('#footer2').animate({opacity: 1}, 500);
					$('#appLayer3').css('visibility', 'hidden');
					$('#app2HTML').html('');
					if (!(ego.cach.pageDOM[url][2] == null)) {
						if (this.layer) {
							$('#content > #layer > #layerTemp').html(ego.cach.pageDOM[url][2]);
							$('#content > #layer > #layerTemp > #picture').css('height', '0px');
							$('#ActionLayer6').add('#ActionLayer7').add('#ActionLayer12').click();
						} else {
							
							$('#content > #layer > #layerAktiv').html(ego.cach.pageDOM[url][2]);
							$('#ActionLayer6').add('#ActionLayer8').add('#ActionLayer12').click();
						}
						this.layer = true;
					} else if (this.layer) {
						this.layer = false;
						$('#ActionLayer6').add('#ActionLayer9').add('#ActionLayer12').click();
					} else {
						$('#ActionLayer6').add('#ActionLayer12').click();
					}
					this.subLayer = false;
					location.href = '#/'+ego.cach.pageDOM[url][0];
					var temp3 = ego.cach.pageDOM[url][0].split ('/');
					if (temp3[0] == '#') {
						temp3.shift();
					}
					if (temp3.length > 0) {
						temp3 = temp3.join(" - ");
						temp3 = "Clever I Mediagroup - " + temp3;
						$('title').html(temp3);
					} else { $('title').html("Clever I Mediagroup"); }
				}
			}
		},
		input: function(){
			$('#content > #page').html(ego.cach.pageDOM[this.url][3]);
		},
		subLayer: false,
		subNav: function(url){
			if (ego.nav.ready) {
				$('#appCloser').click();
				this.url=url;
				if (!(url == 'home.php')) {
					if ((url == 'impressum.php') || (url == 'kontakt.php') || (url == 'links.php')) {  }
					ego.cach.next=this.url2;
					if (!(ego.cach.pageDOM[url][4] == null)) {
						if (this.subLayer){
							$('#ActionLayer6').add('#ActionLayer14').click();
						} else {
							$('#content > #layer > #layerAktiv > #picture > #picture2').html(ego.cach.pageDOM[this.url][4]);
							$('#ActionLayer6').add('#ActionLayer13').add('#ActionLayer16').click();
						}
						this.subLayer = true;
					} else {
						//$('#footerPopup').add('#footer').animate({opacity: 0}, 400, function(){
						$('#footer').animate({opacity: 0}, 400, function(){
							//$('#footerPopup').css('display', 'none');
							$('#footer').css('display', 'none');
							$('#footer2').css('display', 'block');
						});
						$('#app2Closer').css('display', 'block');
						$('#footer2').animate({opacity: 1}, 500);
						$('#appLayer3').css('visibility', 'hidden');
						$('#app2HTML').html('');
						if ((url == 'impressum.php') || (url == 'kontakt.php') || (url == 'links.php')) {
							if (this.layer) {
								if (!(ego.ajax.url2 == 'ueberuns.php')) {
									ego.ajax.url2='ueberuns.php';
									$('#content > #layer > #layerTemp').html(ego.cach.pageDOM['ueberuns.php'][2]);
									$('#content > #layer > #layerTemp > #picture').css('height', '0px');
									$('#ActionLayer6').add('#ActionLayer7').add('#ActionLayer12').click();
								} else {
									$('#ActionLayer6').click();
								}
							} else {
								ego.ajax.url2='ueberuns.php';
								$('#content > #layer > #layerAktiv').html(ego.cach.pageDOM['ueberuns.php'][2]);
								$('#ActionLayer6').add('#ActionLayer8').add('#ActionLayer12').click();
							}
							$("a.activeSub").toggleClass("activeSub");
							if (ego.ajax.url == 'kontakt.php') {$('a.subNav:eq(7)').toggleClass('activeSub');}
							this.layer = true;
						} else if (this.subLayer) {
							$('#ActionLayer6').add('#ActionLayer15').click();
						} else {
							if ((url == 'impressum.php') || (url == 'kontakt.php') || (url == 'links.php')) {
								$('#ActionLayer6').add('#ActionLayer12').click();
							} else {
								$('#ActionLayer6').click();
							}
						}
						this.subLayer = false;
					}
					location.href = '#/'+ego.cach.pageDOM[url][0];
					var temp3 = ego.cach.pageDOM[url][0].split ('/');
					if (temp3[0] == '#') {
						temp3.shift();
					}
					if (temp3.length > 0) {
						temp3 = temp3.join(" - ");
						temp3 = "Clever I Mediagroup - " + temp3;
						$('title').html(temp3);
					} else { $('title').html("Clever I Mediagroup"); }
				} else { ego.nav.aktiv = false; }
			}
		}
	}),
	apps: ({
		footer: function(){
			$('#popupClose').click();
			if (!(ego.cach.newsData[ego.page.newsActiv] == 'none')) {
				if ($('#appLayer2').css('visibility') == 'hidden') {
					ego.video(true);
					if (ego.nav.positionNew == 0) {
						$('#appShadow').add('#appLayer2').css('height', '511px');
						$('#appShadow').add('#appLayer2').css('top', '0px');
					} else {
						$('#appShadow').add('#appLayer2').css('height', '383px');
						$('#appShadow').add('#appLayer2').css('top', '128px');
					}
					$('#appHTML').css('top', '0px');
					$('#appHTML').css('left', '0px');
					$('#appHTML').css('width', '950px');
					$('#appHTML').html(ego.cach.newsData[ego.page.newsActiv]);
					$('#appShadow').add('#appLayer2').css('visibility', 'visible');
					$('#appShadow').animate({opacity: 0.6}, 300);
					$('div.PageText').animate({opacity: 0.2}, 300);
					$('#appLayer2').animate({opacity: 1}, 400);
				} else {
					$('#appLayer2').animate({opacity: 0}, 300, function(){
						$('#appHTML').css('top', '0px');
						$('#appHTML').css('left', '0px');
						$('#appHTML').css('width', '950px');
						$('#appLayer2').css('text-align', 'left');
						$('#appHTML').html(ego.cach.newsData[ego.page.newsActiv]);
						$('#appLayer2').animate({opacity: 1}, 300);
					});
				}
			}
		},
		appLayer3: false,
		attr: '',
		temp: '',
		addGallery: false,
		picture: function(url, attr){
			
			this.attr = attr.split ('::');
			this.temp = url;
			if (this.attr[1] != 'none') {
				this.attr[1] = this.attr[1].split (',');
				var temp = '<ul>';
				for (i=0; i<ego.apps.attr[1].length; i++) {
					var temp2 = ego.apps.attr[1][i].split(':');
					temp = temp +'<li><a style="color:#fff;"><b>'+ temp2[0] +':</b> '+ temp2[1] +'<a></li>';
				}
				temp = temp +'</ul>';
				$('#app3HTML2').html(temp);
			}
			if (this.appLayer3) {
				if (this.attr[1] != 'none') {
					$('#app3HTML').animate({opacity: 0}, 700, function(){
						if (ego.apps.attr[0] == 'pic') {
							$('#linkVideo').css('display', 'none');
							$('#linkGallery').css('display', 'block');
							$('#linkGallery2').css('display', 'none');
						} else if (ego.apps.attr[0] == 'video') {
							$('#linkVideo').css('display', 'block');
							$('#linkGallery').css('display', 'none');
							$('#linkGallery2').css('display', 'none');
						}
						if (this.attr[2] == 'gallery') {
							$('#linkGallery2').css('display', 'block');
						} else {
							$('#linkGallery2').css('display', 'none');
						}
						$('#linkInfos').css('display', 'block');
						$('#linkGallery > a').addClass("activeApp");
						$('#linkVideo > a').addClass("activeApp");
						$('#linkInfos > a').removeClass('activeApp');
						$('#linkGallery2 > a').removeClass('activeApp');
					});
				} else {
					$('#app3HTML').animate({opacity: 0}, 700, function(){
						$('#linkVideo').css('display', 'none');
						$('#linkGallery').css('display', 'none');
						$('#linkInfos').css('display', 'none');
						$('#linkGallery2').css('display', 'none');
						$('#app3HTML2').html('');
					});
				}
				ego.iframeBlock = true;
				setTimeout('ego.apps.iFrameChange("'+ego.apps.temp+'")',500);
			} else {
				if (this.attr[1] != 'none') {
					if (ego.apps.attr[0] == 'pic') {
						$('#linkVideo').css('display', 'none');
						$('#linkGallery').css('display', 'block');
					} else if (ego.apps.attr[0] == 'video') {
						$('#linkVideo').css('display', 'block');
						$('#linkGallery').css('display', 'none');
					}
					if (this.attr[2] == 'gallery') {
						$('#linkGallery2').css('display', 'block');
					} else {
						$('#linkGallery2').css('display', 'none');
					}
					$('#linkInfos').css('display', 'block');
					$('#linkGallery > a').addClass("activeApp");
					$('#linkVideo > a').addClass("activeApp");
					$('#linkInfos > a').removeClass('activeApp');
					$('#linkGallery2 > a').removeClass('activeApp');
				} else {
					$('#linkVideo').css('display', 'none');
					$('#linkGallery').css('display', 'none');
					$('#linkInfos').css('display', 'none');
					$('#linkGallery2').css('display', 'none');
					$('#app3HTML2').html('');
				}
				$('#app2Closer').animate({opacity: 0}, 0);
				$('#appLayer3').css('visibility', 'visible');
				$('#PageText').add('#PageText2').animate({opacity: 0}, 600)
				$('#app2Closer').animate({opacity: 1}, 500,function(){
					$('#app2HTML').html('<iframe scrolling="no" id="iframe" src="'+ego.apps.temp+'" width="480" height="270" frameborder="0" style="position:absolute; left:58px; top:35px; border-bottom: solid 4px #609; border-top:solid 4px #609;"></iframe><div id="iFrameBlock" style="position:absolute; top:35px; left:58px; z-index:6; width:480px; height:270px;"><div style="position:relative; top:4px; left:0px; width:100%; height:100%; background:#000; z-index:6;"></div></div>');
					ego.iframeBlock = true;
					ego.iframe = true;
					setTimeout('ego.apps.iFrameWait()',1000);
				});		
				ego.apps.appLayer3 = true;
			}
		},
		iFrameWait: function(){
			if (this.attr[1][0] != 'none') {
				$('#app3HTML2').animate({opacity: 0}, 0);
				$('#app3HTML').animate({opacity: 1}, 700,function(){
					$('#iFrameBlock').css('display', 'none');
				});
			}
		},
		iFrameChange: function(url){
			$('#app2HTML').html('<iframe scrolling="no" id="iframe" src="'+ego.apps.temp+'" width="480" height="270" frameborder="0" style="position:absolute; left:58px; top:35px; border-bottom: solid 4px #609; border-top:solid 4px #609;"></iframe><div id="iFrameBlock" style="position:absolute; top:35px; left:58px; z-index:6; width:480px; height:270px;"><div style="position:relative; top:4px; left:0px; width:100%; height:100%; background:#000; z-index:6;"></div></div>');
			setTimeout('ego.apps.iFrameWait()',1000);
		}
	})
});
$(document).ready(function(){
	if (window.MY_OS == 'iOS') {
		if (window.MY_BROWSER == 'Safari') {
			ego.nav.position = new Array(0, 85, 164, 225, 287, 348, 432, 517, 595, 693);
			$('#overNavR').css('right', '167px');	
		}
	}
	ego.start();
	$('#linkInfos > a').click(function(){
		ego.video(true);
		$('#app3HTML2').animate({opacity: 1}, 500);
		$("a.activeApp").toggleClass("activeApp");
		$(this).toggleClass("activeApp");
	});
	$('#linkGallery > a').add('#linkVideo > a').click(function(){
		ego.video(false);
		$('#app3HTML2').animate({opacity: 0}, 500);
		$("a.activeApp").toggleClass("activeApp");
		$(this).toggleClass("activeApp");
		if (ego.apps.addGallery) { $('#iframe').attr('src', ego.apps.temp); }
	});
	$('#linkGallery2 > a').click(function(){
		ego.video(false);
		$('#app3HTML2').animate({opacity: 0}, 500);
		$("a.activeApp").toggleClass("activeApp");
		$(this).toggleClass("activeApp");
		if (!(ego.apps.addGallery)) { $('#iframe').attr('src', 'iframe.php?v='+ego.apps.attr[3]); }
	});
	$('#footerMain').add('#footerPopup').click(function(){ ego.apps.footer(); });
	$('#appCloser').click(function(){
		ego.video(false);
		$('#appLayer2').animate({opacity: 0}, 300);
		$('#appShadow').animate({opacity: 0}, 400, function(){
			$('div.PageText').animate({opacity: 1}, 300);
			$('#appShadow').add('#appLayer2').css('visibility', 'hidden');
			$('#appLayer2').css('text-align', 'left');
			$('#appHTML').html('');
		});
	});
	$('#app2Closer').click(function(){
		ego.apps.appLayer3 = false;
		$('#app2Closer').animate({opacity: 0}, 300,function(){
			$('#app3HTML').animate({opacity: 0}, 500);
			$('#app3HTML2').animate({opacity: 0}, 300, function(){
				$('#app3HTML2').html('');
				$('#app2HTML').html('');
				$('#appLayer3').css('visibility', 'hidden');
				$('div.PageText').add('#PageText2').animate({opacity: 1}, 400);
			});
		});
		ego.iframe = false;
	});
	$('#startClose').click(function(){
		ego.stoper = false;
		ego.page.show = true;
		ego.page.starting = false;
		ego.page.background(false);
		$('#starterVideo').add('#starter').animate({opacity: 0}, 500, function(){
			$('#starterVideo').add('#starter').detach();
			$('#mainTemplate').animate({opacity: 1}, 500, function(){
				ego.nav.aktiv = true;
				ego.nav.positionOld = ego.nav.positionNew;
				ego.nav.positionNew = 0;
				ego.nav.action();
				ego.ajax.action('home.php');
			});
		});
	});
	$('#popupClose').click(function(){
		/*$('#footerPopup').animate({opacity: 0}, 500, function(){
			$('#footerPopup').css('display', 'none');
		});*/
	});
	$(window).resize(function(){ego.page.resize();});
	$('#ActionLayer1').click(function(){
		$('#overHeaderRight').animate({width: ego.nav.temp[0]}, 'slow');
	});
	$('#ActionLayer2').click(function(){
		$('#overNavR').animate({width: ego.nav.temp[1]}, 'slow');
	});
	$('#ActionLayer3').click(function(){
		$('#inOverHeader').animate({left: ego.nav.temp[5]}, 'slow');
	});
	$('#ActionLayer4').click(function(){
		$('#overNavL').animate({width: ego.nav.temp[3]}, 'slow');
	});
	// ActionLayer5 = free
	$('#ActionLayer6').click(function(){
		$('#content > #page').animate({opacity: 0}, 400, function(){
			$('#PageText2').animate({opacity: 1}, 0);
			$('#PageText').animate({opacity: 1}, 0);
			ego.ajax.input();
			$('#content > #page').animate({opacity: 1}, 400, function(){
				ego.nav.aktiv = false; ego.links();
				setTimeout('homepage()',2000);
			});
		});
	});
	$('#ActionLayer7').click(function(){
		$('#content > #layer > #layerTemp > #picture').animate({height: 128}, 500, function(){
			$('#content > #layer > #layerAktiv').html($('#content > #layer > #layerTemp').html());
			$('#content > #layer > #layerTemp').html('');
		});
	});
	$('#ActionLayer8').click(function(){
		$('#content > #layer').animate({opacity: 1, top: 0}, 500);
	});
	$('#ActionLayer9').click(function(){
		$('#content > #layer').animate({opacity: 0, top: -85}, 500);
	});
	$('#ActionLayer10').click(function(){
		$('#footer > #footerTemp').animate({opacity: 1, height: 20}, 500);
	});
	$('#ActionLayer11').click(function(){
		$('#footer > #footerMain').animate({opacity: 0, height: 0}, 500, function(){
			$('#footer > #footerMain').html($('#footer > #footerTemp').html());
			$('#footer > #footerTemp').html('');
			$('#footer > #footerMain').animate({opacity: 1, height: 20}, 0);
			$('#footer > #footerTemp').animate({opacity: 0, height: 0}, 0);
		});
	});
	$('#ActionLayer12').click(function(){
		$('#underHeader > #subNav').animate({opacity: 0}, 400, function(){
			if (ego.cach.checkMAP[ego.ajax.url2] || (ego.ajax.url2 == 'home.php') || (ego.ajax.url2 == 'referenzen.php')){
				
				$('#underHeader > #subNav').html(ego.cach.pageDOM[ego.ajax.url2][1]);
				if (ego.ajax.url == 'kontakt.php') {$('a.subNav:eq(7)').toggleClass('activeSub');}
				$('#underHeader > #subNav').animate({opacity: 1}, 400);
//				if(!(ego.ajax.nowSub == null)) { $('a.subNav:eq('+ego.ajax.nowSub+')').toggleClass('activeSub'); }
				ego.links();
			}
		});
	});
	$('#ActionLayer13').click(function(){
		$('#content > #layer > #layerAktiv > #picture > #picture2').animate({width: 950}, 400);
	});
	$('#ActionLayer14').click(function(){
		$('#content > #layer > #layerAktiv > #picture > #picture2 > #fotoPics').animate({opacity: 0, left: 950}, 400, function(){
			$('#content > #layer > #layerAktiv > #picture > #picture2').html(ego.cach.pageDOM[ego.ajax.url][4]);
			$('#content > #layer > #layerAktiv > #picture > #picture2 > #fotoPics').animate({opacity: 1, left: 0}, 400);
		});
	});
	$('#ActionLayer15').click(function(){
		$('#content > #layer > #layerAktiv > #picture > #picture2 > #fotoPics').animate({opacity: 0, left: 950}, 400, function(){
			$('#content > #layer > #layerAktiv > #picture > #picture2 > #fotoPics').detach();
		});
		$('#content > #layer > #layerAktiv > #picture > #picture2').animate({width: 0}, 400)
	});
	$('#ActionLayer16').click(function(){
		$('#content > #layer > #layerAktiv > #picture > #picture2 > #fotoPics').animate({opacity: 1, left: 0}, 400);
	});
	$('#HeaderLink').click(function(){
		if (!(ego.nav.aktiv)) {
			ego.nav.aktiv = true;
			$("a.activeSub").toggleClass("activeSub");
			ego.ajax.subNav(ego.ajax.breaker);
		}
		if (ego.apps.appLayer3) {
			ego.apps.appLayer3 = false;
			$('#app2Closer').animate({opacity: 0}, 0);
			$('#app3HTML').animate({opacity: 0}, 0);
			$('#app3HTML2').animate({opacity: 0}, 0);
			$('#app3HTML2').html('');
			$('#app2HTML').html('');
			$('#appLayer3').css('visibility', 'hidden');
			ego.iframe = false;
		}
	});
});
function homepage(){
	if (ego.ajax.breaker == 'home.php') {
		$('#iFrameBlock').css('display', 'none');
	}
}
function iFrameHome() {
		$('#app2HTML').html('<div style="position:absolute; left:-98px; top:-55px; width:533px; height:300px;"><iframe scrolling="no" id="iframe" src="http://player.vimeo.com/video/20474331?title=0&amp;byline=0&amp;portrait=0&amp;color=e8208e&amp;autoplay=0" width="533" height="299" frameborder="0" style="position:relative; left:0px; top:0px; border-bottom: solid 4px #609; border-top:solid 4px #609;"></iframe><div id="iFrameBlock" style="position:absolute; top:0px; left:0px; z-index:6; width:533px; height:300px;"><div style="position:relative; top:4px; left:0px; width:100%; height:100%; background:#000; z-index:6;"></div></div>');
		$('#iframe').animate({height:0}, 0);
		$('#iframe').animate({height:300}, 0);
}
function FensterOeffnen (Adresse) {
  MeinFenster = window.open(Adresse, "Clever Mediagroup", "width=880,height=620,left=100,top=50,scrollbars=no,toolbar=no,location=no,hotkeys=no");
  MeinFenster.focus();
}
function FensterOeffnenK (Adresse) {
  MeinFenster = window.open(Adresse, "Clever Mediagroup Kontaktformular", "width=600,height=450,left=200,top=100,scrollbars=no,toolbar=no,location=no,hotkeys=no");
  MeinFenster.focus();
}
