
var css = {

	start:function(){
		document.getElementById('mainContent').style.display = 'none';
		//document.getElementById('Satz').display = 'none';
		//document.getElementById('logos').display = 'none';
		css.getCssSheet(
			'start1024.css', 
			750, 'start800.css', 
			1000,'start1024.css', 
			1250,'start1280.css'
		);
	},
	
	saveDimensions:function(s){
		if (s){		
			if (s.search(/1280/) != -1) dim = 1280;
			else dim = 1024;		
			var out = new Date();
			var oneHour = out.getTime() + (3600 * 1000);
			out.setTime(oneHour);
			document.cookie = "dim="+dim+"; expires=" + out.toGMTString();
		}	
	},

	getPageSize:function (){
		
		var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = document.body.scrollWidth;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		if (self.innerHeight) {	// all except Explorer
			windowWidth = self.innerWidth;
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = windowWidth;
		} else {
			pageWidth = xScroll;
		}
	
		return pageWidth;
	
		//arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
		//return arrayPageSize;
	},
	
	switchStyle:function(s) {
	  if (!document.getElementsByTagName) return;

	  var el = document.getElementsByTagName("link");
	  for (var i = 0; i < el.length; i++ ) {
	    if (el[i].getAttribute("rel").indexOf("style") != -1 && el[i].getAttribute("title")) {
	      el[i].disabled = true;
	      if (el[i].getAttribute("title") == s) el[i].disabled = false;
	    }
	  }
	  document.getElementById('mainContent').style.display = 'block';
	  //document.getElementById('Satz').display = 'block';
	  //document.getElementById('logos').display = 'block';
	},
	
	getCssSheet:function (){
		
		var w;
		var anzahl = (arguments.length - 1) / 2;
		var gef_breite = -1; 
		var i;
		
		if ((arguments.length + 1) % 2) {
			alert("falsche Parameter übergeben!");
			return false;
		}
		
		w = css.getPageSize();
		if (w == 0 || w == "undefined"){
			//return arguments[0];
			css.getCssString(arguments[0]);
		}
		
		for (i = 0; i < anzahl; i++) {
			if (w > arguments[i*2+1]) {
				gef_breite = i;
			}
		}
		css.switchStyle(arguments[gef_breite*2+2]);
		css.saveDimensions(arguments[gef_breite*2+2]);
	}

};

window.onload = css.start;
window.onresize = css.start;

