// JavaScript Document

// fensterbreite
function f_b()
{
	var fenster_b;
	if (self.innerHeight) // all except Explorer
	{
		fenster_b = self.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
	{
		fenster_b = document.documentElement.clientWidth;
	}
	else if (document.body) // other Explorers
	{
		fenster_b = document.body.clientWidth;
	}
	return fenster_b
}

function resize() 
	{
    	breite = f_b()
		f_l = (breite-800)/2
		spur_w = f_b()-20
		document.getElementById('fenster').style.left=f_l+'px'
		document.getElementById('fenster').style.marginLeft = 'auto'
		document.getElementById('spuren').style.width=spur_w+'px'
	}

window.onresize = resize;
window.onload = resize;


//navigation
n1 = 'home.asp'
n2 = 'about.asp'
n3 = 'auto.asp'
n4 = 'wasist.asp'
n5 = 'galleryframe.asp'
n6 = 'videos_f.asp'
n7 = 'sponsoren.asp'
n8 = 'events.asp'
n9 = 'links.asp'
n10 = 'news.asp'
n11 = 'presse.asp'
n12 = 'kontakt.asp'
n13 = 'impressum.asp'
n14 = 'auto_save.asp'

loader = '<div id="loader"><img src="img/icons/loader.gif"/><h2>Seite wird geladen....</h2></div>'

aid=''
ait=''
function fnOv(id)
	{
	if (aid!=id)
		{
		elem = document.getElementById(id)
		elem.style.background='url(img/nback4.jpg)'
		elem.style.color='#FFFFFF'
		}
	}

function fnOt(id)
	{
	if (aid!=id)
		{
		elem = document.getElementById(id)
		elem.style.background='url(img/nback_black.jpg)'
		elem.style.color='#CCCCCC'
		}
	}

function fnOc(id)
	{
 if (id!=14)
	{
	if (aid!='')
		{
		elem = document.getElementById(aid)
		elem.style.background='url(img/nback_black.jpg)'
		elem.style.color='#CCCCCC'
		}
	
	elem = document.getElementById(id)
	elem.style.background='url(img/nback4.jpg)'
	elem.style.color='#FFFFFF'
	aid=id
	document.getElementById('cmd').src = eval(id)
	document.getElementById('content').innerHTML=loader
	
	if (ait!='')
		{
		elem = document.getElementById(ait)
		elem.style.background='url(img/nback_top.jpg)'
		elem.style.color='#CCCCCC'
		}
	if (id=='n12')
		{
		fnOvT('nKont')
		ait = 'nKont'
		}
	}
	else
	{
			document.getElementById('cmd').src = 'auto_save.asp'
	}
	}

function fnOback(id)
	{
	if (aid!='')
		{
		elem = document.getElementById(aid)
		elem.style.background='url(img/nback_black.jpg)'
		elem.style.color='#CCCCCC'
		}
	
	elem = document.getElementById(id)
	elem.style.background='url(img/nback4.jpg)'
	elem.style.color='#FFFFFF'
	aid=id
	//document.getElementById('cmd').src = eval(id)
	}

function fnOvT(id)
	{
	elem = document.getElementById(id)
	elem.style.background='url(img/nback_top2.jpg)'
	elem.style.color='#FFFFFF'
	}

function fnOtT(id)
	{
	if (ait!=id)
		{
		elem = document.getElementById(id)
		elem.style.background='url(img/nback_top.jpg)'
		elem.style.color='#CCCCCC'
		}
	}
	
function fnImpr()
	{
	if (ait!='')
		{
		elem = document.getElementById(ait)
		elem.style.background='url(img/nback_top.jpg)'
		elem.style.color='#CCCCCC'
		}
	elem = document.getElementById('nImpr')
	elem.style.background='url(img/nback_top2.jpg)'
	elem.style.color='#FFFFFF'
	document.getElementById('cmd').src = 'impressum.asp'
	ait = 'nImpr'
	if (aid!='')
		{
		elem = document.getElementById(aid)
		elem.style.background='url(img/nback_black.jpg)'
		elem.style.color='#CCCCCC'
		}
}

// news
actnews = 0
function nwOv(id)
	{
	document.getElementById('nt'+id).style.color='#FFFFFF'
	}
	
function nwOt(id)
	{
	if (actnews == 0)
		{
		document.getElementById('nt'+id).style.color='#CCCCCC'
		}
	}
	
function zNews(id)
	{
	fnOc('n10')
	document.getElementById('cmd').src = 'newsdet.asp?id='+id
	}


var sichtbar = 100
var sicht = 0
var schritt = 5
	
function ausblenden()
	{
		bild = document.getElementById('intro')
		sichtbar = (sichtbar - schritt);
		schritt = (schritt + 0.3)
		transparenz = Math.round(sichtbar);
		//bild.filters.alpha.opacity = transparenz;
		bild.style.opacity = sichtbar/100;
		bild.style.MozOpacity = sichtbar/100;
		bild.style.filter = 'alpha(opacity=' + sichtbar + ')';
		//alert(sichtbar)
		if (sichtbar <= 0)
			{
			window.clearInterval(ausbl);
			bild.style.visibility='hidden'
			//einbl = window.setInterval('einblenden()', 2)
			}
	}

function einblenden()
	{
		bild = document.getElementById('fenster')
		sichtbar = (sichtbar + schritt);
		schritt = (schritt + 0.5)
		transparenz = Math.round(sichtbar);
		//bild.filters.alpha.opacity = transparenz;
		bild.style.opacity = sichtbar/100;
		bild.style.MozOpacity = sichtbar/100;
		bild.style.filter = 'alpha(opacity=' + sichtbar + ')';
		//alert(sichtbar)
		if (sichtbar >= 100)
			{
			window.clearInterval(einbl);
			}
	}


// Kontaktformular
function fnF(id, value, def)
	{
	elem = document.getElementById(id)
	elem.style.background='#666666'
	elem.style.color='#FFFFFF'
	if (value == def)
		{
		elem.value=''
		}
	}

function fnB(id, value, def)
	{
	elem = document.getElementById(id)
	elem.style.background='#2A2A2A'
	if (value == def || value == '')
		{
		elem.style.color='#999999'
		elem.value = def
		}
	}
	
function bnOv()
	{
	elem = document.getElementById('btn')
	elem.style.background='url(img/button_dgrau.gif)'
	elem.style.color='#FFFFFF'
	}

function bnOt()
	{
	elem = document.getElementById('btn')
	elem.style.background='url(img/button_black.gif)'
	elem.style.color='#CCCCCC'
	}


function fnCheck(f)
	{
		
		var m, n, i, r; 
  		m = "Bitte vervollständigen Sie Ihre Eingabe: \n \n"; 
   		n = ""; 

   if(!document.forms[f].vorname.value || document.forms[f].vorname.value =='' || document.forms[f].vorname.value =='Vorname' || document.forms[f].vorname.value.length < 2) { 
      if(!r) r = document.forms[f].vorname; 
	  document.forms[f].vorname.style.background='#FFE6CE';
      m += n + " - Vorname eingeben"; 
      n = " \n"; 
   } 

   if(!document.forms[f].nachname.value || document.forms[f].nachname.value =='' || document.forms[f].nachname.value =='Nachname' || document.forms[f].nachname.value.length < 2) { 
      if(!r) r = document.forms[f].nachname; 
	  document.forms[f].nachname.style.background='#FFE6CE';
      m += n + " - Nachname eingeben"; 
      n = " \n"; 
   } 

   if(!document.forms[f].betreff.value || document.forms[f].betreff.value =='' || document.forms[f].betreff.value =='Betreff' || document.forms[f].betreff.value.length < 2) { 
      if(!r) r = document.forms[f].betreff; 
	  document.forms[f].betreff.style.background='#FFE6CE';
      m += n + " - Betreff eingeben"; 
      n = " \n"; 
   } 
   
   if(!document.forms[f].mail.value || document.forms[f].mail.value =='' || document.forms[f].mail.value =='E-Mail' || document.forms[f].mail.value.length < 2) { 
      if(!r) r = document.forms[f].mail; 
	  document.forms[f].mail.style.background='#FFE6CE';
      m += n + " - E-Mail Adresse angeben"; 
      n = " \n"; 
   } 
  
   if(!document.forms[f].nachricht.value || document.forms[f].nachricht.value =='' || document.forms[f].nachricht.value =='Nachricht' || document.forms[f].nachricht.value.length < 10) { 
      if(!r) r = document.forms[f].nachricht; 
	  document.forms[f].nachricht.style.background='#FFE6CE';
      m += n + " - Nachricht eingeben"; 
      n = " \n"; 
   } 

   if(n) { 
      alert(m); 
      //if(r) r.focus(); 
      //return false; 
   } else { 
      //return true; 
	  document.forms[f].submit()
   } 
}


