var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
/*
$("#thediv").each( function() {
// certain browsers have a bug such that scrollHeight is too small
// when content does not fill the client area of the element
var scrollHeight = Math.max(this.scrollHeight, this.clientHeight);
this.scrollTop = scrollHeight - this.clientHeight;});
*/
function getElementsByClass( searchClass, domNode, tagName) {
if (domNode == null) domNode = document;
if (tagName == null) tagName = '*';
var el = new Array();
var tags = domNode.getElementsByTagName(tagName);
var tcl = " "+searchClass+" ";
for(i=0,j=0; i<tags.length; i++) {
var test = " " + tags[i].className + " ";
if (test.indexOf(tcl) != -1)
el[j++] = tags[i];
}
return el;
}


function Get_Cookie( check_name ) {
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false;

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		a_temp_cookie = a_all_cookies[i].split( '=' );
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

function Set_Cookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
		( ( path ) ? ";path=" + path : "" ) +
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}

function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function changeFontSize(inc){
	var size = Get_Cookie('site_font_size');
	if(size == null){
	size = 75;} else {size = parseInt(size.replace("%", ""))};
	var p = document.getElementsByTagName('body');
	for(n=0; n<p.length; n++) {
	 if(p[n].style.fontSize) {
	 	size = parseInt(p[n].style.fontSize.replace("%", ""));
	 	} else {size;}
	 p[n].style.fontSize = size+inc + '%';
	 Set_Cookie( 'site_font_size', size+inc, '365', '/', '', '' );
	 if(typeof help2 != 'undefined'){help2.document.body.style.fontSize = size+inc+"%";}
	 if(typeof help3 != 'undefined') {help3.document.body.style.fontSize = size+inc+"%";}
     if(typeof help3 != 'undefined') {document.getElementById("help3").style.height = help3.document.body.scrollHeight + 10 +"px";}
     if(typeof help4 != 'undefined') {help4.document.body.style.fontSize = size+inc+"%";}
     var w1 = getElementsByClass('wettercomheadline204217');
		for(i=0; i<w1.length; i++)
     w1[i].style.fontSize = "100%";
     var w2 = getElementsByClass('wettercomsmall204217');
		for(i=0; i<w2.length; i++)
     w2[i].style.fontSize = "100%";
     var w3 = getElementsByClass('wettercomtext204217');
		for(i=0; i<w3.length; i++)
     w3[i].style.fontSize = "100%";
     var w4 = getElementsByClass('wettercomsmall204217');
		for(i=0; i<w4.length; i++)
     w4[i].style.width = "95%";
	}
}

function showHelp() {
 	if(document.getElementById("help").style.height != "0px") {
 		document.getElementById("help").style.height = "0px";
 		document.getElementById("helpbottom").childNodes[1].nodeValue =  "Hilfe zur Kartensteuerung einblenden";
 		document.getElementById("helpsign").childNodes[0].nodeValue =  "+";
   	}
   	else {document.getElementById("help").style.height = "7em";
   	     document.getElementById("helpbottom").childNodes[1].nodeValue = "Hilfe zur Kartensteuerung ausblenden";
   	     document.getElementById("helpsign").childNodes[0].nodeValue =  "-";
   	}
}

function changeBackOver() {
 	document.getElementById("helpbottom").style.backgroundPosition = "right";
 	document.getElementById("helpbottom").style.fontWeight = "bold";
 	document.getElementById("helpbottom").style.cursor = "pointer";
}

function changeBackOut() {
 	document.getElementById("helpbottom").style.background = "url(picts/menu.jpg) repeat 0% 0%;";
 	document.getElementById("helpbottom").style.fontWeight = "normal";
}

function showHelp2() {
	if(document.getElementById("help2").style.height == "") {document.getElementById("help2").style.height = "0px";}
   	if (document.getElementById("help2").style.height != "0px") {
   		document.getElementById("help2").style.height = "0px";
   	    document.getElementById("helpbottom2").childNodes[0].nodeValue = "Die Netiquette einblenden";
   	    document.getElementById("helpsign2").childNodes[0].nodeValue =  "+";
   	} else {
 		document.getElementById("help2").style.height = help2.document.body.scrollHeight + 10 +"px";
 		document.getElementById("helpbottom2").childNodes[0].nodeValue =  "Die Netiquette ausblenden";
 		document.getElementById("helpsign2").childNodes[0].nodeValue =  "-";
   	}
}

function changeBackOver2() {
 	document.getElementById("helpbottom2").style.backgroundPosition = "right";
 	document.getElementById("helpbottom2").style.fontWeight = "bold";
 	document.getElementById("helpbottom2").style.cursor = "pointer";
 	docHeight = help2.document.body.scrollHeight;
}

function changeBackOut2() {
 	document.getElementById("helpbottom2").style.background = "url(picts/bg2.png) repeat 75% 50%";
 	document.getElementById("helpbottom2").style.fontWeight = "normal";
}
function showHelp3(help) {
 	if(document.getElementById(help).style.height != "0px") {
 		document.getElementById(help).style.height = "0px";
 		document.getElementById(help).style.visibility = "hidden";
   	}
   	else {
   		document.getElementById(help).style.visibility = "visible";
   		document.getElementById(help).style.height = "100%";
   	}
}
var h1width= 4.5; //ergibt die länge des string

var h1Arr = [];
var animTimer, h1myArr;
function h1Setup() {
	changeFontSize(0);
    h1Arr = document.getElementsByTagName("h2");
    for (var h = 0;h < h1Arr.length;h++) {
        var h1 = h1Arr[ h ], text = h1.firstChild.nodeValue;
        h1.removeChild( h1.firstChild );
        h1.animNodes = [];
        for(var i = 0;i < text.length;i++) {
            var span = document.createElement('span');
            span.appendChild( document.createTextNode( text.substring( i, i + 1 ) ) );
            h1.appendChild(span);
            h1.animNodes[h1.animNodes.length] = span
        }
        h1.animCount = 0;
        animTimer = setInterval( 'h1Anim(' + h + ')', 100 );
    }
}

function h1Anim( h ) {
    var h1 = h1Arr[ h ], c = h1.animCount++, noAnim = 1;
    for (var i = 0;i < h1.animNodes.length;i++) {
        var s = h1.animNodes[i];
        var frac = Math.max( 0, Math.min( 1, ( c - i ) / 10 ) );
        if(s.animDone)continue;
        noAnim = 0;
        s.style.color = 'rgb(' + parseInt( 255-255 * frac ) + ',' + parseInt( 255-255 * frac ) + ',' + parseInt( 255-255 * frac ) + ')';
        if (frac == 1) {
           s.style.marginLeft = 'auto';
           s.animDone = 1;
           }
        else if(frac > 0) {s.style.marginLeft = h1width * ( 1 - frac ) + 'em';}
    }
    if(noAnim){clearInterval(animTimer);}  //h1Bg(100);
    h1.style.visibility = 'visible';
}

function h1Bg(c) {
	var fracbg = Math.sin(c--);
	if (c <= 1) {fracbg = 1;}
	var to = setTimeout("h1Bg("+c+")", 90 );
	h1Arr[0].style.backgroundColor = 'rgb(' + parseInt( 255 - 17 * fracbg ) + ',' + parseInt( 255 - 17 * fracbg ) + ',' + parseInt( 255 - 17 * fracbg ) + ')';
	if (fracbg == 1) {
		h1myArr = 1;
		clearTimeout(to);
	}
}

window.onload = function () { h1Setup();}