<!--
// (C) 2007 by e-Consultance http://www.e-consultance.de   Dieser (C) Hinweis darf nicht entfernt werden!
// Den (C)-Link auf meine Homepage im Menü -- bitte -- nicht entfernen. Danke!
// Schneefall-Pusteblumen-Weihnachtspäckchen-Animation

// hier ist Anpassung der Domain noetig oder reduzieren aud "images/"
var url="http://www.streamliner.de/images/";           // Anpassen!!!!! mind für die Startseite "images/"

// Folgende Arrays können unterschiedlich viele Bilder haben .... Soviele wie eben gefunden werden (sollten freigestellte GIFS sein...)
bilder=new Array("snow1.gif","snow2.gif","snow3.gif","snow4.gif","snow5.gif","snow6.gif","snow7.gif","snow8.gif");
bilderw=new Array("box1.gif","box2.gif","box3.gif","box4.gif","box5.gif","box6.gif","box7.gif","box8.gif","box9.gif");
bilderf=new Array("fruehling1.gif","fruehling2.gif","fruehling3.gif","fruehling4.gif","fruehling5.gif","fruehling6.gif","fruehling7.gif","fruehling8.gif");
bilders=new Array("sommer1.gif","sommer2.gif","sommer3.gif","sommer4.gif","sommer5.gif","sommer6.gif","sommer7.gif","sommer8.gif");
bilderh=new Array("herbst1.gif","herbst2.gif","herbst3.gif","herbst4.gif","herbst5.gif","herbst6.gif","herbst7.gif","herbst8.gif");

// Nächste Zeile nicht ändern!
animation=new Array(366);

var Calendar = new Date();
var itemNum=31
var months=new Array(31,28,31,30,31,30,31,31,30,31,30,31)

var mydate=new Date()
var myMonth=mydate.getMonth()
var myToday=mydate.getDate()
var myYear=mydate.getYear()
var dateOfYear=0

function isLeapYear(year){
if (year%4!=0) return false
if (year%100==0){
if (year%400==0) return true
return false
}
return true
}

function dayOfYear(){
dateOfYear=0;
for (i=0;i<myMonth;i++)
dateOfYear+=months[i]
dateOfYear+=myToday
if (isLeapYear(myYear) && myMonth > 1) dateOfYear++
return dateOfYear
}


function dayofmonth_iframe(){
if (ie||dom){
var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
iframeobj.src=content[dayOfYear()]
}
}




// ***** HIER ANPASSEN  *************************************************************************************************
// Hier wird die Animationssteuerung vorgenommen. In einer Liste wird pro Tag die Animation definiert
// "w"=Weihnachten, "sn"=Schnee, "f"=Frühling,  "s"=Sommer  "h"=Herbst    "x"=keine Animation heute
for (i=0                          ;i<31+28                   ;++i){animation[i]="x"; } // vom Tag 1.1. bis 28.2 Schnee
for (i=31+28                    +1;i<31+28+31+30+31          ;++i){animation[i]="x";} // vom Tag 1.3. bis 31.5.Frühling
for (i=31+28+31+30+31           +1;i<31+28+31+30+31+30+31+31 ;++i){animation[i]="x";} // vom Tag 1.6. bis 31.8.Sommer
for (i=31+28+31+30+31+30+31+31  +1;i<366 							 ;++i){animation[i]="x";} // vom Tag 1.9. bis Ende des Jahres Herbst (Winter wird drübergeschrieben)
for (i=366-31							 ;i<366							 ;++i){animation[i]="sn"; } // vom Tag 366 - 32 => 1.12. ggf. 30.11. bis 31.12. Schnee
if ((Calendar.getDate()==24) && (Calendar.getMonth()+1 == 12)) {animation[dayOfYear()]="w";} // am 24.12. Weihnachten (Heute aktuelles Datum "Weihnachtsanimation")
if ((Calendar.getDate()==25) && (Calendar.getMonth()+1 == 12)) {animation[dayOfYear()]="w";} // am 25.12. Weihnachten analog
if ((Calendar.getDate()==26) && (Calendar.getMonth()+1 == 12)) {animation[dayOfYear()]="w";} // am 26.12. Weihnachten
if ((Calendar.getDate()==27) && (Calendar.getMonth()+1 == 12)) {animation[dayOfYear()]="w";} // am 27.12. Weihnachten

