/*
All the code below is to be used in projects which require DHTML elements
such as hiding layers, showing layers and even animating layers.

All code developed by Lee Mansfield - ZoneGroup

Version 3

Ammends Are:- Fool proof reloading of pages regardless of content. Works on MAC and PC

Date Ammended:- 2nd May 2001

Browser Compatibility (P.C & MAC)	:- Interner Explorer 4+
							Netscape Navigator 4+
							   Netscape Navigator 6						
*/


/************************* GLOBAL VARIABLE DECLERATIONS *************************/
var layerRef="";
var styleSwitch="";
var isNav, isIE, isNav6;
var mac = (navigator.appVersion.indexOf("Mac")!=-1);
var bIsIE4 = (navigator.appVersion.indexOf("IE 4")  > -1);

/******************************** init() ****************************************/
//This function sets up browser specific access to layers of a page.

function init()
{
	//set which browsers you wish to reload on a window resize event
	resizeIePc = false;
	resizeNsPc = true; //normally always true if using layers on a page build
	resizeNs6Pc = false;
	resizeIeMac = true; //this is to refresh the screen in IE4.x on MAC
	resizeNsMac = true; //normally always true if using layers on a page build
	resizeNs6Mac = false;

	if (navigator.appName == "Netscape"){

		if (parseInt(navigator.appVersion) == 5){
			isNav6 = true
			layerStyleRef="layer.style.";
			layerRef="document.getElementById";
			styleSwitch=".style";
			if (resizeNs6Pc) onresize=function(){}
			else{}
		}
		else{
			layerStyleRef="layer.";
			layerRef="document.layers";
			styleSwitch="";
			isNav = true;
			if (resizeNsPc) initSize();
			else{}
			}
	}
	else{
			layerStyleRef="layer.style.";
			layerRef="document.all";
			styleSwitch=".style";
			isIE = true
			if (resizeIePc) onresize=function(){}
			else{}
	}
	
	size = new initSize;

	//these mouse events are for the reloading functions

	//check for reload on Netscape 4.x PC
	if (resizeNsPc){
		if (isNav) document.captureEvents(Event.MOUSEMOVE | Event.RESIZE)
		if (isNav && !mac){document.onmousemove = patentResizer}
	}
	else{}

	//check for reload on Netscape MAC
	if (resizeNsMac){
		if (isNav) document.captureEvents(Event.MOUSEMOVE | Event.RESIZE)		
		if (isNav && mac) document.onmousemove = macResizer}
	else{}

	//check for reload on Netscape 6 MAC
	if (resizeNs6Mac){
		if (isNav6 && mac) document.onmousemove = macResizer}
	else{}

	//check for reload on I.E MAC
	if (resizeIeMac){
		if (isIE && mac) document.onmousemove = macResizer}
	else{}
}

/********* GLOBAL RELOADING FUNCTIONS *****************/

function initSize()
{
	if(mac)
	{
		if ((isNav)||(isNav6)){
			this.pgWidth = window.outerWidth;
			this.pgHeight = window.outerHeight;}
		else{
			this.pgWidth = document.body.clientWidth;
			this.pgHeight = document.body.clientHeight;	
		}
	}
	else
	{
		if ((isNav)||(isNav6)){
			this.pgWidth = window.innerWidth;
			this.pgHeight = window.innerHeight;}
		else{
			this.pgWidth = document.body.clientWidth;
			this.pgHeight = document.body.clientHeight;}
	}		
}

/*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = */

function patentResizer()
{
	
	if ((isNav)||(isNav6)){
		pgWidth = window.innerWidth; 
		pgHeight = window.innerHeight;}
	else{
		pgWidth = document.body.clientWidth;
		pgHeight = document.body.clientHeight;}	
	
	if(pgWidth!=size.pgWidth || pgHeight!=size.pgHeight)
	{
		location.reload();
		size.pgWidth = pgWidth;
		size.pgHeight = pgHeight;
	}			
	
}

/*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = */

function macResizer()
{
	if ((isNav)||(isNav6)){
		macWidth = window.outerWidth;
		macHeight = window.outerHeight;}
	else{
		macWidth = document.body.clientWidth;
		macHeight = document.body.clientHeight;}

	if(macWidth != size.pgWidth || macHeight != size.pgHeight)
	{
		location.reload();
		size.pgWidth = macWidth;
		size.pgHeight = macHeight
	}
}

