/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  ALTTXT V1.2
//  BY: BRIAN GOSSELIN OF SCRIPTASYLUM.COM
//  ADDED FADING EFFECT FOR IE4+ AND NS6+ ONLY AND OPTIMIZED THE CODE A BIT.
//  SCRIPT FEATURED ON DYNAMIC DRIVE (http://www.dynamicdrive.com) 


var dofade=true;     // ENABLES FADE-IN EFFECT FOR IE4+ AND NS6 ONLY
var center=true;     // CENTERS THE BOX UNER THE MOUSE, OTHERWISE DISPLAYS BOX TO THE RIGHT OF THE MOUSE
var centertext=false; // CENTERS THE TEXT INSIDE THE BOX. YOU CAN'T SIMPLY DO THIS VIA STYLE BECAUSE OF NS4.
                     // OTHERWISE, TEXT IS LEFT-JUSTIFIED. 

//GLOSSARY
var gpath = "images/"
var amplitude = "The maximum displacement from the x axis in either the positive or negative direction."
var axis = "<IMG SRC='"+gpath+"graph05.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>One of two straights line on a graph from which measurements are taken.  One axis (the y axis) is vertical; the other (the x axis)is horizontal.<BR><B>'x is a cross - wise up!'</B>"
var coordinate = "<IMG SRC='"+gpath+"graph06.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>One of the measurements of distance of a point from the axes of the graph."
var constant = "A value in a formula or equation that cannot change."
var coefficient = "The constant value in an expression, for example in 3x the coefficient of x is 3."
var conic = "One of the family of curves that include circle, parabola, ellipse and hyperbola."
var cosine = "<IMG SRC='"+gpath+"graph03.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>The trigonometrical function defined as adjacent/hypotenuse in a right-angled triangle."
var cubic = "<IMG SRC='"+gpath+"graph10.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>A mathematical expression of the 3rd degree; having a x³ term but no higher one."
var equation = "A statement that two mathematical expressions are equal."
var exponential = "A function having variables as exponents."
var exponent = "The power or index of a number; for example in x³, the exponent is 3."
var fraction = "A number written as one integer divided by another."
var frequency = "The rate of repetition of a periodic function."
var func = "A rule that connects one value with another."
var gradient = "<IMG SRC='"+gpath+"graph16.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>The slope of a line; the angle of its inclination to the horizontal."
var graph = "A diagram showing a relationship between two variables.  <BR>The diagram shows a vertical y axis and a horizontal x axis."
var intersection = "<IMG SRC='"+gpath+"graph09.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>The point on a graph where two lines cross."
var intercept = "<IMG SRC='"+gpath+"graph12.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>The point on a graph where a line crosses one of the axes."
var integer = "A positive or negative whole number."
var linear = "<IMG SRC='"+gpath+"graph01.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT' >A linear line is straight, not curved.  A linear equation is of the first degree, for example y = 2x+1."
var locus = "A set of points that fit a given rule."
var maximum = "The largest value possible."
var minimum = "The smallest value possible."
var normal = "A line passing through a curve at a point that is perpendicular to the tangent to the curve at that same point."
var origin = "<IMG SRC='"+gpath+"graph08.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>The point from where all measurements of coordinates are made; usually the point where the two axes of a graph cross."
var quadrant = "<IMG SRC='"+gpath+"graph15.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>One of the four equal areas that the axes divide the graph space into."
var quadratic = "<IMG SRC='"+gpath+"graph07.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>A mathematical expression of the 2nd degree; having a x² term but no higher one."
var parallel = "<IMG SRC='"+gpath+"graph13.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>Having the same gradient."
var perpendicular = "<IMG SRC='"+gpath+"graph14.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>One line being at right angles to another."
var periodic = "A function that repeats the same values over and over again."
var plot = "To mark a point on a graph accurately by using its coordinates."
var polynomial = "An expression which has whole-numbered powers of the variable, x, multiplied by coefficients, and added together.<BR> Examples: y = 2x, y = 1+x², <NOBR>y = 3-2x+7x³</NOBR>"
var reciprocal = "<IMG SRC='"+gpath+"graph11.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>The number produced by dividing 1 by a specified number."
var rule = "A method for connecting one value with another."
var sine = "<IMG SRC='"+gpath+"graph02.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>The trigonometrical function defined as opposite/hypotenuse in a right-angled triangle."
var slope = "The angle between a straight line and the horizontal."
var solve = "To find the answer or solution to a problem."
var solution = "The answer to a problem."
var straight = "The type of line produced by a linear equation."
var tangent = "<IMG SRC='"+gpath+"graph04.gif' WIDTH='73' HEIGHT='74' BORDER='0' ALIGN='LEFT'>1. The trigonometrical function defined as opposite/adjacent in a right-angled triangle.  <BR>2. A straight line that touches a curve at one point."
var transformation= "A change in form or shape."
var translation = "A transformation of a line or shape consisting of a simple movement without change of orientation."
var trigonometry = "The study of the relationships between the angles and sides of triangles."
var turning = "The point on a curve when the gradient is zero."
var variable = "A value which is unknown and free to vary, often denoted by x or y."
	
var dofade=true;       // ENABLES FADE-IN EFFECT (FOR IE4+ AND NS6 ONLY)

var centertext=false;  // 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=25;        // VERTICAL PIXEL COUNT FROM CURSOR

var mousefollow=false; // 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.

							
////////////////////////////// NO NEED TO EDIT BEYOND THIS POINT //////////////////////////////////////

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

var AT=new altProps();

function toggle_centertext(){
centertext=!centertext;
}