// ***** Ab hier nichts mehr ändern! ****************************************
var no = 200; // Anzahl der Schneeflocken
var nos = 20; // Anzahl der Schneeflocken
var ext="";
var weihnachten=0;
var lastmode=2;
var Season=1;
var onoff=0;
var schneetiefe = 120;
var snowflake; // Bild der Schneeflocke, beliebig
var speed = 25; // "Schnei-Geschwindigkeit"; je kleiner die Zahl, um so schneller fallen die Flocken
var ns4up = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4") ? 1 : 0; // Browser Tester
var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
var dx, xp, yp; // Variablen für Koordinaten und Position
var am, stx, sty; //Variablen für Amplitude und Schrittweite
var i, doc_width = 1000, doc_height = 100;
if (ns4up||ns6up) { // Bildschirm-Auflösung holen, Netscape-Funktion
doc_width = 1200;
doc_height = 120;
} else if (ie4up) { // Bildschirm-Auflösung holen, Internet Explorer-Funktion
doc_width = 1200;
doc_height = 120;
}

//document.write("<div onmouseover=\"high()\">High</div><br />");
// document.write("<div onmouseover=\"low()\">low</div>");
xname="<div";xxname="</div>"
if (ns4up) {xname="<layer";xxname="</layer>"}
document.write(xname," id=\"Winter\" onmouseover=\"document.getElementById('Winter').style.cursor='hand';\" ");
document.write("style=\"position: absolute;top:10px; left: 40px; width:116px;background-color:#eeeeee;margin:2px;padding:2px;border:1px solid #aaaaaa;z-index:1\" onmousedown=\"mon()\"><b>Animation &auml;ndern</b><br />");
document.write(xname," id=\"wmenue\" style=\"display:none\">");
document.write("<form action=\"\" name=\"formular\" style=\"display:none;\"><p><input type=\"text\" name=\"ausgabe\" readonly=\"readonly\" size=\"90\"></p></form>");
document.write("<form style=\"width:110px;background-color:#eeeeee;margin:1px;border:1px solid #888888;\">");
document.write("<input type=\"radio\" name=\"Dichte\" onmousedown=\"high()\" value=\"hoch\"> Chaos<br \>");
document.write("<input type=\"radio\" name=\"Dichte\" onmousedown=\"normal()\" value=\"normal\" checked=\"checked\"> etwas mehr<br \>");
document.write("<input type=\"radio\" name=\"Dichte\" onmousedown=\"low()\" value=\"low\"> leicht<br \>");
document.write("<input type=\"radio\" name=\"Dichte\" onmousedown=\"off()\" value=\"off\"> aus<br \>");
document.write("</form>");
document.write("<form style=\"width:110px;background-color:#eeeeee;margin:1px;border:1px solid #888888;\">");
document.write("<input type=\"radio\" name=\"Dichte\" onmousedown=\"thigh()\" value=\"hoch\" checked=\"checked\"> auf den Bergen<br \>");
document.write("<input type=\"radio\" name=\"Dichte\" onmousedown=\"tnormal()\" value=\"normal\"> im Mittelgebirge <br \>");
document.write("<input type=\"radio\" name=\"Dichte\" onmousedown=\"tlow()\" value=\"low\"> ins Flachland<br \>");
document.write("</form>");
document.write("</form>");
document.write("<form style=\"width:110px;background-color:#eeeeee;margin:1px;border:1px solid #888888;\">");
document.write("<input type=\"radio\" name=\"Dichte\" onmousedown=\"xlow()\" value=\"hoch\" checked=\"checked\"> Windstille<br \>");
document.write("<input type=\"radio\" name=\"Dichte\" onmousedown=\"xnormal()\" value=\"normal\"> Seitenwind <br \>");
document.write("<input type=\"radio\" name=\"Dichte\" onmousedown=\"xhigh()\" value=\"low\"> B&ouml;en<br \>");
document.write("</form>");
document.write("<form style=\"width:110px;background-color:#eeeeee;margin:1px;border:1px solid #888888;\">");
document.write("<input type=\"radio\" name=\"WDichte\" onmousedown=\"whigh()\" value=\"hoch\"> Weihnachten<br \>");
document.write("<input type=\"radio\" name=\"WDichte\" onmousedown=\"ihigh()\" value=\"hoch\" checked=\"checked\"> Winter<br \>");
document.write("<input type=\"radio\" name=\"WDichte\" onmousedown=\"hhigh()\" value=\"hoch\"> Herbst<br \>");
document.write("<input type=\"radio\" name=\"WDichte\" onmousedown=\"shigh()\" value=\"hoch\"> Sommer<br \>");
document.write("<input type=\"radio\" name=\"WDichte\" onmousedown=\"fhigh()\" value=\"hoch\"> Fr&uuml;hling<br \>");
document.write("</form>");
document.write("<form style=\"width:110px;background-color:#eeeeee;margin:1px;border:0px solid #888888;\">");
document.write("<input type=\"checkbox\" name=\"nur Schnee\" onmousedown=\"nurschnee()\"> Natur Pur</form>");
document.write("<div onmousedown=\"moff()\"> Men&uuml; aus&nbsp;&nbsp;<a href=\"http://www.e-Consultance.de\"><span style=\"font-size:7px;color:#aaaaaa;\">(C) 2007</span></a></div>");
document.write(xxname, xxname);


dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
// Init Routine aller Layers
for (jahreszeit=0;jahreszeit< 5;++jahreszeit)
{
	for (i = 0; i < no; ++ i) {
		if (jahreszeit==0){ext="w"; snowflake=url+bilderw[Math.floor(Math.random()*bilderw.length)];}
		if (jahreszeit==1){ext=""; snowflake=url+bilder[Math.floor(Math.random()*bilder.length)];}
		if (jahreszeit==2){ext="h"; snowflake=url+bilderh[Math.floor(Math.random()*bilderh.length)];}
		if (jahreszeit==3){ext="s"; snowflake=url+bilders[Math.floor(Math.random()*bilders.length)];}
		if (jahreszeit==4){ext="f"; snowflake=url+bilderf[Math.floor(Math.random()*bilderf.length)];}
		//document.formular.ausgabe.value = " SFLAKW "+snowflake;
		setTimeout("", 100);
		doc_height = 150;
		lastmode=2;
		direct=1;
		dx[i] = 0; // Koordinaten-Variable setzen
		xp[i] = Math.random()*(doc_width-50); // Position-Variable setzen
		yp[i] = Math.random()*doc_height;
		am[i] = Math.random()*20; // Amplituden-Variable setzten
		stx[i] = 0.02 + Math.random()/10; // Variable für Schrittweite setzen
		sty[i] = 0.7 + Math.random(); // Variable für Schrittweite setzen
		// ----------------------------------------------------------------------
		// Layer konfigurieren für Netscape
		if (ns4up) {
			if (i == 0) {
			document.write("<layer name=\""+ext+"dot"+ i +"\" left=\"15\" ");
			document.write("top=\"15\" visibility=\"show\"><img src=\"");
			document.write(snowflake + "\" border=\"0\"></layer>");
			} else {
			document.write("<layer name=\""+ext+"dot"+ i +"\" left=\"15\" ");
			document.write("top=\"15\" visibility=\"show\"><img src=\"");
			document.write(snowflake + "\" border=\"0\"></layer>");
			}
		// ----------------------------------------------------------------------
		// Layer konfigurieren für <> NS4
		} else if (ie4up||ns6up) {
			if (i == 0) {
				document.write("<div id=\""+ext+"dot"+ i +"\" style=\"POSITION: ");
				document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
				document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
				document.write(snowflake + "\" border=\"0\"></div>");
			} else {
				document.write("<div id=\""+ext+"dot"+ i +"\" style=\"POSITION: ");
				document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
				document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
				document.write(snowflake + "\" border=\"0\"></div>");
			}
		}
	}
}