/********** HPI LOAD *************/
//use this code to communicate with the window
//which triggered the pop-up

function load(file, target){
	if (target !='')
		target.window.location.href = file;
	else
		window.location.href = file;
}
/********************** ImgOn Function ******************/
//An image swap function to the ON state

function imgOn(imgName){
	
		if(document.images){
			document[imgName].src = eval(imgName + "on.src");}

}
/*********************** ImgOff Function **********************/
//An image swap function to the OFF state

function imgOff(imgName){	
	
		if(document.images){
			document[imgName].src = eval(imgName + "off.src");}

}
/********************** layerImgOn Function ******************/
//An image swap function which in the case of Netscape pentrates
//the initial layer to swap the image within in this case to the
//ON state

function layerImgOn(layerName,imgName){
	
	if (isNav){
		if(document.images)	{
			document[layerName].document[imgName].src = eval(imgName + "on.src");}
	}

	else{
		if(document.images){
			document[imgName].src = eval(imgName + "on.src");}
	}
}
/*********************** layerImgOff Function **********************/
//An image swap function which in the case of Netscape penerates
//the initial layer to swap the image within in this case to the
//OFF state

function layerImgOff(layerName,imgName){	
	
	if (isNav){
		if(document.images)	{
			document[layerName].document[imgName].src = eval(imgName + "off.src");}
	}

	else{
		if(document.images){
			document[imgName].src = eval(imgName + "off.src");}
	}
}
/**************************** show_layers() *************************************/
//This function shows the layer who's name is passed to it.

