// JavaScript Document  
//Based on work by Simon Collison et al http://www.collylogic.com/?/comments/redesign-notes-1-width-based-layout/

// Dynamische Aenderund des Designs der Site abhaengig vom ViewPort

layouter = {
	init : function() {
		if (!document.getElementById)
			return;
		// set up the appropriate Layer
	layouter.setLayout();
	// and make sure it gets set up again if you resize the window
	layouter.addEvent(window, "resize", layouter.setLayout);
},

setLayout : function() {
	// width stuff from ppk's
	// http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/index.html
	var theWidth = 0;
	if (window.innerWidth) {
		theWidth = window.innerWidth
	} else if (document.documentElement && document.documentElement.clientWidth) {
		theWidth = document.documentElement.clientWidth
	} else if (document.body) {
		theWidth = document.body.clientWidth
	}
	if (theWidth != 0) {
		if (theWidth < 600) {
			// document.getElementById('all').className = 'default';
			document.getElementsByTagName("body")[0].style.fontSize = "45%";
		} else if (theWidth < 800) {
			// document.getElementById('all').className = 'default';
			document.getElementsByTagName("body")[0].style.fontSize = "65%";
		} else if (theWidth < 1000) {
			// document.getElementById('all').className = 'default';
			document.getElementsByTagName("body")[0].style.fontSize = "80%";
		} else {
			// document.getElementById('all').className = 'default';
			document.getElementsByTagName("body")[0].style.fontSize = "100%";
		}
	}
},

addEvent : function(obj, type, fn) {
	if (obj.attachEvent) {
		obj['e' + type + fn] = fn;
		obj[type + fn] = function() {
			obj['e' + type + fn](window.event);
		}
		obj.attachEvent('on' + type, obj[type + fn]);
	} else {
		obj.addEventListener(type, fn, false);
	}
}
}

layouter.addEvent(window, "load", layouter.init);

