	this.ver      = navigator.appVersion;
	this.agent    = navigator.userAgent;
	this.dom      = document.getElementById ? 1 : 0;
	this.opera    = window.opera ? 1 : 0;
	var resizestat;
	var ImageArray = new Array();
	var TimeOutFader;
	var atwork;
	var atworkleftCol;
	var currentChar=1;
	var delay = 50;
	var quote;
	var oldquote;
	
	
function initialize () {
	document.body.style.backgroundColor = '#f8f8f8';
	window.onresize = resizer;
	resizer();
	if (ImageArray.length != 0){
		pagination_recomb(0);
		window.setTimeout('pagination(0)',7000);
	}
	oldquote = Math.floor(Math.random()*(quotes.length));
	newquote = oldquote;
	quote= quotes[oldquote];
	type ('liveticker', quote, 1);
}

function resizer () {
	var heightw;
	if (window.innerHeight) {
		heightw = window.innerHeight;
	}else {
		heightw = document.documentElement.clientHeight;
	}
	if (document.getElementById("wrapper").offsetHeight  + 45 >= heightw) {
		if (document.getElementById("footer").style.position != 'relative')
			document.getElementById("footer").style.position = 'relative';
	} else {
		if (document.getElementById("footer").style.position != 'absolute')
		document.getElementById("footer").style.position = 'absolute';
	}
}

function showLess() {	
	if (atworkleftCol != 1){
	atworkleftCol = 1;
	document.getElementById('showLess').style.display = 'none';
	document.getElementById('showAll').style.display = 'block';
	Effect.BlindUp('more_projects', { duration: 1.0 });
	resizestat = window.setInterval('resizer()', 100);
	setTimeout('window.clearInterval(resizestat)', 1100);
	window.setTimeout('atworkleftCol = 0;',1100);
	}
}

function showMore() {
	if (atworkleftCol != 1){
	atworkleftCol = 1;
	document.getElementById('showAll').style.display = 'none';
	document.getElementById('showLess').style.display = 'block'; 
	Effect.BlindDown('more_projects', { duration: 1.0 }); 
	resizestat = window.setInterval('resizer()', 100); 
	setTimeout('window.clearInterval(resizestat)', 1100);
	window.setTimeout('atworkleftCol = 0;',1100);
	}
}

function loadAjax(part,page) {
		var myAjax = new Ajax.Request(
			'/ajax/', 
			{
				method: 'get', 
				parameters: {part: part, page: page, ajax: 1}, 
				onComplete: function(originalRequest){
				$(part).innerHTML = originalRequest.responseText;
				resizer ();}
			}
			);
}

function pagination (id, timeout) {
	if (atwork != 1){
	atwork = 1;
	if ((ImageArray.length)-1 == id) {
		id = 0;
	}else{
		id++;
	}
	if (timeout != 0){
		TimeOutFader = window.setTimeout('pagination('+id+', 1)',5000);
	}else{
		window.clearTimeout(TimeOutFader);
	}
	new Effect.Opacity('keyVisual', { from: 1.0, to: 0.0, duration: 0.5 });
	window.setTimeout('pagination_recomb('+id+')', 500);
	window.setTimeout('atwork = 0;',1000);
	window.setTimeout("document.getElementById('keyVisual').style.backgroundImage = 'url("+ ImageArray[id] +")';new Effect.Opacity(\'keyVisual\', { from: 0.0, to: 1.0, duration: 0.5 });",500);
	}
}

function pagination_recomb (id) {
	document.getElementById("pagination").innerHTML = '';
	var list = document.createElement("ul");
	
		for (var i = 0; i < ImageArray.length; i++) {
			var li = document.createElement("li");  
			var a = document.createElement("a");  
			var acontent = document.createTextNode(i+1);
			a.setAttribute('onclick','pagination ('+(i-1)+', 0);');
			a.setAttribute('title','Lade Bild '+(i+1));
			if (i == id)
			li.setAttribute('class','active'); 
			
			a.appendChild(acontent);
			li.appendChild(a);
			list.appendChild(li);
			
			if ( i+1 != ImageArray.length){
				var li = document.createElement("li");
				var licontent = document.createTextNode('|');
				li.setAttribute('class','pipe');
				li.appendChild(licontent);
				list.appendChild(li);
			}
		} 
	document.getElementById("pagination").appendChild(list);
}

function loadJob(var1, var2) {
	new Effect.Opacity('job', { from: 1.0, to: 0.0, duration: 0.5 });
	window.setTimeout('loadAjax(\'job\',\'' + var1 + '\');colorizeJob(\'' + var2 + '\');new Effect.Opacity(\'job\', { from: 0.0, to: 1.0, duration: 0.5 });',500);
}

function loadCompetence(var1,var2){
	new Effect.Opacity('content', { from: 1.0, to: 0.0, duration: 0.5 });
	setClass('keyVisualMicrosites','keyVisualMicrosites');
	setClass('keyVisualPortals','keyVisualPortals');
	setClass('keyVisualMobile','keyVisualMobile');

	window.setTimeout('loadAjax(\'content\',\'' + var1 + '\');new Effect.Opacity(\'content\', { from: 0.0, to: 1.0, duration: 0.5 });',500);
	setClass(var2,var2 + 'active');
}
function setClass(object,classvalue){
	document.getElementById(object).setAttribute("class", classvalue);
	document.getElementById(object).setAttribute("className", classvalue);
}
function colorizeJob(var2) {
	objParent = document.getElementById("jobList");
	arrChildren = objParent.childNodes;
	z = 0;
	for(i = 0; i < arrChildren.length; i++)
	{
	objChild = arrChildren[i];
	if (objChild.nodeName == 'A') {
		if ( var2 == z){
		objChild.style.color = '#000';
		}else{
		objChild.style.color = '#8AD9F1';
		
		}	
		z++;
		}
 	}
}

function type (destination,text,nChar)
{
	var newquote = '';
	var oldquote = '';

	if (document.getElementById)
	{
		var dest = document.getElementById(destination);
		if (dest)
		{
			dest.innerHTML = text.substr(0, nChar);
			nChar++;
			if (nChar > text.length)
			{
				nChar=1;
				if (newquote == oldquote) {
					newquote = Math.floor( Math.random() * (quotes.length) );
				}
				oldquote = newquote;
				text = quotes[newquote];
				setTimeout("type('"+ destination+"','"+text+"','"+nChar+"')", 10000);
			} else {
				setTimeout("type('"+ destination+"','"+text+"','"+nChar+"')", delay);
			}
		}
	}
}
