/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  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 nadd7 = "the sum of n and 7<BR>add n and 7 together<BR><I>Example</I>: 3 + 7 = 10"
var add = "the sum of a and b<BR>add a and b together<BR><I>Example</I>: 1 + 2 = 3"
var xaddyaddz = "the sum of x, y and z<BR>add x, y and z together<BR><I>Example</I>: 1 + 2 + 3 = 6"
var take = "a take away b<BR>a subtract b<BR><I>Example</I>: 6-2 = 4"
var threec = "3 lots of c<BR>3 times c<BR>3 × c or c × 3<BR><I>Example</I>: 3 × 5 = 15"
var fourm = "4 lots of m<BR>4 times m<BR>4 × m<BR><I>Example</I>: 4 × 5 = 20"
var atimesb = "a times b <BR>the product of a and b<BR>a × b<BR><I>Example</I>: 2 × 5 = 10"
var abc = "a times b times c<BR>a × b × c<BR><I>Example</I>: 2 × 5 × 3 = 30"
var adiv3 = "a divided by 3<BR>a ÷ 3<BR>Usually written as <IMG SRC='"+gpath+"adiv3.gif' ALIGN='ABSMIDDLE' WIDTH='20' HEIGHT='51' BORDER='0' ><BR><I>Example</I>: 12/2 = 6"
var cdivd = "c divided by d<BR>c ÷ d<BR>Usually written as <IMG SRC='"+gpath+"cdivd.gif' ALIGN='ABSMIDDLE' WIDTH='20' HEIGHT='51' BORDER='0' ><BR><I>Example</I>: 18/6 = 3"
var nsquared = "n squared<BR>n times n <BR>n × n<BR><I>Example</I>: 4² = 16"
var fivepsquared = "5 times p squared<BR>5 times p times p <BR>5 × p × p<BR><I>Example</I>: 5×3² = 45"
var twotsquared = "2t squared<BR>2t times 2t<BR>2t × 2t<BR><I>Example</I>: (2×3)² = 36"
var mcubed = "m cubed<BR>m to the power 3<BR>m times m times m <BR>m × m × m<BR><I>Example</I>: 2³ = 8"
var t5 = "t to the power 5<BR>t times t times t times t times t<BR>t × t × t × t × t<BR><I>Example</I>: 2<SUP>5</SUP> = 32"
var twoxaddy = "2x add y<BR>The multiplying is done before the adding"
var abaddc = "ab add c<BR>(a × b)+c<BR><I>Example</I>: (2×3)+4 = 10"
var atimesbaddc = "a times (b+c)<BR>a × (b+c)<BR><I>Example</I>: 2×(3+4) = 14"
var commutative = "The property of adding or multiplying that <BR>a + b = b + a and <BR>a × b = b × a"
var constant = "A number or expression whose value is fixed and cannot change."
var equation = "A statement that two mathematical expressions are equal.<BR><I>Example</I>: 2x+6 = 21-x"
var expand = "To multiply out an expression, particularly one that uses brackets.<BR><I>Example</I>: 3(x-2) = 3x-6"
var expression = "A mathematical term using letter symbols, numbers and operations such as +,-,x,÷,() and /"
var evalu = "To find the value of"
var factor = "A number or expression that divides another exactly.<BR><I>Example</I>: 3 is a factor of 12."
var factorise = "To write an expression in terms of its factors.<BR><I>Example</I>: 4x-6=2(x-3)"
var formula = "An equation used to work out the value of one particular variable."
var func = "A mathematical rule that connects one value with another."
var indices = "Powers of numbers<BR><I>Example</I>: a² = a x a"
var inequal = "A statement that one number or expression is smaller or greater than another.<BR><I>Example</I>: 4 < 7"
var inverse = "The inverse of a function reverses the effect of the function.<BR><I>Example</I>: the inverse of doubling is halving"
var identity = "An equation where both sides always take the same value whatever numbers are substituted for letters.<BR><I>Example</I>: x + x = 2x"
var mapping = "A function.<BR><I>Example</I>: x-->3x+1"
var liketerms = "Expressions that are similar.<BR><I>Example</I>: 3x², x² and -4x²"
var nth = "The general term in a sequence<BR><I>Example</I>: the nth term of 1,3,5,7... is 2n-1"
var polynomial = "An expression consisting of powers of one variable.<BR><I>Example</I>: x²+3x+1 or x³-1"
var power = "Numbers or expressions multiplied by themselves.<BR><I>Example</I>: x² is x to the power 2"
var product = "The result of multiplying terms together.<BR><I>Example</I>: the product of 3 and 7 is 21"
var quadratic = "An expression that includes an unknown value squared<BR><I>Example</I>: x² + 3x + 1"
var quadratics = "Expressions that include an unknown value squared<BR><I>Example</I>: x² + 3x + 1"
var variable = "A quantity, usually represented by a letter, that can take any value."
var rule = "A method for connecting one value with another."
var simpleeq = "Equations that can be solved to find an unknown value<BR><I>Example</I>: 3x + 1 = 7"
var simulteq = "Two equations that can be solved together to find two unknown values<BR><I>Example</I>: <BR>3x + y = 7<BR>2x - 4y = 0"
var subst = "To replace a letter with its value."
var symbol = "A letter or other drawn shape used to stand for a number."
var symbols = "Letters or other drawn shapes used to stand for numbers."
var simuleq = "Two equations in two unknowns that can be solved to find the unknown values<BR><I>Example</I> <BR>  3x + y = 7 <BR>  x - y = 1"
var sequences = "Lists of numbers that obey a simple rule."
var simplify = "To write in a simpler way, often using smaller numbers.<BR><I>Example</I>: 2b+1+3b = 5b+1"
var assessments = "Printable pages of questions, with answers, that can be changed to produce a new assessment by a click of a button!"


