// FAQ POPUP
function pop_up_FAQ(){
	 fenster=window.open("faq.php4","FAQ","width=420,height=440,resizable=no,scrollbars=yes,top="+(screen.height / 2 - 210)+",left="+(screen.width / 2 -210));
}

/****************************************************
****************SITEMAP******************************
****************************************************/
function generateSitemap(lay)
{	lay=document.getElementById(lay);
	html='<table border=0><tr>';
	cols=4;
	mn2=getMenuContent(true);
	i=0;
	for(main in mn2)
	{	if((i%cols==0)&&(i>0))
			html+='</tr><tr><td colspan=4><img src="img/spacer.gif" height=12></td><tr>';
		if(!mn2[main].url)
			mn2[main].url='javascript:void(0);'
		html+='<td valign=top>';
		html+='<table border=0 cellpadding=0 cellspacing=0 width=143>'
		html+='<tr height=32><td background="img/sitemap_main_top.jpg" align=center style="padding-top:2px">';
		html+='<a href="'+mn2[main].url+'">';
		html+='<font class="txtheadcolored">'+main+'</font>';
		html+='</a>';
		if(mn[main]['sub'])
		{	for(sb in mn[main]['sub'])
			{	if(!mn[main]['sub'][sb])
					url='javascript:void(0);'
				else
					url=mn[main]['sub'][sb];
				html+='</td></tr><tr height=32><td background="img/sitemap_sub_top.jpg" align=center style="padding-top:13px">';
				html+='<a href="'+url+'">';
				html+=''+sb+''
				html+='</a>';
			}
			//html
		}else
		{	
		}
		i++;
		html+='</td></tr><tr><td><img src="img/sitemap_sub_bottom.jpg" border=0>';
		html+='</td></tr></table></td>';
	}
	html+='</tr></table>';
	lay.innerHTML=html;
}


function popper(url,w,h)
{	window.open(url,'t',"width="+w+",height="+h+",location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no");
}


/****************************************************
****************MINI PAGE SWITCHER*******************
****************************************************/
/*
needs following layers:
<name>_counter => place for page switching links
<name>_hold		=> holder div, clipped, no overflow
<name>_cont		=> content div, position: relative
generates ids for switching links: <name>_<page number from 0>
*/
function switcher(name)
{	this.name=name;
	this.page=0;
	this.cnt=document.getElementById(name+'_counter');
	this.lyr=document.getElementById(name+'_cont');
	this.hld=document.getElementById(name+'_hold');
	this.hldH=this.hld.offsetHeight;
	this.lyrH=this.lyr.offsetHeight;
	this.maxPg=Math.ceil(this.lyrH/this.hldH);
	
	this.lastlnk=false;
	this.initPages=initPages;
	this.switchPage=switchPage;
	this.buildCounter=buildCounter;
	
	this.initPages();
}

function initPages()
{	if(this.buildCounter())
		this.switchPage(0);
}

function buildCounter()
{	if(this.maxPg<=1)return false;
	html='<table cellpadding=0 cellspacing=0><tr><td><span class="txtheadcolored">Seite:&nbsp;&nbsp;</span></td>';
	html+='<td valign=top style="padding-top:4px"><a href="javascript:'+this.name+'.switchPage('+this.name+'.page-1);"><img src="img/arrow_back.gif" border=0></a></td>';
	html+='<td class="txtheadcolored">&nbsp;';
	for(i=0;i<this.maxPg;i++)
		html+='<a href="javascript:void(0);" onclick="javascript:'+this.name+'.switchPage('+i+');" class="pages" id="'+this.name+'_'+i+'">'+(i+1)+'</a>&nbsp;';
	html+='</td><td valign=top style="padding-top:4px"><a href="javascript:'+this.name+'.switchPage('+this.name+'.page+1);"><img src="img/arrow_more.gif" border=0></a></td>';
	html+="</tr></table>";
	this.cnt.innerHTML=html;
	this.links=Array();
	for(i=0;i<this.maxPg;i++)
		this.links[i]=document.getElementById(this.name+'_'+i);
	return true;
}