function makeit()
{
var divide;
// Schneetiefe wieviele pixel von oben, da es nicht nur die Client-Höhe ist, sondern die Gesamtseite
// kann das größer als die Bildschirm hoehe sein
	if (ns4up) {
		max_doc_width = self.innerWidth;
		max_doc_height = self.innerHeight;
	} else if (ie4up) {
		max_doc_width = document.body.clientbWidth;
		max_doc_height = document.body.clientHeight;
	}else if (ns6up) {
		max_doc_width = self.innerWidth;
		max_doc_height = self.innerHeight;
	}
	for (jahreszeit=0;jahreszeit< 5;++jahreszeit)
	{ 	if (jahreszeit==0){ext="w"; }
		if (jahreszeit==1){ext=""; }
		if (jahreszeit==2){ext="h"; }
		if (jahreszeit==3){ext="s"; }
		if (jahreszeit==4){ext="f"; }
		for (i = 0; i < no; ++ i) {document.getElementById(ext+"dot"+i).style.display = "none";}
	}

	if (Season==0){ext="w"; }
	if (Season==1){ext=""; }
	if (Season==2){ext="h"; }
	if (Season==3){ext="s"; }
	if (Season==4){ext="f"; }
	if (Season!=1){divide=2;}else{divide=1;}
	for (i = 0; i < nos/divide; ++ i) {document.getElementById(ext+"dot"+i).style.display = "block";}

	for (i = 0; i < nos; ++ i) {
		dx[i] = 0; // Koordinaten-Variable setzen
		xp[i] = Math.random()*(1000-60); // Position-Variable setzen
		yp[i] = Math.random()*schneetiefe;
		am[i] = Math.random()*20; // Amplituden-Variable setzten
		stx[i] = 0.02 + Math.random()/10; // Variable für Schrittweite setzen
		sty[i] = 0.7*3/(lastmode+1)*3/(lastmode+1) + Math.random(); // Variable für Schrittweite setzen
	}
	document.formular.ausgabe.value = " Makeit Ext=\""+ ext+"\" Season="+Season+" os="+nos;
}

function whigh(){ Season=0; makeit(); }
function ihigh(){ Season=1; makeit(); }
function hhigh(){ Season=2; makeit(); }
function shigh(){ Season=3; makeit(); }
function fhigh(){ Season=4; makeit(); }

function high(){
document.formular.ausgabe.value = " ihigh"
if (schneetiefe==1400) {  nos=129;}
if (schneetiefe==600) {  nos=100;}
if (schneetiefe==120) {  nos=60;}
  speed=0;
  lastmode=1;
  makeit();
}
function normal(){
if (schneetiefe==1400) {  nos=100;}
if (schneetiefe==600) {  nos=60;}
if (schneetiefe==120) {  nos=20;}
  speed=25;
  lastmode=2;
  makeit();
}
function low(){
if (schneetiefe==1400) {  nos=80;}
if (schneetiefe==600) {  nos=40;}
if (schneetiefe==120) {  nos=5;}
  speed=40;
 lastmode=3;
 makeit();
}
function off(){
  nos=0;
  lastmode=4;
  makeit();
}

function thigh(){
  schneetiefe = 120;
  if (lastmode==1) {high();}
  if (lastmode==2) {normal();}
  if (lastmode==3) {low();}
  if (lastmode==4) {normal();}
}
function tnormal(){
  schneetiefe = 600;
  if (lastmode==1) {high();}
  if (lastmode==2) {normal();}
  if (lastmode==3) {low();}
  if (lastmode==4) {normal();}
}
function tlow(){
  schneetiefe = 1400;
  if (lastmode==1) {high();}
  if (lastmode==2) {normal();}
  if (lastmode==3) {low();}
  if (lastmode==4) {normal();}
}
// Windoptionen Windstille, Seitenwind, Boen (Die Namen sind falsch)
function xlow(){direct=1;}
function xnormal(){ direct=2;}
function xhigh(){ direct=3;}

