/*
ALTTXT V1.6
BY: BRIAN GOSSELIN OF SCRIPTASYLUM.COM
V.1.6a
added return true in function writetxt()
V.1.6b
removed AT. and the this.
V.1.6c
replaced window.onload with function initAlttxt()
opacity=99 instead of 100 because firefox
*/

var dofade=true;		// ENABLES FADE-IN EFFECT (FOR IE4+ AND NS6 ONLY)
var centertext=true;	// CENTERS THE TEXT INSIDE THE BOX. YOU CAN'T SIMPLY DO THIS VIA "STYLE" BECAUSE OF NS4, OTHERWISE, TEXT IS LEFT-JUSTIFIED.
var xoffset=9;			// HORIZONTAL PIXEL COUNT FROM CURSOR
var yoffset=18;			// VERTICAL PIXEL COUNT FROM CURSOR
var mousefollow=true;	// ENABLES MOUSE FOLLOW MODE WHERE THE BOX CONTINUES TO FOLLOW THE MOUSE. SET TO false TO LOCK THE BOX WHEREVER IT INITIALLY APPEARS.
var hideDelay=300;		// DELAY IN MILLISECONDS ( 1 SECOND = 1000 MILLISECONDS) FROM WHEN YOU HOVER OUT OF LINK AND THE BOX DISAPPEARS ONLY WHEN "mousefollow" IS SET TO "false". THIS WILL GIVE THE USER TIME TO CLICK A LINK OR WHATEVER IN THE BOX BEFORE IT DISAPPEARS.
var ieopmax=88;			// MAXIMUM OPACITY, NOT 100!!
var ieopstep=11;		// STEP, must be dividable by ieopmax without rest

// NO NEED TO EDIT BEYOND THIS POINT //

var w3c=(document.getElementById)? true : false;
var ns4=(document.layers)? true : false;
var ie4=(document.all && !w3c)? true : false;
var ie5=(document.all && w3c)? true : false;
var ns6=(w3c && navigator.appName.indexOf("Netscape")>=0)? true : false;
var w_y=0;
var w_x=0;
var navtxt=null;
var boxheight=0;
var boxwidth=0;
var ishover=false;
var ieop=0;
var op_id=0;
var oktomove=false;
var dy=0;

function toggle_centertext(){
centertext=!centertext;
}
function toggle_mousefollow(){
mousefollow=!mousefollow;
}
function toggle_dofade(){
dofade=!dofade;
if(!dofade)ieop=ieopmax;
}
function getwindowdims(){
w_y=(ie5||ie4)? document.body.clientHeight : window.innerHeight;
w_x=(ie5||ie4)? document.body.clientWidth : window.innerWidth;
}
function getboxwidth(){
if(ns4)boxwidth=(navtxt.document.width)? navtxt.document.width : navtxt.clip.width;
else if(ie4)boxwidth=(navtxt.style.pixelWidth)? navtxt.style.pixelWidth : navtxt.offsetWidth;
else boxwidth=(navtxt.style.width)? parseInt(navtxt.style.width) : parseInt(navtxt.offsetWidth);
}
function getboxheight(){
if(ns4)boxheight=(navtxt.document.height)? navtxt.document.height : navtxt.clip.height;
else if(ie4)boxheight=(navtxt.style.pixelHeight)? navtxt.style.pixelHeight : navtxt.offsetHeight;
else boxheight=parseInt(navtxt.offsetHeight);
}
function movenavtxt(x,y){
if(ns4)navtxt.moveTo(x,y);
else{
navtxt.style.left=x+'px';
navtxt.style.top=y+'px';
}
}
function getpagescrolly(){
if(ie5||ie4)return document.body.scrollTop;
else return window.pageYOffset;
}
function getpagescrollx(){
if(ie5||ie4)return document.body.scrollLeft;
else return window.pageXOffset;
}
function writeindiv(text){
if(ns4){
navtxt.document.open();
navtxt.document.write(text);
navtxt.document.close();
}
else navtxt.innerHTML=text;
}
function writetxt(text){
if(dofade && (ie4||w3c))clearInterval(op_id);
if(text!=0){
if(!mousefollow)clearTimeout(dy);
oktomove=true;
ishover=true;
if(ns4)text='<div class="navtext">'+((centertext)? '<center>' : '')+text+((centertext)? '</center>' : '')+'</div>';
if(w3c||ie4)navtxt.style.textAlign=(centertext)? "center" : "left";
writeindiv(text);
if(ns4)navtxt.visibility="show";
else{
	navtxt.style.visibility="visible";
	navtxt.style.display="block";
	}
getboxheight();
if((w3c||ie4) && dofade){
	if(ie4||ie5)navtxt.style.filter="alpha(opacity=0)";
	if(ns6)navtxt.style.MozOpacity=0;
	ieop=0;
	op_id=setInterval('incropacity()',50);
	}
}
else{
if(mousefollow)hideAlttxt();
else dy=setTimeout('hideAlttxt()',hideDelay);
}
return true;
}
function hideAlttxt(){
if(ns4)navtxt.visibility="hide";
else{
navtxt.style.display="none";
navtxt.style.visibility="hidden";
}
movenavtxt(-boxwidth-10,0);
writeindiv('');
}
function incropacity(){
if(ieop<ieopmax){
ieop+=ieopstep;
if(ie4||ie5)navtxt.style.filter="alpha(opacity="+ieop+")";
if(ns6)navtxt.style.MozOpacity=ieop/100;
}
else clearInterval(op_id);
}
function moveobj(evt){
mx=(ie5||ie4)? event.clientX : evt.pageX;
my=(ie5||ie4)? event.clientY : evt.pageY;
if(ishover && oktomove){
margin=(ie4||ie5)? 5 : 25;
if(ns6)if(document.height+27-window.innerHeight<0)margin=15;
if(ns4)if(document.height-window.innerHeight<0)margin=10;
if(ns4||ns6)mx-=getpagescrollx();
if(ns4)my-=getpagescrolly();
xoff=mx+xoffset;
yoff=(my+boxheight+yoffset-((ns6)? getpagescrolly() : 0)>=w_y)? -5-boxheight-yoffset : yoffset;
movenavtxt(Math.min(w_x-boxwidth-margin,Math.max(2,xoff))+getpagescrollx(),my+yoff+((!ns6)? getpagescrolly() : 0));
if(!mousefollow)oktomove=false;
}
}
function initAlttxt(){
navtxt=(ns4)? document.layers['navtxt'] : (ie4)? document.all['navtxt'] : (w3c)? document.getElementById('navtxt') : null;
getboxwidth();
getboxheight();
getwindowdims();
if(ie4||ie5 && dofade)navtxt.style.filter="alpha(opacity=100)";
navtxt.onmouseover=function(){
if(!mousefollow)clearTimeout(dy);
}
navtxt.onmouseout=function(){
if(!mousefollow)dy=setTimeout('hideAlttxt()',hideDelay);
}
if(ns4)document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=moveobj;
window.onresize=getwindowdims;
}