function switchPage(pg)
{	if(this.lastlnk)
		this.lastlnk.className='pages';
	if(pg<0)
		pg=this.maxPg-1;
	if(pg>=this.maxPg)
		pg=0;
	this.links[pg].className='activePage';
	this.lastlnk=this.links[pg];
	if(pg<=this.maxPg)
	{	newTp=pg*this.hldH;
		this.lyr.style.top='-'+newTp+'px';
	}
	this.page=pg;
}

/****************************************************
****************IMAGE PRELOADING SCRIPTS*************
****************************************************/
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		preloadFlag = true;
	}
	poster_iniz();
}


/****************************************************
*****************POSTER POSITIONING SCRIPTS**********
****************************************************/
function poster_iniz()
{}

pfuschposdel=0;
pfuschposdel2=0;
pfuschposdel3=0;
function set_poster_pos(space, wh_poster, poster_breite)
{	//POSITIONS ALL POSTERS
	poster_pos=241-pfuschposdel+(wh_poster*(920-pfuschposdel3))+(space-poster_breite)/2;  		//start 248; always +920    || space = zur verfuegubg stehender platz   
	which_poster='posteraufhang'+wh_poster;  
	if (document.all){
	   document.all[which_poster].style.left= poster_pos;
	   document.all[which_poster].style.display='block';
	}
	if (navigator.appName=="Netscape"){ 	 
	   document.getElementById(which_poster).style.left=poster_pos+'px';   
	   document.getElementById(which_poster).style.display='block';   
	}
	get_spacer_width(wh_poster,-49,-30,38);
}


function set_box_pos(start_pos,index,posterelement_breite)
{	//POSITIONS ALL ELEMENTS ON THE RIGHT
	element_pos = start_pos + (index*(920-pfuschposdel3));
	which_element='rightelementcontainer'+index;  

	if (document.all)
	    document.all[which_element].style.left=element_pos;
	if (navigator.appName=="Netscape")
	   document.getElementById(which_element).style.left=element_pos+'px';       
	set_poster_pos(start_pos-250, index, posterelement_breite);    
}

function set_relative(hdr,panel1,inner1,panel2,inner2)
{	h=document.getElementById(hdr);
	p1=document.getElementById(panel1);
	p2=document.getElementById(panel2);
	if(i1=document.getElementById(inner1))
		inner1=true;
	else
		inner1=false;
	if(i2=document.getElementById(inner2))
		inner2=true;
	else
		inner2=false;
	
	h.style.display='block';

	hdhgt=Math.round(h.offsetHeight/2);
	h.style.left=p1.offsetLeft+'px';
	h.style.top=(p1.offsetTop+hdhgt*2-h.offsetTop)+'px';
	if(inner1)
		i1.style.top=(i1.offsetTop+hdhgt)+'px';
	if(inner2)
		i2.style.top=(i2.offsetTop+hdhgt)+'px';
	
}
/****************************************************
***************SCROLLER SCRIPTS**********************
****************************************************/
function initScrollLayer() {
  var wndo = new dw_scrollObj('wn','lyr1','t1');
  dw_scrollObj.GeckoTableBugFix('wn'); 
  arrow_init();
}

function arrow_init()
{	// IE arrow referenz
	if (document.all){ 
	   arrow_left=document.all["controlLeft"].style;
	   arrow_right=document.all["controlRight"].style;
	}
	
	// NN&MOZILLA arrow referenz
	if (navigator.appName=="Netscape"){ 
	    arrow_left=document.getElementById("controlLeft").style;
	    arrow_right=document.getElementById("controlRight").style;
	}
	arrow_left.display='none';
	arrow_check(5);
}


function arrow_check(verzoegerung){			
	setTimeout('arrow_check2()',verzoegerung);		//CHECKS SCROLL-POSITION WHEN SCROLLING IS FINISHED
}


function activatespecialarrow(dir,active)
{	if(a=document.getElementById('control'+dir+'2'))
		a.style.display=active?'block':'none';
}