function mon(){
	// Menu vergrößern
	if	 (onoff==0) {	document.getElementById("wmenue").style.display = "block"; }
	onoff=0;
}
function moff(){
	// Menu wieder verkleinern
  document.getElementById("wmenue").style.display = "none";
  onoff=1;
}
function nurschnee(){
 document.getElementById("zentrieren").style.display = "none";
 document.getElementById("zentrieren").style.bgcolor = "#000000";
 document.getElementById("Winter").style.display = "none";
 //document.getElementById("body").style.background-color = "#000000";
 //document.getElementsByTagName("body")[0].bgColor =	"#000000";
 //document.getElementsByTagName("html")[0].bgColor =	"#000000";
}

// ----------------------------------------------------------------------
// Haupt-Animations-Funktion für Netscape
function snowNS() {
for (i = 0; i < nos; ++ i) {
yp[i] += sty[i];
if ((yp[i] > schneetiefe) || (xp[i] > 1200-80)){
xp[i] = Math.random()*(doc_width-am[i]-50);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7*3/(lastmode+1)*3/(lastmode+1) + Math.random();
if (schneetiefe>150){sty[i]=sty[i]*(4-lastmode);}
//doc_width = self.innerWidth;
//doc_height = self.innerHeight;
}
dx[i] += stx[i];
document.layers[ext+"dot"+i].top = yp[i];
ms=am[i]*Math.sin(dx[i]);
if ((ms<0) && (direct>1)) {ms=ms*-1; xp[i]=xp[i]+ms/2;}
if (direct==3) {ms=3*ms;xp[i]=xp[i]+ms/2;}
document.layers[ext+"dot"+i].left = xp[i] + ms;
}
setTimeout("snowNS()", speed);
}
// ----------------------------------------------------------------------
// Haupt-Animations-Funktion für Internet Explorer
function snowIE() {
for (i = 0; i < nos; ++ i) {
yp[i] += sty[i];
if ((yp[i] > schneetiefe) || (xp[i] > 1200-80)){
xp[i] = Math.random()*(doc_width-am[i]-50);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7*3/(lastmode+1)*3/(lastmode+1) + Math.random();
if (schneetiefe>150){sty[i]=sty[i]*(4-lastmode);}
//doc_width = document.body.clientbWidth;
//doc_height = document.body.clientHeight;
}
dx[i] += stx[i];
document.all[ext+"dot"+i].style.pixelTop = yp[i];
ms=am[i]*Math.sin(dx[i]);
if ((ms<0) && (direct>1)) {ms=ms*-1; xp[i]=xp[i]+ms/2;}
if (direct==3) {ms=3*ms;xp[i]=xp[i]+ms/2;}
document.all[ext+"dot"+i].style.pixelLeft = xp[i] + ms;
}
setTimeout("snowIE()", speed);

}
// Haupt-Animations-Funktion für Netscape6 und Mozilla
function snowNS6() {
for (i = 0; i < nos; ++ i) {
yp[i] += sty[i];
if ((yp[i] > schneetiefe) || (xp[i] > 1200-80)){
xp[i] = Math.random()*(doc_width-am[i]-50);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7*3/(lastmode+1)*3/(lastmode+1) + Math.random();
if (schneetiefe>150){sty[i]=sty[i]*(4-lastmode);}
//doc_width = self.innerWidth;
//doc_height = self.innerHeight;
}
dx[i] += stx[i];
document.getElementById(ext+"dot"+i).style.top = yp[i]+"px";
ms=am[i]*Math.sin(dx[i]);
if ((ms<0) && (direct>1)) {ms=ms*-1; xp[i]=xp[i]+ms/2;}
if (direct==3) {ms=3*ms;xp[i]=xp[i]+ms/2;}
document.getElementById(ext+"dot"+i).style.left = xp[i] + ms+"px";
}
setTimeout("snowNS6()", speed);
}

var modex=animation[dayOfYear()];
document.formular.ausgabe.value = " Modus "+modex+ " doy"+dayOfYear();
thigh();
normal()
if (modex=="w"){whigh();}  // Weihnachten
if (modex=="sn"){ihigh();}   // Winter
if (modex=="h"){hhigh();}  // Herbst
if (modex=="s"){shigh();}  // Sommer
if (modex=="f"){fhigh();}  // Frühling
if (modex=="x"){off();}  // Aus


if (ns4up) {
snowNS();
} else if (ie4up) {
snowIE();
}else if (ns6up) {
snowNS6();
}
// End -->
