function Validator(theForm){
	if (theForm.autor.value == ""){
		alert("Please enter a value for the \"Your name\" field.");
		theForm.autor.focus();
		return (false);
		}
	if (theForm.autor.value.length < 2){
		alert("Please enter at least 2 characters in the \"Your name\" field.");
		theForm.autor.focus();
		return (false);
		}
	if (theForm.autor.value.length > 100){
		alert("Please enter at most 100 characters in the \"Your name\" field.");
		theForm.autor.focus();
		return (false);
		}
	if (theForm.email.value == ""){
		alert("Please enter a value for the \"e-mail\" field.");
		theForm.email.focus();
		return (false);
		}
	if (theForm.email.value.length < 5){
		alert("Please enter at least 2 characters in the \"e-mail\" field.");
		theForm.email.focus();
		return (false);
		}
	if (theForm.email.value.length > 50)	{
		alert("Please enter at most 100 characters in the \"e-mail\" field.");
		theForm.email.focus();
		return (false);
		}
	if (theForm.nachricht.value == ""){
		alert("Please enter a value for the \"Message\" field.");
		theForm.nachricht.focus();
		return (false);
		}
	if (theForm.nachricht.value.length < 10){
		alert("Please enter at least 2 characters in the \"Message\" field.");
		theForm.nachricht.focus();
		return (false);
		}
	if (theForm.nachricht.value.length > 500){
		alert("Please enter at most 1000 characters in the \"Message\" field.");
		theForm.nachricht.focus();
		return (false);
		}
	return (true);
}
function MM_openBrWindowCentered(theURL,winName,width,height) {
	 var ns = (navigator.appName.indexOf("Netscape") != -1);
     if (ns) {
     middleX = Math.round((window.outerWidth/2) - (width/2)) + window.screenX;
     middleY = Math.round((window.outerHeight/2)- (height/2))+ window.screenX;
     str = 'width='+width+',height='+height+',screenX=' + middleX + ',screenY=' + middleY +', scrollbars=yes';

     }
     else {
     middleX= Math.round((window.screen.width/2) - (width/2));
     middleY= Math.round((window.screen.height/2) - (height/2));
     str = 'width='+width+',height='+height+',left=' + middleX + ',top=' + middleY + ', scrollbars=yes';
     }
     newWindowWin = window.open(theURL,winName,str);
     newWindowWin.focus();
}
function setStyle(){
	var getName = window.location.pathname.split('/');
	var name = getName[1].split('.');
	var title = name[0];
	if(title){
		document.getElementById(title).style.borderColor = "#990000";
		document.getElementById(title).style.color = "#990000";
		document.getElementById(title).style.cursor = "text";
		if(title == 'spektralanalyse'  || title == 'objekte_im_all' || title == 'unser_universum'){
			document.getElementById("astrophysik").style.borderColor = "#990000";
			document.getElementById("astrophysik").style.color = "#990000";
		}
		if(title == 'optische_effekte' || title == 'berechnungsgrundlagen' || title == 'teleskope' || title == 'entfernungsmessung' || title == 'forschung'){
			document.getElementById("astronomie").style.borderColor = "#990000";
			document.getElementById("astronomie").style.color = "#990000";
		}
		if(title == 'relativitaetstheorie' || title == 'quantenmechanik' || title == 'die_superstringtheorie' || title == 'teilchenphysik' || title == 'sternstunden'){
			document.getElementById("physik").style.borderColor = "#990000";
			document.getElementById("physik").style.color = "#990000";
		}
	}
}
function blendMenu(opacity, id){
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function setOver(x) {
	var millisec = 400;
	var speed = Math.round(millisec / 100);
	var timer = 0;
	document.getElementById("astronomieDiv").style.visibility = "hidden";
	document.getElementById("astrophysikDiv").style.visibility = "hidden";
	document.getElementById("physikDiv").style.visibility = "hidden";
	if(x == "astronomieDiv" || x == "astrophysikDiv" || x == "physikDiv"){
		for(i = 0; i <= 100; i++) {
			document.getElementById(x).style.visibility = "visible";
			blendMenu(0, 'astrophysikDiv');
			blendMenu(0, 'astronomieDiv');
			blendMenu(0, 'physikDiv');
			setTimeout("blendMenu(" + i + ",'" + x + "')",(timer * speed));
			timer++;
		}
	}
}
function setAncor() {
  var ancor = window.location.hash;
  if(ancor != 0){
	  newYPosInt = 282;
      setTop("contentDiv", newYPosInt);
	  }
}
	
function scrolling() {
  var ns = (navigator.appName.indexOf("Netscape") != -1);	
  
  sitescroll = ns ? pageYOffset : document.documentElement.scrollTop;
  
  obj1 = document.getElementById("naviDiv");
  obj2 = document.getElementById("astrophysikDiv");
  obj3 = document.getElementById("astronomieDiv");
  obj4 = document.getElementById("physikDiv");
  obj5 = document.getElementById("bannerDiv");
  
  posObj1 = sitescroll + 145;
  posObj2 = sitescroll + 143;
  posObj3 = sitescroll + 167;
  posObj4 = sitescroll + 191;
  posObj5 = sitescroll + 146;

  obj1.style.top = posObj1 + "px";
  obj2.style.top = posObj2 + "px";
  obj3.style.top = posObj3 + "px";
  obj4.style.top = posObj4 + "px";
  obj5.style.top = posObj5 + "px";
  
  //alert(obj1.style.top);
  //alert(posObj1);
  
}

if(document.layers){
        window.captureEvents(Event.MOUSEUP);
        window.onmouseup=setOver;
	} 
else{
        document.onmouseup=setOver;
	}
// Anzahl der Schneeflocken (mehr als 30 - 40 nicht empfehlenswert)
var snowmax=40;

// Farben der Schneeflocken. Es können beliebig viele Farben angegeben werden
var snowcolor=new Array("#AAAACC","#DDDDFF","#CCCCDD","#F3F3F3","#F0FFFF");

// Fonts, welche die Schneeflocken erzeugen. Beliebig viele Fonts ergänzbar
var snowtype=new Array("Arial Black","Arial Narrow","Times","Comic Sans MS");

// Zeichen für die Schneeflocke (empfohlen: * )
var snowletter="*";

// Fallgeschwindigkeit (empfohlen sind Werte zwischen 0.3 bis 2)
var sinkspeed=1.5;

// Maximale Größe der Schneeflocken
var snowmaxsize=22;

// Minimale Größe der Schneeflocken
var snowminsize=8;

/*  Schnee-Zone:
** 1 für überall, 2 für Schneefall nur auf der linken Seite
** 3 für Schneefall in der Mitte, 4 für Schneefall nur auf der rechten Seite */
var snowingzone=1;

/*
* Ab hier nichts mehr ändern *
*/

var snow=new Array();
var marginbottom;
var marginright;
var timer;
var i_snow=0;
var x_mv=new Array();
var crds=new Array();
var lftrght=new Array();
var browserinfos=navigator.userAgent ;
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/);
var ns6=document.getElementById&&!document.all;
var opera=browserinfos.match(/Opera/);
var browserok=ie5||ns6||opera;