function arrow_check2()
{	if (document.all)
	   str=document.all["lyr1"].style.left;
	
	if (navigator.appName=="Netscape")
	    str=document.getElementById("lyr1").style.left;
	
	if (str.length<=3)   				 //splits the position-string
	   pos=str.substring(0,str.length-2);
	
	if (str.length>3)
	   pos=str.substring(1,str.length-2)
	
	if (pos < 1){
	    activatespecialarrow('Left',true)
	    activatespecialarrow('Right',false)
	    arrow_left.display='none';
	    arrow_right.display='block';
	}
	
	if (pos > 0){
	    if (pos <= anz_elemente*920-1){				//anzahlElemente *920 - 1
		    activatespecialarrow('Left',false)
		    activatespecialarrow('Right',false)
	        arrow_left.display='block';
	        arrow_right.display='block';
	    }
	    if (pos > anz_elemente*920-1){
		    activatespecialarrow('Left',false)
		    activatespecialarrow('Right',true)
	        arrow_left.display='block';
	        arrow_right.display='none';
	    }
	}    
	if(anz_elemente<1)
	{	arrow_right.display='none';
	}
}

/****************************************************
***************LOGO PAGE SWITCHER********************
****************************************************/
function switchLogoLayer(logopage){
	pg=1;
	do
	{	if(lr=document.getElementById('logos'+pg))
			document.getElementById('logos'+pg).style.display='none';
		pg++;
	}while(lr);
	if(document.getElementById(logopage))
		document.getElementById(logopage).style.display='block';
}

