
/***********************************************************************************/

//---------- Rahmen um Links bei IE weg! -----------

function rahmenweg(derlink) 
{ 
if(document.all) 
{ 
derlink.blur(); 
} 
} 

/***********************************************************************************/

//---------- Fenster ohne Navigation fuer Desktopbild -----------

function WinOpen() 
   {

   window.open("../../a_downloads/b_desktops/dalmatian.jpg","DisplayWindow","menubar=yes,scrollbars=yes");
   window.open("../../a_downloads/b_desktops/dalmatian.jpg","DisplayWindow","menubar=yes,scrollbars=yes");   // double for Macs
   }

/***********************************************************************************/

//---------- Passwortscript fuer Gatekeeper -----------


var statusMsg = "Password Protected Area"
function gateKeeper() {
   gateKeeperBox = window.open('gatemain.html', 'theKeeper', 'width=230,height=100,resizable=yes');
}

/***********************************************************************************/

//---------- Doppelklick -> nach oben auf der Seite -----------

<!--

function dblclick() {
	window.scrollTo(0,0)
}
if (document.layers) {
	document.captureEvents(Event.ONDBLCLICK);
}
document.ondblclick=dblclick;


/***********************************************************************************/

//---------- latest macnews window -----------

function err() {return true;}
window.onerror=err;
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
browserVendor = browserName.substring(0,9);
function msub(N,F) {
if(browserName.substring(0,9)=='Microsoft' && browserVer < 4) {return true;}
D = new Date();
F.target = N + D.getTime();
window.open('',F.target,'toolbar=0,location=1,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=640,height=400');
return false;
}
      

/***********************************************************************************/
//---------- Standard Popup Fenster -----------

var win = null;
function newwindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',toolbar=no,status=no,resizable=yes'
win = window.open(mypage,myname,settings)
if(win.window.focus){win.window.focus();}
}



/***********************************************************************************/

//---------- Shake!! -----------

function shake(n,r) {
if (self.moveBy) {
for (i = r; i > 0; i--) {
for (j = n; j > 0; j--) {
self.moveBy(0,i);
self.moveBy(i,0);
self.moveBy(0,-i);
self.moveBy(-i,0);
         }
      }
   }
}

//----- take that: <body onLoad="shake(1,10)"> or <a href="javascript:shake(1,10)">shake again!</a>

/***********************************************************************************/

//---------- Count outsource!! -----------

       var now = new Date();
       var then = new Date("July 17, 2002");
       var left = then.getTime() - now.getTime();
       var days = Math.floor(left / (1000 * 60 * 60 * 24));
/* statt Datum:

       */

/***********************************************************************************/

//---------- Erde um Sonne Script Science Seite -----------

 new_year_day = 852076800000;
 base_time = new Date();

	function Earth_speed(){
  now_time = new Date();
  interval = now_time.getTime() - base_time.getTime();
		document.forms[0].elements[0].value=Math.round(interval/1000*29.7);
		setTimeout('Earth_speed()',1000);
	}
	function for_newyear(){
		now_time2 = new Date();
  interval2= new_year_day-now_time2.getTime()+now_time2.getTimezoneOffset()*60000;;
		document.forms[1].elements[0].value=Math.round(interval2/1000*29.7);
		setTimeout('for_newyear()',1000);
	}
	
/***********************************************************************************/

//---------- Mond Script Science Seite -----------

function getMoonAge(year, month, day)
{	
	d = Math.floor(year/19)
	r = year-(d*19) //r is the remainder of (year/19)

	while (r>9)
	{	
		r = r-19
	}

	r = r*11

	while (r>29)
	{	
		r = r-30
	}

	if (month<3)
	{	
		month = month+2
	}

	r = r+month+day

	if (year<100)
	{	
		r = r-4
	}
	else
	{
		r = r-8.3
	}

	while(r>29)
	{	
		r = r-30
	}

	while(r<0)
	{	
		r = r+30
	}

	return r
}
		
function getMoonPhase(moonAge)
{	
	if (moonAge<2) return "Neumond"
	if (moonAge<5) return "zunehmend"
	if (moonAge<11) return "erstes Viertel"
	if (moonAge<13) return "fast voll"
	if (moonAge<16) return "Vollmond"
	if (moonAge<20) return "nach voll"
	if (moonAge<24) return "letztes Viertel"
	if (moonAge<29) return "abnehmend"
	if (moonAge<30) return "Neumond"
}

function getMoonPhaseImg(moonAge)
{	
	if (moonAge<2) return "moonnew"
	if (moonAge<5) return "waxinggibbous"
	if (moonAge<11) return "lastquarter"
	if (moonAge<13) return "waninggibbous"
	if (moonAge<16) return "moonfull"
	if (moonAge<20) return "waxingcresent"
	if (moonAge<24) return "firstquarter"
	if (moonAge<29) return "waningcresent"
	if (moonAge<30) return "moonnew"
}


monthNames = new Array(13)
monthNames[1]  = "Januar"
monthNames[2]  = "Februar"
monthNames[3]  = "M&auml;rz"
monthNames[4]  = "April"
monthNames[5]  = "Mai"
monthNames[6]  = "Juni"
monthNames[7]  = "Juli"
monthNames[8]  = "August"
monthNames[9]  = "September"
monthNames[10] = "Oktober"
monthNames[11] = "November"
monthNames[12] = "Dezember"
		 
dayNames = new Array(8)
dayNames[1]  = "Sonntag"
dayNames[2]  = "Montag"
dayNames[3]  = "Dienstag"
dayNames[4]  = "Mittwoch"
dayNames[5]  = "Donnerstag"
dayNames[6]  = "Freitag"
dayNames[7]  = "Samstag"
		 
function getLongDate(dateObj)
{	
	theDay = dayNames[dateObj.getDay()+1]
	theMonth = monthNames[dateObj.getMonth()+1]
	theDate = dateObj.getDate()
	return ""+theDay+", "+theMonth+" "+theDate+", "+theYear
}
		
function getNextFull(moonAge)
{	
	currMilSecs = (new Date()).getTime()
	daysToGo = 15 - moonAge
	while(daysToGo<2)
	{	
		daysToGo = daysToGo+29
	}
	milSecsToGo = daysToGo*24*60*60*1000
	nextMoonTime = currMilSecs+milSecsToGo
	nextMoonDate = new Date(nextMoonTime)
	return nextMoonDate
}
		
function getNextNew(moonAge)
{	
	currMilSecs = (new Date()).getTime()
	daysToGo = 29 - moonAge
	while(daysToGo<2)
	{	
		daysToGo = daysToGo+29
	}
	milSecsToGo = daysToGo*24*60*60*1000
	nextMoonTime = currMilSecs+milSecsToGo
	nextMoonDate = new Date(nextMoonTime)
	return nextMoonDate
}


/***********************************************************************************/

//---------- Wechselbild (Iconfactory) static ist "01.gif" -----------

var images;
var imageCount;

function initOnLoad()
{
	images = new Array(
		"wechselbild/01.gif",
		"wechselbild/02.gif",
		"wechselbild/03.gif",
		"wechselbild/04.gif",
		"wechselbild/05.gif",
		"wechselbild/06.gif",
		"wechselbild/07.gif",
		"wechselbild/08.gif",
		"wechselbild/09.gif");
				
	imageCount = images.length;
	
	randomImage();
}

function randomImage()
{
	var imageElement = document.images["theImage"];
	if (imageElement)
	{
		var randomIndex = Math.floor(Math.random() * 1000) % imageCount;
		imageElement.src = images[randomIndex];
	}
}