function randommaker(range) {		
	rand=Math.floor(range*Math.random());
    return rand;
}

function initsnow() {
	if (ie5 || opera) {
		marginbottom = document.body.clientHeight;
		marginright = document.body.clientWidth;
	}
	else if (ns6) {
		marginbottom = window.innerHeight;
		marginright = window.innerWidth;
	}
	var snowsizerange=snowmaxsize-snowminsize;
	for (i=0;i<=snowmax;i++) {
		crds[i] = 0;                      
    	lftrght[i] = Math.random()*15;         
    	x_mv[i] = 0.03 + Math.random()/10;
		snow[i]=document.getElementById("s"+i);
		snow[i].style.fontFamily=snowtype[randommaker(snowtype.length)];
		snow[i].size=randommaker(snowsizerange)+snowminsize;
		snow[i].style.fontSize=snow[i].size;
		snow[i].style.color=snowcolor[randommaker(snowcolor.length)];
		snow[i].sink=sinkspeed*snow[i].size/5;
		if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size);}
		if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size);}
		if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4;}
		if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2;}
		snow[i].posy=randommaker(2*marginbottom-marginbottom-2*snow[i].size);
		snow[i].style.left=snow[i].posx;
		snow[i].style.top=snow[i].posy;
	}
	movesnow();
}

function movesnow() {
	for (i=0;i<=snowmax;i++) {
		crds[i] += x_mv[i];
		snow[i].posy+=snow[i].sink;
		snow[i].style.left=(snow[i].posx+lftrght[i]*Math.sin(crds[i])) + "px";
		snow[i].style.top=snow[i].posy + "px";
		
		if (snow[i].posy>=marginbottom-2*snow[i].size || parseInt(snow[i].style.left)>(marginright-3*lftrght[i])){
			if (snowingzone==1) {snow[i].posx=randommaker(marginright-snow[i].size);}
			if (snowingzone==2) {snow[i].posx=randommaker(marginright/2-snow[i].size);}
			if (snowingzone==3) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/4;}
			if (snowingzone==4) {snow[i].posx=randommaker(marginright/2-snow[i].size)+marginright/2;}
			snow[i].posy=0;
		}
	}
	var timer=setTimeout("movesnow()",50);
}

for (i=0;i<=snowmax;i++) {
	document.write("<span id='s"+i+"' style='position:absolute;top:-"+snowmaxsize+"px;'>"+snowletter+"</span>");
}
	
function init(){ 
	scrolling();	
	setStyle();
	//initsnow();
}	
window.onload = init;	
window.onscroll = scrolling;
