// Alt-O-Matic (c) Christian Heilmann
// Version 1.0 
// finished on 19.08.1999
// requires 4.x browser, older browsers will not execute the code
//
// For contact refer to: http://www.onlinetools.org and email me at info@onlinetools.org
// Free of charge with this copyright notice
// Gives you the opportunity to create Alt Message for Textlinks. This may sound bogus in the first place,but
// can save you a lot of space on your page.
//
// USAGE:
// Insert the code as src-link or direct in the html head, 
// Call the init-routine with <BODY onload="initalt()">
// Call the alt-routine via mouseover 
// <a href="" onmouseover="doalt('your message')" onmouseout="realt()">Link</A>
// You can use any html you want as your message, so this could also be used for some 
// Menus...
//
function initalt() {
		// Variables
		
		
		altback="#E5E8E5"; 	// Alt-Message background color
		altborder="#FFFFFF";	// Alt-Message border color
		altfont="arial";	// Alt-Message Font
                altfontcolor="black";	// Alt-Message Font color
		altfontsize="1"; 	// Alt-Message Font Size
		altoffx=5; 		// Alt-Message horizontal offset from mouse-position
		altoffy=15; 		// Alt-Message vertical offset from mouse-position
		altwidth=225; 		// Alt-Message width, will be expanded by your message
		altheight=100;		// Alt-Message height, will be expanded by your message
		
		
		// end of Variables


		document.onmousedown = sniff;
                document.onmousemove = sniff;
                document.onmouseup = sniff;
              
                if (document.layers) { //NS
			
			document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP)
			document.layers['altmessage'] = new Layer(altwidth)
			document.layers['altmessage'].left = 0
			document.layers['altmessage'].top = 0
			document.layers['altmessage'].height = altheight
			document.layers['altmessage'].bgColor = altback
			document.layers['altmessage'].visibility = "hidden"
			document.layers['altmessage'].borderStyle = "solid"
			document.layers['altmessage'].borderColor = altborder
			document.layers['altmessage'].borderWidth = 1
		} else if (document.all)	{ //IE
			document.body.insertAdjacentHTML("BeforeEnd",'<DIV ID="altmessage" STYLE="z-index:200;position:absolute;width:'+altwidth+';height:'+altheight+';left:0;top:0;visibility:hidden;background:'+altback+';border-style:solid;border-width:1;border-color:'+altborder+'"></DIV>')
		}
}

function sniff(e) {
// GETS Mouseposition
	if (document.layers) {
		var mousex=e.pageX;
		var mousey=e.pageY;
		
		
		
		document.layers['altmessage'].left = mousex+altoffx;
		document.layers['altmessage'].top = mousey+altoffy;
	} else if (document.all) {
		var mousex=event.x;
		var maxY = document.body.clientHeight;
		var mousey=event.y+document.body.scrollTop;
		var screenTest = mousey+altheight+altoffy;
		
		if(screenTest > maxY) {
			altmessage.style.top=300-altheight-altoffy;
			altmessage.style.left=100;
		} else {
			altmessage.style.top=315+altoffy;
			altmessage.style.left=340;
		}

		
	}
}
function doalt(message)		{

//The main routine
	content='<table cellpadding="3" width="100%"><tr><td><font face="'+altfont+'" size="'+altfontsize+'" color="'+altfontcolor+'">'+message+'</FONT></td></tr></table>';					

	if (document.layers) {
		with (document.layers['altmessage'].document) {
			open();
                       	write(content);
                       	close();
               	}
		document.layers['altmessage'].visibility = "show";
	} else if (document.all) { 

		
		document.all['altmessage'].innerHTML = content;
		document.all['altmessage'].style.visibility = "visible";
	}
}
function realt(){
	
	if (document.layers){
		document.layers['altmessage'].visibility = "hidden";
	} else if (document.all) {
		
		document.all['altmessage'].style.visibility = "hidden";
	}
}



function NewWindow(URL,name,width,height) {
   HorizPos = 0;
   VertPos = 0;
   
   if(screen){
   HorizPos = (screen.width-width) / 2;
   VertPos = (screen.height-height) / 2;
   }

   varPopupWin=window.open(URL, name,'width='+width+',height='+height+',left='+HorizPos+',top='+VertPos+',scrollbars=no,toolbar=no,menubar=no,resizeable=no');
   varPopupWin.focus(); 
}

var currentpic = 0; // counter for the current pic

var wait = 5000; // time between fades, in milliseconds

function swapFade(){	

	if(document.getElementById("rotated")) {
			
		pics 	= document.getElementById("rotated").getElementsByTagName("img");		

		Effect.Fade(pics[currentpic].id, { duration:1, from:1.0, to:0.0 });
		
		currentpic++; // advance to the next pic
		
		if (currentpic == pics.length) { // are we at the end? then reset the counter
			currentpic = 0;
		}
		
		Effect.Appear(pics[currentpic].id, { duration:2, from:0.0, to:1.0 });		

	} else {
		return true;  
	}
}

function startpage(){
	setInterval('swapFade()',wait);	 // will call swapFade every 'wait' milliseconds
}