////////////////////////////// NO NEED TO EDIT BEYOND THIS POINT //////////////////////////////////////

var NS4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
var IE4 = (document.all && !document.getElementById)? true : false;
var IE5 = (document.getElementById && document.all)? true : false;
var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var W3C = (document.getElementById)? true : false;
var w_y, w_x, navtxt, boxheight, boxwidth;
var ishover=false;
var isloaded=false;
var ieop=0;
var op_id=0;

function getwindowdims(){
w_y=(NS4||NS6)? window.innerHeight : (IE5||IE4)? document.body.clientHeight : 0;
w_x=(NS4||NS6)? window.innerWidth : (IE5||IE4)? document.body.clientWidth : 0;
}

function getboxwidth(){
if(NS4)boxwidth=(navtxt.document.width)? navtxt.document.width : navtxt.clip.width;
if(IE5||IE4)boxwidth=(navtxt.style.pixelWidth)? navtxt.style.pixelWidth : navtxt.offsetWidth;
if(NS6)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;
if(IE4||IE5)boxheight=(navtxt.style.pixelHeight)? navtxt.style.pixelHeight : navtxt.offsetHeight;
if(NS6)boxheight=parseInt(navtxt.offsetHeight);
}

function movenavtxt(x,y){
if(NS4)navtxt.moveTo(x,y);
if(W3C||IE4){
navtxt.style.left=x+'px';
navtxt.style.top=y+'px';
}}

function getpagescrolly(){
if(NS4||NS6)return window.pageYOffset;
if(IE5||IE4)return document.body.scrollTop;
}

function getpagescrollx(){
if(NS4||NS6)return window.pageXOffset;
if(IE5||IE4)return document.body.scrollLeft;
}

function writeindiv(text){
if(NS4){
navtxt.document.open();
navtxt.document.write(text);
navtxt.document.close();
}
if(W3C||IE4)navtxt.innerHTML=text;
}

//**** END UTILITY FUNCTIONS ****//

function writetxt(text){
if(isloaded){
if(text!=0){
ishover=true;
if(NS4)text='<div class="navtext">'+((centertext)?'<center>':'')+text+((centertext)?'</center>':'')+'</div>';
writeindiv(text);
getboxheight();
if((W3C || IE4) && dofade){
ieop=0;
incropacity();
}}else{
if(NS4)navtxt.visibility="hide";
if(IE4||W3C){
if(dofade)clearTimeout(op_id);
navtxt.style.visibility="hidden";
}
writeindiv('');
ishover=false;
}}}

function incropacity(){
if(ieop<=100){
ieop+=7;
if(IE4 || IE5)navtxt.style.filter="alpha(opacity="+ieop+")";
if(NS6)navtxt.style.MozOpacity=ieop/100;
op_id=setTimeout('incropacity()', 5);
}}

function moveobj(evt){
if(isloaded && ishover){
margin=(IE4||IE5)? 1 : 23;
if(NS6)if(document.height+27-window.innerHeight<0)margin=15;
if(NS4)if(document.height-window.innerHeight<0)margin=10;
//mx=(NS4||NS6)? evt.pageX : (IE5||IE4)? event.clientX : 0;
//my=(NS4||NS6)? evt.pageY : (IE5||IE4)? event.clientY : 0;
if (NS4){
mx=evt.pageX
my=evt.pageY
}
else if (NS6){
mx=evt.clientX
my=evt.clientY
}
else if (IE5){
mx=event.clientX
my=event.clientY
}
else if (IE4){
mx=0
my=0
}

if(NS4){
mx-=getpagescrollx();
my-=getpagescrolly();
}
xoff=(center)? mx-boxwidth/2 : mx+5;
yoff=(my+boxheight+30-getpagescrolly()+margin>=w_y)? -15-boxheight: 30;
movenavtxt( Math.min(w_x-boxwidth-margin , Math.max(2,xoff))+getpagescrollx() , my+yoff+getpagescrolly());
if(NS4)navtxt.visibility="show";
if(W3C||IE4)navtxt.style.visibility="visible";
}}

if(NS4)document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=moveobj;
window.onload=function(){
  navtxt=(NS4)? document.layers['navtxt'] : (IE4)? document.all['navtxt'] : (W3C)? document.getElementById('navtxt') : null;
  getboxwidth();
  getboxheight();
  getwindowdims();
  isloaded=true;
  if((W3C || IE4) && centertext)navtxt.style.textAlign="center";
  if(W3C)navtxt.style.padding='4px';
  if(IE4 || IE5 && dofade)navtxt.style.filter="alpha(opacity=0)";
  }
window.onresize=getwindowdims;


