//////////////////////////////////// Settings

// *** Schalter ***
var glImgAmount = 3; // Anzahl der Bilder mit Null begonnen. Achttung die Zitate laufen mit und müssen die gleiche Anzahl haben, sondt gibt einen  Fehler!
var glSpeed = 25; // Millisekunden pro Schritt
var glSteps = 0.02; // Opacity Schritte, IE mal 100
var glWait = 4000; // Bild stehen lassen für XX ms 

// *** Definitionen ***
var elementzugriff = "";
var counter = 0.0;
var counterDiv = 0;
var divId ="divfader0";



/////////////////////////////////////////////
function init()
{
K7DoFade();
k7PageName();
}

                    
function K7WaitFade()
{
//window.status= imgId;
K7Wait = window.setTimeout("K7DoFade()",glWait);

}


function K7DoFade()
{
elementzugriff2 = document.getElementById(divId).style;
K7Fade = window.setTimeout("K7FadeIn()",glSpeed);		
}

function K7FadeIn()
{
elementzugriff2.opacity = counter;
elementzugriff2.filter = "Alpha(opacity="+counter*100+", finishopacity="+counter*100+", style=1)";
counter+= glSteps;

		if(counter<=1.0)
		{
		K7DoFade()		
		}
		else
		{
		counterDiv++;
		lastDiv = divId; 
		divId = "divfader"+counterDiv;
		
			if(counterDiv<=glImgAmount)
			{
			counter=0;
			K7WaitFade();
			//K7DoFade();
			}	
			
			else		
			{			
			counter=0;
			K7DoReset();
			}
			
			
		
		}
		
}

function K7DoReset()
{

for(i=0;i<=glImgAmount;i++)
	{
	elementzugriff2 = document.getElementById("divfader"+i).style;
	elementzugriff2.opacity = 0;
	elementzugriff2.filter = "Alpha(opacity=0, finishopacity=0, style=1)";
	}
divId = "divfader0"; counterDiv = 0; K7WaitFade();
}

/////////////////////////////////////////////// end cw


function k7Toggle()
{

var state0 = (document.getElementById("Nachrichtenboxschalter").style.display == "none") ? "block" : "none";
var state1 = (document.getElementById("Nachrichtenbox").style.display == "none") ? "block" : "none";

document.getElementById("Nachrichtenboxschalter").style.display = state0;
document.getElementById("Nachrichtenbox").style.display = state1;

}

function k7PageName()
{
document.getElementById("frompage").value = this.location.href;
}

//*** Kontakformular Check
function k7testform()
{

var bolAdrCorrect = true;
var elementzugriff = document.forms[0].News.checked;

if(elementzugriff == true)
{
var elementzugriff = document.question.Email.value;
if(elementzugriff ==""){bolAdrCorrect=false};
if(elementzugriff.indexOf("@")==-1){bolAdrCorrect=false}
if(elementzugriff.search(/ä/i)!=-1 || elementzugriff.search(/ü/i)!=-1 || elementzugriff.search(/ö/i)!=-1){bolAdrCorrect=false;}
//if(document.question.FromName.value==""){bolAdrCorrect=false;}
//if(document.question.FromTelefon.value==""){bolAdrCorrect=false;}
}

if(bolAdrCorrect==true)
{document.question.submit();}



else
{alert("Bitte prüfen Sie die E-Mail Adresse! Wenn Sie keine Email-Adresse angeben möchten, entfernen Sie bitte den Haken bei Newsletter");}

}


function openWinK7(url,width,height)	{
			var flyout=window.open(url, "campus","resizable=yes,scrollbars=yes, width="+width+",height="+height+",top=30,left=202");
			flyout.focus();		
		    }
     

function openWinK7(url) {
                flyout=window.open(url, "campus","resizable=yes,scrollbars=yes,width=563,height=606,top=30,left=202");
                }

function openWinHugeK7(url) {
                flyout=window.open(url, "campus","resizable=yes,scrollbars=yes,width=900,height=1000,top=30,left=202")
            }
        
function openpageK7(url)
        	{
        		page = window.open(url, "campus","resizable=yes,scrollbars=yes,width=570,height=800,top=70,left=200");
        		page.focus();
        		//page.moveTo(240,50);
	      	}


//**************************** GA ***********************************************************

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17413514-1']);
  _gaq.push(['_gat._anonymizeIp']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


window.onload = init;