function show_layers(layerName){
	
	if(isNav6){
		eval(layerRef+'("'+layerName+'")'+styleSwitch+'.visibility="visible"');}
	else{
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');}
}

/**************************** hide_layers() *************************************/
//This function hides the layer who's name is passed to it.

function hide_layers(layerName){
	if(isNav6){
		eval(layerRef+'("'+layerName+'")'+styleSwitch+'.visibility="hidden"');}
	else{
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');}
}

/*************************** isHidden() *****************************************/
//This function returns true if the layer name sent to it is hidden

function isHidden(layerName){
	
	if(isNav6){
		if (eval(layerRef+'("'+layerName+'")'+styleSwitch+'.visibility') == "hidden"){
			return true;
		}
	}
	else{
		if (eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility') == "hidden"){
			return true;
		}
	}
}

/*************************** isVisible() *****************************************/
//This function returns true if the layer name sent to it is visible

function isVisible(layerName){
	
	if(isNav6){
		if (eval(layerRef+'("'+layerName+'")'+styleSwitch+'.visibility') == "visible"){
			return true;
		}
	}
	else{
		if (eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility') == "visible"){
			return true;
		}
	}
}

/**************************** getTop() ******************************************/
//This function gets the top position of the layer name sent to it

function getTop(layerName){
	
	if(isNav6){
		return eval(layerRef+'("'+layerName+'")'+styleSwitch+'.top');
	}
	else{
		return eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top');
	}
}



/**************************** getLeft() ******************************************/
//This function gets the left position of the layer name sent to it

function getLeft(layerName){
	
	if(isNav6){
		return eval(layerRef+'("'+layerName+'")'+styleSwitch+'.left');
	}
	else{
		return eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left');
	}
}



/**************************** setLeft() ******************************************/
//This function sets the layer to a specified left coordinate sent to the function

function setLeft(layerName, left){
	
	if(isNav6){
		return eval(layerRef+'("'+layerName+'")'+styleSwitch+'.left=left');
	}
	else{
		return eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left=left');
	}
}

/**************************** setTop() ******************************************/
//This function sets the layer to a specified top coordinate sent to the function

function setTop(layerName, top){

	if(isNav6){
		return eval(layerRef+'("'+layerName+'")'+styleSwitch+'.top=top');
	}
	else{
		return eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top=top');
	}
}
/**************************** setNestedTop() ******************************************/
//This function sets the nested layer to a specified top coordinate sent to the function

function setNestedTop(parentLayer, childLayer, top){

	if(isNav6){
		return eval(layerRef+'("'+childLayer+'")'+styleSwitch+'.top=top');
	}
	else if (isNav)	{
		return eval(layerRef+'["'+parentLayer+'"]'+'.'+layerRef+'["'+childLayer+'"]'+styleSwitch+'.top=top');
	}
	else{
		return eval(layerRef+'["'+childLayer+'"]'+styleSwitch+'.top=top');
	}
}
/**************************** moveLayerTo() *************************************/
//This function 'moves' a layer to different screen co-ordinates. The layer name
//as well as the co-ordinates are passed to it.

function moveLayerTo(layerName, top, left)
{
	if(isNav6){
		eval(layerRef+'("'+layerName+'")'+styleSwitch+'.top=top');
		eval(layerRef+'("'+layerName+'")'+styleSwitch+'.left=left');}
	
	else{
		eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top=top');
		eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left=left');
	}
}

/**************************** getNestedLayerTop() ******************************************/
//This function gets the top position of the layer name sent to it

function getNestedLayerTop(parentLayerName, childLayerName){
	
	if(isNav6){
		return eval(layerRef+'("'+childLayerName+'")'+styleSwitch+'.top');
	}
	else if(isNav){
		return eval(layerRef+'["'+parentLayerName+'"]'+'.'+layerRef+'["'+childLayerName+'"]'+styleSwitch+'.top');
	}
	else{
		return eval(layerRef+'["'+childLayerName+'"]'+styleSwitch+'.top');
	}
}

/**************************** getNestedLayerLeft() ******************************************/
//This function gets the left position of the layer name sent to it

function getNestedLayerLeft(parentLayerName, childLayerName){
	
	if(isNav6){
		return eval(layerRef+'("'+childLayerName+'")'+styleSwitch+'.left');
	}
	else if(isNav){
		return eval(layerRef+'["'+parentLayerName+'"]'+'.'+layerRef+'["'+childLayerName+'"]'+styleSwitch+'.left');
	}
	else{
		return eval(layerRef+'["'+childLayerName+'"]'+styleSwitch+'.left');
	}
}

/**************************** moveNestedLayerTo() *************************************/
//This function 'moves' a layer which is nested in another to different screen co-ordinates.
//The layer name as well as the co-ordinates are passed to it.

function moveNestedLayerTo(parentLayerName, childLayerName, top, left)
{
	if(isNav6){
		eval(layerRef+'("'+childLayerName+'")'+styleSwitch+'.top=top');
		eval(layerRef+'("'+childLayerName+'")'+styleSwitch+'.left=left');}
	
	else if (isNav){
		eval(layerRef+'["'+parentLayerName+'"]'+'.'+layerRef+'["'+childLayerName+'"]'+styleSwitch+'.top=top');
		eval(layerRef+'["'+parentLayerName+'"]'+'.'+layerRef+'["'+childLayerName+'"]'+styleSwitch+'.left=left');
	}
	else{
		eval(layerRef+'["'+childLayerName+'"]'+styleSwitch+'.top=top');
		eval(layerRef+'["'+childLayerName+'"]'+styleSwitch+'.left=left');
	}
}

/**************************** getInsideWindowWidth() ****************************/
//This function gets the total width of the browser window

function getInsideWindowWidth()
{
	if ((isNav) || (isNav6)){
		return window.innerWidth;}
	else{
		return document.body.clientWidth;}
}

/*************************** getInsideWindowHeight() ****************************/
//This function gets the total height of the browser window

function getInsideWindowHeight()
{
	if ((isNav) || (isNav6)){
		return window.innerHeight;}
	else{
		return document.body.clientHeight;}
}

/**************************** resetDrop() ******************************************/
//This function resets the state of a drop down select box on the HTML page

function resetDrop(layerName, formName){

	if (isNav){
		eval('document.'+layerName+'.'+'document.'+formName+'.select.selectedIndex = 0');
	}
	else{
		eval(layerRef+'["'+formName+'"].select.selectedIndex = 0');
	}
}
/**************************** getNestedLayerHeight(layerName_a, layerName_b) ************/
//This function gets the total height of the layer specified

function getNestedLayerHeight(layerName_a, layerName_b){

	if(document.all){
		var whatHeight = document.all[layerName_b].offsetHeight;
		return whatHeight;
	}else if(document.layers){
		var whatHeight = document.layers[layerName_a].document.layers[layerName_b].clip.height;
		return whatHeight;
	}else if(document.getElementById){
		var whatHeight = document.getElementById(layerName_b).offsetHeight;
		return whatHeight;
	}
} 

/**************************** getLayerHeight(layerName) ************/
//This function gets the total height of the layer specified

function getLayerHeight(layerName){

	if(document.all){
		var whatHeight = document.all[layerName].offsetHeight;
		return whatHeight;
	}else if(document.layers){
		var whatHeight = document.layers[layerName].clip.height;
		return whatHeight;
	}else if(document.getElementById){
		var whatHeight = document.getElementById(layerName).offsetHeight;
		return whatHeight;
	}
} 


/* =================================== DHTML ANIMATION TECHNIQUES =================================  */

//FLICK BOOK METHODS
//Include the following variable declerations in the html document

//var pageCount = 0;
//var hideArrow = 0;
//var contentTotal = 17; //*** ENTER HERE THE TOTAL AMOUNT OF LAYERS IN THE DOCUMENT ***/
//Then in the html document simply put the followng lines of code:-

//<a href="javascript:forward()">Forward</a>
//<a href="javascript:back()">Back</a>

/********************************** showContentForward() *************************/
//This function displays layers one after another by showing the current one and
//hiding the others. When it reaches the final layer it will also hide the link
//which triggers to this function. So place the functions in the html like so:-

function showContentForward()
{
	var contentNum = pageCount + 1;
	
	hideArrow++; //is a counter to tell when have encountered the last layer

	show_layers('content' + contentNum)
	
	if(contentNum > 1){
		show_layers('leftArrow');
	}

	for(i=1 ; i<contentTotal ; i++){
		if (i != contentNum){
			hide_layers('content' + i);
		}
		if (hideArrow == contentTotal-1){
			hide_layers('rightArrow');
		}
	}
}
/********************************** showContentBack() ****************************/
//This function displays layers one after another by showing the current one and
//hiding the others. When it reaches the first layer it will also hide the link
//which triggers to this function

function showContentBack()
{
	var contentNum = pageCount + 1;

	hideArrow--;

	show_layers('content' + contentNum);
	hide_layers('content' + contentTotal);

	if(contentNum < contentTotal){
		show_layers('rightArrow');
	}

	for(i=contentNum+1 ; i<contentTotal ; i--){
		if (i == 0){break;}
		else{
			if (i != contentNum){
					hide_layers('content' + i);}
			if (hideArrow == 0){
					hide_layers('leftArrow');}
		}
	}
}
/*********************************** forward() *********************************/
// This function scrolls through the content layers by using the function 
//showContentForward()

function forward(){
	
	var counter = contentTotal - 1;
	
	if(pageCount != counter){
		pageCount++;
		showContentForward();
	}else{}
}
/*********************************** back() ************************************/
// This function scrolls through the content layers by using the function 
//showContentForward()

function back(){
	if(pageCount !=0){
		pageCount--;
		showContentBack();
	}else{}
}


/*=========================== SCROLLING LAYERS METHODS ========================*/



//Include the following variable declerations on the html page for your scrolling layer

//var scrollUp = true; //animation variable
//var scrollDown = true; //animation variable
//var scrollLeft = true //animation variable
//var scrollRight = true //animation variable
//var speed = 2 //sets the speed of the scrolling
//var stopPos = 0;  //initally set the stopPos variable to zero
//var origSpeed = 2 //set this to the same value above this is used when the friction function is used

/********************************* initScroller(layerName_a, layerName_b) ***************************/
//This function sets up the stopPos variable which is used throughout the scrolling layer functions (also detailed below)
//Basically this function gets the height of the layer and can therefore dynamically set where the layer will stop scrolling.
//This is useful if the content font is larger on different machines and so content won't become missing etc.

function initScroller(layerName_a, layerName_b){

	//for if the scroller is going up
	if(document.all){
		//delay code below fixes another 'bug' in I.E 4 with dynamic actions
		setTimeout('fixIeOverflowBug()', 10);
	}else if(document.layers){
		var whatHeight = document.layers[layerName_a].document.layers[layerName_b].clip.height;
		var temp = (whatHeight*2);
		stopPos = (whatHeight - temp) + 30;
	}else if(document.getElementById){
		var whatHeight = document.getElementById(layerName_b).offsetHeight;
		var temp = (whatHeight*2);
		stopPos = (whatHeight - temp) + 30;
	}

} 

function fixIeOverflowBug(){
	
	var isIE4 = navigator.appVersion.indexOf("MSIE 4.0")  > -1;
	var whatHeight = document.all['copyChild'].offsetHeight;
	var temp = (whatHeight*2);
	stopPos = (whatHeight - temp) + 30;

	//the code below fixes a 'bug' when using overflow in I.E 4 on PC

	if ((isNav) || (isNav6)){
		//do nothing
	}
	else if ((!isIE4) && (navigator.platform == 'Win32')){
			document.all['copyParent'].style.overflow = 'hidden';
	}

}

/*********************************** scroll_UD(layerName, where, leftPos, startPos, stopPos) ********************************/
//This function is the main scrolling function. It has passed to it the direction in which
//to scroll the layer. As well as what layer to scroll with its name passed to it also.
//Also passed are the coordinates of the left position of the layer, the start position (the top number of the layer) and
//the stop position of the layer. In this case Up or Down
//6/8/2001 JUST REMOVED THE VARIABLE stopPos FROM THE REQUIRED VARIABLE LIST

function scrollUD(layerName, where, leftPos, startPos){

	if (where == 'up'){
		scrollUp = true;
		animateUp(layerName, leftPos, stopPos);
	}
	else if (where == 'down'){
		scrollDown = true;
		animateDown(layerName, leftPos, stopPos);
	}
}

/*********************************** animateUp(layerName, leftPos, stopPos) **********************************/
//This function scrolls the layer upwards on the page by simply incrementing the 
//top coordinate variable.
//6/8/2001 JUST REMOVED THE VARIABLE stopPos FROM THE REQUIRED VARIABLE LIST

function animateUp(layerName, leftPos){
	
	var top = parseInt(getTop(layerName))

	if ((scrollUp == true) && (top > stopPos)){
		top = top - speed;
		moveLayerTo(layerName, top, leftPos);
		newLayerName = layerName;
		newLeftPos = leftPos;
//		newStopPos = stopPos;
		timerID=setTimeout('animateUp(newLayerName, newLeftPos)',10);
	}
}
/*********************************** animateDown(layerName, leftPos, startPos) ********************************/
//This function scrolls the layer downwards on the page by simply decrementing the 
//top coordinate variable
//6/8/2001 JUST REMOVED THE VARIABLE stopPos FROM THE REQUIRED VARIABLE LIST

function animateDown(layerName, leftPos){
	
	var top = parseInt(getTop(layerName))

	if ((scrollDown == true) && (top < stopPos)){
		top = top + speed;
		moveLayerTo(layerName, top, leftPos);
		newLayerName = layerName;
		newLeftPos = leftPos;
//		newStopPos = stopPos;
		timerID=setTimeout('animateDown(newLayerName, newLeftPos)',10);
	}
}

/*********************************** scroll_LR(layerName, where, leftPos, startPos, stopPos) ********************************/

//TO DETERMINCE WHETHER YOU WANT THE SCROLL TO GO FROM RIGHT TO LEFT OR FROM LEFT TO RIGHT YOU SIMPLY MAKE SURE
//THAT THE stopPos VARIABLE NUMBER IS GREATER THAN OR LESS THAN THE INITAL left SETTING OF THE SCROLLING LAYER eg:-

//This function is the main scrolling function. It has passed to it the direction in which
//to scroll the layer. As well as what layer to scroll with its name passed to it also.
//Also passed are the coordinates of the left position of the layer, the start position (the top number of the layer) and
//the stop position of the layer. In this case Left or Right

function scrollLR(layerName, where, topPos, startPos, stopPos){

	if (where == 'left'){
		scrollLeft = true;
		animateLeft(layerName, topPos, stopPos);
	}
	else if (where == 'right'){
		scrollRight = true;
		animateRight(layerName, topPos, stopPos);
	}
}

/*********************************** animateLeft(layerName, leftPos, stopPos) **********************************/
//This function scrolls the layer left on the page by simply incrementing the 
//left coordinate variable.

function animateLeft(layerName, topPos, stopPos){
	
	var left = parseInt(getLeft(layerName))

	if ((scrollLeft == true) && (left > stopPos)){
		left = left - speed;
		moveLayerTo(layerName, topPos, left);
		newLayerName = layerName;
		newTopPos = topPos;
		newStopPos = stopPos;
		timerID=setTimeout('animateLeft(newLayerName, newTopPos, newStopPos);',10);
	}
}
/*********************************** animateRight(layerName, leftPos, startPos) ********************************/
//This function scrolls the layer right on the page by simply decrementing the 
//left coordinate variable

function animateRight(layerName, topPos, stopPos){
	
	var left = parseInt(getLeft(layerName))

	if ((scrollRight == true) && (left < stopPos)){
		left = left + speed;
		moveLayerTo(layerName, topPos, left);
		newLayerName = layerName;
		newTopPos = topPos;
		newStopPos = stopPos;
		timerID=setTimeout('animateRight(newLayerName, newTopPos, newStopPos);',10);
	}
}

/*=============================================================================================*/


//What the following functions achieve is scrolling a layer within a layer. This technique does
//away with the need for masking gfx at the top and bottom of the layer to hide
//the forthcoming text. As well as negate the viewing of the scrollbars produced
//in the browser automatically

/*********************************** nestedScroll_UD(layerName, where, leftPos, startPos, stopPos) ********************************/
//This function is the main scrolling function. It has passed to it the direction in which
//to scroll the layer. As well as what layer(s) to scroll with its name passed to it also.
//Also passed are the coordinates of the left position of the layer, the start position (the top number of the layer) and
//the stop position of the layer. In this case Up or Down

function nestedScrollUD(parentLayerName, childLayerName, where, leftPos, startPos){

	if (where == 'up'){
		scrollUp = true;
		nestAnimateUp(parentLayerName, childLayerName, leftPos);
	}
	else if (where == 'down'){
		scrollDown = true;
		nestAnimateDown(parentLayerName, childLayerName, leftPos, startPos);
	}
}

/*********************************** nestAnimateUp(layerName, leftPos, stopPos) **********************************/
//This function scrolls the layer upwards on the page by simply incrementing the 
//top coordinate variable.
//6/8/2001 JUST REMOVED THE VARIABLE stopPos FROM THE REQUIRED VARIABLE LIST

function nestAnimateUp(parentLayerName, childLayerName, leftPos){
	
	var top = parseInt(getNestedLayerTop(parentLayerName, childLayerName))

	if ((scrollUp == true) && (top > stopPos)){
		top = top - speed;
		moveNestedLayerTo(parentLayerName, childLayerName, top, leftPos);
		newParentLayerName = parentLayerName;
		newChildLayerName = childLayerName;
		newLeftPos = leftPos;
//		newStopPos = stopPos;
		timerID=setTimeout('nestAnimateUp(newParentLayerName, newChildLayerName, newLeftPos);',10);
	}
}
/*********************************** nestAnimateDown(layerName, leftPos, startPos) ********************************/
//This function scrolls the layer downwards on the page by simply decrementing the 
//top coordinate variable
//6/8/2001 JUST REMOVED THE VARIABLE stopPos FROM THE REQUIRED VARIABLE LIST

function nestAnimateDown(parentLayerName, childLayerName, leftPos, startPos){
	
	var top = parseInt(getNestedLayerTop(parentLayerName, childLayerName))

	if ((scrollDown == true) && (top < startPos)){
		top = top + speed;
		moveNestedLayerTo(parentLayerName, childLayerName, top, leftPos);
		newParentLayerName = parentLayerName;
		newChildLayerName = childLayerName;
		newLeftPos = leftPos;
		newStartPos = startPos;
		timerID=setTimeout('nestAnimateDown(newParentLayerName, newChildLayerName, newLeftPos, newStartPos);',10);
	}
}

/*********************************** nestedScroll_LR(layerName, where, leftPos, startPos, stopPos) ********************************/

//TO DETERMINCE WHETHER YOU WANT THE SCROLL TO GO FROM RIGHT TO LEFT OR FROM LEFT TO RIGHT YOU SIMPLY MAKE SURE
//THAT THE stopPos VARIABLE NUMBER IS GREATER THAN OR LESS THAN THE INITAL left SETTING OF THE SCROLLING LAYER eg:-

function nestedScrollLR(parentLayerName, childLayerName, where, topPos, startPos, stopPos){

	if (where == 'left'){
		scrollLeft = true;
		nestAnimateLeft(parentLayerName, childLayerName, topPos);
	}
	else if (where == 'right'){
		scrollRight = true;
		nestAnimateRight(parentLayerName, childLayerName, topPos);
	}
}

/*********************************** animateLeft(layerName, leftPos, stopPos) **********************************/
//This function scrolls the layer left on the page by simply incrementing the 
//left coordinate variable.

function nestAnimateLeft(parentLayerName, childLayerName, topPos, stopPos){
	
	var left = parseInt(getNestedLayerLeft(parentLayerName, childLayerName))

	if ((scrollLeft == true) && (left > stopPos)){
		left = left - speed;
		moveNestedLayerTo(parentLayerName, childLayerName, topPos, left);
		newParentLayerName = parentLayerName;
		newChildLayerName = childLayerName;
		newTopPos = topPos;
		newStopPos = stopPos;
		timerID=setTimeout('nestAnimateLeft(newParentLayerName, newChildLayerName, newTopPos, newStopPos);',10);
	}
}
/*********************************** animateRight(layerName, leftPos, startPos) ********************************/
//This function scrolls the layer right on the page by simply decrementing the 
//left coordinate variable

function nestAnimateRight(parentLayerName, childLayerName, topPos, stopPos){
	
	var left = parseInt(getNestedLayerLeft(parentLayerName, childLayerName))

	if ((scrollRight == true) && (left < stopPos)){
		left = left + speed;
		moveNestedLayerTo(parentLayerName, childLayerName, topPos, left);
		newParentLayerName = parentLayerName;
		newChildLayerName = childLayerName;
		newTopPos = topPos;
		newStopPos = stopPos;
		timerID=setTimeout('nestAnimateRight(newParentLayerName, newChildLayerName, newTopPos, newStopPos);',10);
	}
}

/*********************************** stopScroll(where) ****************************/
//This function simply halts the scrolling of the layer

function stopScroll(where){

	if (where == 'up'){
		scrollUp = false;
	}
	else if (where == 'down'){
		scrollDown = false;
	}
	else if (where == 'left'){
		scrollLeft = false;
	}
	else if (where == 'right'){
		scrollRight = false;
	}
}

/*********************************** stopScroll(where) ****************************/
//This function creates the effect of adding friction to the scrolling layer, it doesn't instantly stop
//when you want it to it smoothly comes to a full stop instead

function friction(direction){

	switch(direction){

		case	'up'		:			{	speed--;

											if (speed == 0){
												stopScroll('left');
												speed = origSpeed;
											}
											else{
												dir = 'up'
												timerID=setTimeout('friction(dir)',125);
											}
										break;
										}

		case	'down'	:			{	speed--;

											if (speed == 0){
												stopScroll('down');
												speed = origSpeed;
											}
											else{
												dir = 'down'
												timerID=setTimeout('friction(dir)',125);
											}
										break;
										}

		case 'left'		:		{	speed--;

											if (speed == 0){
												stopScroll('left');
												speed = origSpeed;
											}
											else{
												dir = 'left'
												timerID=setTimeout('friction(dir)',125);
											}
										break;
										}

		case 'right'		:		{	speed--;

											if (speed == 0){
												stopScroll('right');
												speed = origSpeed;
											}
											else{
												dir = 'right';
												timerID=setTimeout('friction(dir)',125);
											}
										break;
										}
	}//switch
}

//IFRAME and LAYER scrolling functions are defined below.

//What these functions achieve is scrolling a layer within a layer. This technique does
//away with the need for masking gfx at the top and bottom of the layer to hide
//the forthcoming text. As well as negate the viewing of the scrollbars produced
//in the browser automatically

//The syntax is:-

//For I.E and Netscape 6 use this (the name of the frame has to be main!):-
//<iframe name="main" style="position:absolute ; top:50 ; left:5" scrolling=no frameborder=0 src="<src doc here>"></iframe>

//For Netscape 4.x use this (the name of the layer has to be main!) Also place the layer right
//at the bottom of the page!:-
//<layer name="main" top=250 left=100 width=250 height=50 src="<src doc here></layer>

/**************************** loadLayer() ******************************************/
//This function will load in a file to a floating frame with the name specified

function loadLayer(layerName, fileName){
	
	if (isNav6){
		eval(layerRef+'("'+layerName+'").src = fileName');
	}
	else{
		eval(layerRef+'["'+layerName+'"].src = fileName');
	}
}

/**************************** getTopFrame(layerName) ******************************************/
//Again a very similar function to the one above but is used when implimentation of an
//iframe is used in the document
//This function gets the top position of the layer name sent to it

function getTopFrame(layerName){
	
	if(isNav6){
		return eval('parent.main.'+layerRef+'("'+layerName+'")'+styleSwitch+'.top');
	}
	else if (isNav){
		return eval('document.main.'+layerRef+'["'+layerName+'"]'+styleSwitch+'.top');
	}
	else{
		return eval('parent.main.'+layerRef+'["'+layerName+'"]'+styleSwitch+'.top');
	}
}

/**************************** moveLayerToInternal(layerName, top, left) *************************************/
//This function is very similar to the one above except that it is used when an iframe
//has the animated layer inside.
//This function 'moves' a layer to different screen co-ordinates. The layer name
//as well as the co-ordinates are passed to it.

function moveLayerInFrame(layerName, top, left)
{
	if(isNav6){
		eval('parent.main.'+layerRef+'("'+layerName+'")'+styleSwitch+'.top=top');
		eval('parent.main.'+layerRef+'("'+layerName+'")'+styleSwitch+'.left=left');}
	
	else if (isNav){
		eval('document.main.'+layerRef+'["'+layerName+'"]'+styleSwitch+'.top=top');
		eval('document.main.'+layerRef+'["'+layerName+'"]'+styleSwitch+'.left=left');
	}
	else{
		eval('parent.main.'+layerRef+'["'+layerName+'"]'+styleSwitch+'.top=top');
		eval('parent.main.'+layerRef+'["'+layerName+'"]'+styleSwitch+'.left=left');
	}
}

/*********************************** scrollFrame(where) ********************************/
//This function is the main scrolling function. It has passed to it the direction in which
//to scroll the layer.

function scrollFrame(where){

	if (where == 'up'){
		scrollUp = true;
		animateUpFrame();
	}
	else if (where == 'down'){
		scrollDown = true;
		animateDownFrame();
	}
}
/*********************************** animateUpFrame() **********************************/
//This function scrolls the layer upwards on the page by simply incrementing the 
//top coordinate variable

function animateUpFrame(){

	var frameTop = parseInt(getTopFrame('copy'))

	if ((scrollUp == true) && (frameTop > stopPos)){
		frameTop = frameTop - speed;
		moveLayerInFrame('copy', frameTop, leftPos);
		setTimeout("animateUpFrame()",1)
	}
}
/*********************************** animateDownFrame() ********************************/
//This function scrolls the layer downwards on the page by simply decrementing the 
//top coordinate variable

function animateDownFrame(){
	
	var top = parseInt(getTopFrame('copy'))

	if ((scrollDown == true) && (top < startPos)){
		top = top + speed;
		moveLayerInFrame('copy', top, leftPos);
		setTimeout("animateDownFrame()",1)
	}
}

/*********************************** clipLayer(width, height) ********************************/
//This function is to clip the size of the level of dispaly for the layer Netscape only

function clipLayer(width, height){
	
	if (isNav){
		document.main.clip.width = width;
		document.main.clip.height = height;
	}
}


/*********************************** TheDuellist mouseover and TV ********************************/

/* The Duellist javascripts */

function WM_toggle(id){
   if (document.all){
     if(document.all[id].style.display == 'none'){
       document.all[id].style.display = '';
     } else {
       document.all[id].style.display = 'none';
     }
  return false;
   } else if (document.getElementById){
     if(document.getElementById(id).style.display == 'none'){
       document.getElementById(id).style.display = 'block';
     } else {
       document.getElementById(id).style.display = 'none';
     }
  return false;
   }
 }

function doExpand(paraNum,arrowNum){
	//expand the paragraph and rotate the arrow; collapse and rotate it back
	if (paraNum.style.display=="none"){paraNum.style.display="";arrowNum.src="images/arrowdn.gif"}
	else{paraNum.style.display="none";arrowNum.src="images/arrowrt.gif"}
}

function MM_swapImgRestore() { //v2.0
  if (document.MM_swapImgData != null)
    for (var i=0; i<(document.MM_swapImgData.length-1); i+=2)
      document.MM_swapImgData[i].src = document.MM_swapImgData[i+1];
}

function MM_preloadImages() { //v2.0
  if (document.images) {
    var imgFiles = MM_preloadImages.arguments;
    if (document.preloadArray==null) document.preloadArray = new Array();
    var i = document.preloadArray.length;
    with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){
      preloadArray[i] = new Image;
      preloadArray[i++].src = imgFiles[j];
  } }
}

function MM_swapImage() { //v2.0
  var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.MM_swapImgData;
  for (i=0; i < (MM_swapImage.arguments.length-2); i+=3) {
    objStr = MM_swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];
    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||
        (objStr.indexOf('document.all[')   ==0 && document.all   ==null))
      objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);
    obj = eval(objStr);
    if (obj != null) {
      swapArray[j++] = obj;
      swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];
      obj.src = MM_swapImage.arguments[i+2];
  } }
  document.MM_swapImgData = swapArray; //used for restore
}