/*
function fensterbreite(){
	if (window.innerWidth){
		breite=window.innerWidth;
		hoehe=window.innerHeight;
	}else{
		breite=document.body.clientWidth;
		hoehe=document.body.clientHeight;
	}
}
*/

function start(){
	setupARIA();
	autostop();
	animate();
}


function addARIARole(strID, strRole){
	var objElement = document.getElementById(strID);
	if (objElement){
		objElement.setAttribute('role', strRole);
	}
}


function setupARIA(){
	addARIARole('webdesign', 'article');
	addARIARole('leistungen', 'article');
	addARIARole('kontakt', 'article');
//	addARIARole('aria-banner', 'banner');
	addARIARole('aria-complementary', 'complementary');
	addARIARole('aria-contentinfo', 'contentinfo');
	addARIARole('aria-main', 'main');
	addARIARole('aria-navigation', 'navigation');
//	addARIARole('aria-search', 'search');
}


var x = 0.0;
var y = 0.0;
var a = 1.5;
var b = -1.8;
var c = 1.6;
var d = 0.9;
var x2 = 0;
var y2 = 0;
var stop;
var stop2;
var anim = true;


function autostop(){
	stop2=setTimeout("anim=true; schalter();",600000);
}


function animate(){
	var canvas = document.getElementById("can");
	var context = canvas.getContext("2d");

	context.fillStyle = "rgb(0,255,0)";
	for(var i = 0; i < 100; i++){
		context.fillRect (300+x*100, 300+y*100, 1, 1);
		var x2 = Math.tan(a*y) + c*Math.cos(a*x);
		var y2 = Math.tan(b*x) + d*Math.tan(b*y);
		x = x2;
		y = y2;
	}
	
	context.fillStyle = "rgb(255,192,255)";
	for(var i = 0; i < 100; i++){
		context.fillRect (300+x*100, 300+y*100, 1, 1);
		var x2 = Math.sin(a*y) + c*Math.tan(a*x);
		var y2 = Math.cos(b*x) + d*Math.tan(b*y);
		x = x2;
		y = y2;
	}
	
	context.fillStyle = "rgb(192,0,0)";
	for(var i = 0; i < 100; i++){
		context.fillRect (300+x*100, 300+y*100, 1, 1);
		var x2 = Math.sin(a*y) + c*Math.sin(a*x);
		var y2 = Math.sin(b*x) + d*Math.sin(b*y);
		x = x2;
		y = y2;
	}
	stop=setTimeout("animate();",100);
}



function schalter(){
	if(anim==true){
		anim=false;
		document.getElementById("switch1").firstChild.nodeValue = "fortsetzen";
		document.getElementById("switch2").firstChild.nodeValue = "fortsetzen";
		document.getElementById("switch3").firstChild.nodeValue = "fortsetzen";
		clearTimeout(stop);
		clearTimeout(stop2);
		
	} else {
		anim=true;
		document.getElementById("switch1").firstChild.nodeValue = "anhalten";
		document.getElementById("switch2").firstChild.nodeValue = "anhalten";
		document.getElementById("switch3").firstChild.nodeValue = "anhalten";
		animate();
		autostop();
	}
}



function webdesign(){
	document.getElementById('webdesign').style.display='block';
	document.getElementById('leistungen').style.display='none';
	document.getElementById('kontakt').style.display='none';
}

function leistungen(){
	document.getElementById('leistungen').style.display='block';
	document.getElementById('webdesign').style.display='none';
	document.getElementById('kontakt').style.display='none';
}

function kontakt(){
	document.getElementById('kontakt').style.display='block';
	document.getElementById('webdesign').style.display='none';
	document.getElementById('leistungen').style.display='none';
}