/****************************************************
***************MENU SCRIPT***************************
****************************************************/
mainsite='';
subsite='';
function write_menu(){
	document.writeln('<div id="menu">');
	document.writeln('<map NAME="icons"><area SHAPE=RECT COORDS="0,100,200,505" HREF="#"></map>');
	document.writeln('<table border="0" cellspacing="0" cellpadding="0" height=460>');
	document.writeln('<tr><td id="blocked" valign=top><img src="img/menu_top_1.gif" border=0></td></tr>');
	// CHANGE HEIGHT 01 HERE || SUM OF BOTH MUST BE 252
	document.writeln('<tr><td id="blocked" height=30 valign=top background="img/menu_top_2_bg.gif" style="background-repeat: repeat-y"></td></tr>');
	document.writeln('<tr><td id="blocked" valign=top><a href="aktuelles.php4"><img src="img/menu_logo.gif" border=0></a></td></tr>');
	document.writeln('<tr><td valign=top>');
	// START CHANGE HEIGHT 02 HERE || SUM OF BOTH MUST BE 252
	document.writeln('<table border="0" cellspacing="0" cellpadding="0" width="100%" height=270 class="whitebg" background="img/nav_box_background.gif" style="background-repeat: repeat-y">');
	document.writeln('<tr><td valign=top align=center>');

	// start menu
	document.writeln('<table border="0" cellspacing="0" cellpadding="0" height=270>');
	document.writeln('<tr><td id="blocked" valign=top><img src="img/spacer.gif" width=1 height=15 border=0>');
	mn=getMenuContent();
	for(main in mn)
	{	
		document.writeln('<a href="'+mn[main]['url']+'"');
		if(main!=mainsite)
			document.writeln(' onmouseover="changeImages(\''+mn[main]['pic']+'\', \'img/'+mn[main]['pic']+'_over.gif\'); return true;" onmouseout="changeImages(\''+mn[main]['pic']+'\', \'img/'+mn[main]['pic']+'_up.gif\'); return true;"');
		document.writeln('><img src="img/'+mn[main]['pic']+(main!=mainsite?'_up':'_over')+'.gif" border=0 name="'+mn[main]['pic']+'"></a><img src="img/spacer.gif" width=1 height=3 border=0>');
		if((main==mainsite)&&(mn[main]['sub']!=false))
		{	i=0;
			for(sb in mn[main]['sub'])
			{	document.writeln('<div id="aktuellesSubMenu" style="display:block; text-align:left; padding-left:33px; padding-bottom:5px" class=txt><table cellpadding=0 cellspacing=0 border=0><tr><td style="padding-top:2px">');
				document.writeln('<img src="img/'+(sb!=subsite?'spacer':'arrow_more')+'.gif" border=0 width=8 height=5 name="'+mn[main]['pic']+'_'+i+'"></td><td style="padding-left:3px">');
				document.writeln('<a ');
				if(sb!=subsite)
					document.writeln(' onmouseover="changeImages(\''+mn[main]['pic']+'_'+i+'\', \'img/arrow_more.gif\'); return true;" onmouseout="changeImages(\''+mn[main]['pic']+'_'+i+'\', \'img/spacer.gif\'); return true;"');

				document.writeln(' href="'+mn[main]['sub'][sb]+'">'+(sb==subsite?' <font color="99CA3C">':'')+sb+(sb==subsite?'</font>':'')+'</a></td></tr></table></div>');
				i++;
			}
		}
	}

	

	document.writeln('</td></tr></table>');
	// end menu
	
	document.writeln('</td></tr></table>');
	document.writeln('</td></tr>');
	document.writeln('<tr><td id="blocked" valign=center align=center background="img/nav_icons.gif" width=197 height=41>');
	document.writeln('<table border="0" cellspacing="0" cellpadding="0" width=100><tr>');
	document.writeln('<td align=left id="blocked"><a href="impressum.php4" onmouseover="changeImages(\'icon_newsletter\', \'img/icon_newsletter_over.gif\'); return true;" onmouseout="changeImages(\'icon_newsletter\', \'img/icon_newsletter.gif\'); return true;"><img src="img/icon_newsletter.gif" border=0 title="Impressum" alt="Impressum" name="icon_newsletter"></a></td>');
	document.writeln('<td><img src="img/spacer.gif" width=25 height=1 border=0></td>');
	document.writeln('<td align=left id="blocked"><a href="sitemap.php4" onmouseover="changeImages(\'icon_sitemap\', \'img/icon_sitemap_over.gif\'); return true;" onmouseout="changeImages(\'icon_sitemap\', \'img/icon_sitemap.gif\'); return true;"><img src="img/icon_sitemap.gif" border=0 title="Sitemap" alt="Sitemap" name="icon_sitemap"></a></td>');
	document.writeln('<td><img src="img/spacer.gif" width=25 height=1 border=0></td>');
	document.writeln('<td align=left id="blocked"><a href="kontakt.php4" onmouseover="changeImages(\'icon_contact\', \'img/icon_contact_over.gif\'); return true;" onmouseout="changeImages(\'icon_contact\', \'img/icon_contact.gif\'); return true;"><img src="img/icon_contact.gif" border=0 title="Kontakt" alt="Kontakt" name="icon_contact"></a></td>');
	document.writeln('<td><img src="img/spacer.gif" width=20 height=1 border=0></td>');
	//document.writeln('<td align=left id="blocked"><a href="team.php4" onmouseover="changeImages(\'icon_team\', \'img/icon_team_over.gif\'); return true;" onmouseout="changeImages(\'icon_team\', \'img/icon_team.gif\'); return true;"><img src="img/icon_team.gif" border=0 title="team" alt="team" name="icon_team"></a><img src="img/spacer.gif" width=27 height=1 border=0></td>');
	document.writeln('<td align=left id="blocked"><a href="login_01.php4" onmouseover="changeImages(\'icon_login\', \'img/icon_login_over.gif\'); return true;" onmouseout="changeImages(\'icon_login\', \'img/icon_login_up.gif\'); return true;"><img src="img/icon_login_up.gif" border=0 title="login" alt="login" name="icon_login"></a></td>');	
	document.writeln('</tr></table>');
	document.writeln('</td></tr><tr><td id="blocked"><img src="img/menu_bottom.gif" border=0></td></tr>');
	document.writeln('</table>');
	document.writeln('</div>');
}


/****************************************************
***************FORM CHECK***************************
****************************************************/

function pruefung(formular){
	corr=true;
	
	//CHECK ALL FORM ELEMENTS
	for (i=0; i<formular.length; i++){
		if(errormessage[i]!=''){
			if(formular.elements[i].value == errormessage[i])
			{	corr=false;
			}
			if(formular.elements[i].value == "") {
				formular.elements[i].className="errorInput";
				corr=false;
				if(formular.elements[i].name!='land'){
					formular.elements[i].value=errormessage[i];
			}
		 	}
		}
	}
		 	if(formular.elements['teilnahme']){
		 		if(formular.elements['teilnahme'].checked){
		 			//alert('ok');
		 		}
		 		else{
		 		 alert('Sie müssen die Teilnahmebedingungen akzeptieren.');
		 		}
		 	}

	//ERROR MESSAGE AUSGABE
	
	if (corr==true){
			return true;
			}	
		else {
		  return false;
		}

}

//CHECK AGAIN FUNCTIONS USED AFTER CHANGING INPUT


function empty_it(){
	if(this.color=='#99CA3C'){
		this.value='';
	}
}