function toggle_mousefollow(){
mousefollow=!mousefollow;
}

function toggle_dofade(){
dofade=!dofade;
if(!dofade)AT.ieop=100;
}


function getwindowdims(){
AT.w_y=(AT.ie5||AT.ie4)?document.body.clientHeight:window.innerHeight;
AT.w_x=(AT.ie5||AT.ie4)?document.body.clientWidth:window.innerWidth;
}

function getboxwidth(){
if(AT.ns4)AT.boxwidth=(AT.navtxt.document.width)? AT.navtxt.document.width : AT.navtxt.clip.width;
else if(AT.ie4)AT.boxwidth=(AT.navtxt.style.pixelWidth)? AT.navtxt.style.pixelWidth : AT.navtxt.offsetWidth;
else AT.boxwidth=(AT.navtxt.style.width)? parseInt(AT.navtxt.style.width) : parseInt(AT.navtxt.offsetWidth);
}

function getboxheight(){
if(AT.ns4)AT.boxheight=(AT.navtxt.document.height)? AT.navtxt.document.height : AT.navtxt.clip.height;
else if(AT.ie4)AT.boxheight=(AT.navtxt.style.pixelHeight)? AT.navtxt.style.pixelHeight : AT.navtxt.offsetHeight;
else AT.boxheight=parseInt(AT.navtxt.offsetHeight);
}

function movenavtxt(x,y){
if(AT.ns4)AT.navtxt.moveTo(x,y);
else{
AT.navtxt.style.left=x+'px';
AT.navtxt.style.top=y+'px';
}}

function getpagescrolly(){
if(AT.ie5||AT.ie4)return document.body.scrollTop;
else return window.pageYOffset;
}

function getpagescrollx(){
if(AT.ie5||AT.ie4)return document.body.scrollLeft;
else return window.pageXOffset;
}

function writeindiv(text){
if(AT.ns4){
AT.navtxt.document.open();
AT.navtxt.document.write(text);
AT.navtxt.document.close();
}
else AT.navtxt.innerHTML=text;
}

function writetxt(text){
if(dofade && (AT.ie4||AT.w3c))clearInterval(AT.op_id);
if(text!=0){
if(!mousefollow)clearTimeout(AT.dy);
AT.oktomove=true;
AT.ishover=true;
if(AT.ns4)text='<div class="navtext">'+((centertext)?'<center>':'')+text+((centertext)?'</center>':'')+'</div>';
if(AT.w3c||AT.ie4)AT.navtxt.style.textAlign=(centertext)?"center":"left";
writeindiv(text);
if(AT.ns4)AT.navtxt.visibility="show";
else{
AT.navtxt.style.visibility="visible";
AT.navtxt.style.display="block";
}
getboxheight();
if((AT.w3c||AT.ie4) && dofade){
if(AT.ie4||AT.ie5)AT.navtxt.style.filter="alpha(opacity=0)";
if(AT.ns6)AT.navtxt.style.MozOpacity=0;
AT.ieop=0;
AT.op_id=setInterval('incropacity()',50);
}}else{
if(mousefollow)hideAlttxt();
else AT.dy=setTimeout('hideAlttxt()',hideDelay);
}}

function hideAlttxt(){
if(AT.ns4)AT.navtxt.visibility="hide";
else{
AT.navtxt.style.display="none";
AT.navtxt.style.visibility="hidden";
}
movenavtxt(-AT.boxwidth-10,0);
writeindiv('');
}

function incropacity(){
if(AT.ieop<=100){
AT.ieop+=7;
if(AT.ie4||AT.ie5)AT.navtxt.style.filter="alpha(opacity="+AT.ieop+")";
if(AT.ns6)AT.navtxt.style.MozOpacity=AT.ieop/100;
}else clearInterval(AT.op_id);
}

function moveobj(evt){
mx=(AT.ie5||AT.ie4)?event.clientX:evt.pageX;
my=(AT.ie5||AT.ie4)?event.clientY:evt.pageY;
if(AT.ishover && AT.oktomove){
margin=(AT.ie4||AT.ie5)?5:25;
if(AT.ns6)if(document.height+27-window.innerHeight<0)margin=15;
if(AT.ns4)if(document.height-window.innerHeight<0)margin=10;
if(AT.ns4||AT.ns6)mx-=getpagescrollx();
if(AT.ns4)my-=getpagescrolly();
xoff=mx+xoffset;
yoff=(my+AT.boxheight+yoffset-((AT.ns6)?getpagescrolly():0)>=AT.w_y)? -5-AT.boxheight-yoffset: yoffset;
movenavtxt( Math.min(AT.w_x-AT.boxwidth-margin , Math.max(2,xoff))+getpagescrollx(), my+yoff+((!AT.ns6)?getpagescrolly():0));
if(!mousefollow)AT.oktomove=false;
}}


window.onload=function(){
  AT.navtxt=(AT.ns4)?document.layers['navtxt']:(AT.ie4)?document.all['navtxt']:(AT.w3c)?document.getElementById('navtxt'):null;
  getboxwidth();
  getboxheight();
  getwindowdims();
  if(AT.ie4||AT.ie5&&dofade)AT.navtxt.style.filter="alpha(opacity=100)";
  AT.navtxt.onmouseover=function(){
  if(!mousefollow)clearTimeout(AT.dy);
  }
  AT.navtxt.onmouseout=function(){
  if(!mousefollow)AT.dy=setTimeout('hideAlttxt()',hideDelay);
  }
  if(AT.ns4)document.captureEvents(Event.MOUSEMOVE);
  document.onmousemove=moveobj;
  window.onresize=getwindowdims;
}
