//styles.js

//

//Configuration info

//The following variables need to be set in the top of each page before this script is included:

var section = ""; // If this is blank then we use the directory to define a section.





//The following two variables need to be set:

var image_path = "/images/navigation/";

var styles_path = "/script_library/";



var sub_section="";

var page="";



//Don't edit below here

function section_name()

{

	var p, pos, dir;

		

	p = window.location.href;

	

	pos = p.indexOf('//');

	p = p.substr(pos+2, p.length - pos - 2)

	

	pos = p.indexOf('/');

	p = p.substr(pos+1, p.length - pos - 1)

	

	pos = p.indexOf('/');

	if (pos == -1)

		{

		dir = 'home';

		}

	else

		{

		dir = p.substr(0, pos);

		}

	

	return dir;

}



function sub_section_name()

{

	var p, pos, dir;

		

	p = window.location.href;

	

	pos = p.indexOf('//');

	p = p.substr(pos+2, p.length - pos - 2)

	

	pos = p.indexOf('/');

	p = p.substr(pos+1, p.length - pos - 1)

	

	pos = p.indexOf('/');

	p = p.substr(pos+1, p.length - pos - 1)



	pos = p.indexOf('/');

	if (pos == -1)

		{

		dir = '';

		}

	else

		{

		dir = p.substr(0, pos);

		}

	

	return dir;

}



function page_name()

{

	var p, pos, page;

		

	p = window.location.href;

	

	pos = p.lastIndexOf('/')

	p = p.substr(pos+1, p.length - pos - 1)



	pos = p.indexOf('.')

	page = p.substr(0, pos) 



	return page;

}





function select_images()

{ 

	var image, imgSel;

	

	image = image_path + "n_" + section + "_n.gif";



	preloadImages(image);

	

	//IE & W3C DOM

	if ((document.all) || (document.getElementById))

		{

		if (!document.all)

			{ 	//handle W3C DOM browsers

			imgSel = document.getElementById(["img_" + section]);					

			}

		else

			{

			imgSel = document.all["img_" + section];

			}

			

		if (imgSel != null)

			{

			imgSel.src= image;

			}

		}

	else //Netscape 4 or below

		{

		eval("document.img_" + section + ".src= '" + image + "'");

		}

		

}



function select_mainnav()

{

	var obj;

	

	//IE & W3C DOM

	if ((document.all) || (document.getElementById))

		{

		if (!document.all)

			{ 	//handle W3C DOM browsers

			obj = document.getElementById(["nav_" + section]);					

			}

		else

			{

			obj = document.all["nav_" + section];

			}

			

		if (obj != null)

			{

			obj.className = "mainnavselected";

			}

		}

}



function select_pagenav()

{

	var obj;

	

	//IE & W3C DOM

	if ((document.all) || (document.getElementById))

		{

		if (!document.all)

			{ 	//handle W3C DOM browsers

			obj = document.getElementById(["pagenav_" + page]);					

			}

		else

			{

			obj = document.all["pagenav_" + page];

			}

			

		if (obj != null)

			{

			obj.className = "mainnavselected";			

			}

		}

}





function select_pagenav2()

{

	var obj;

	

	//IE & W3C DOM

	if ((document.all) || (document.getElementById))

		{

		if (!document.all)

			{ 	//handle W3C DOM browsers

			obj = document.getElementById(["pagenav2_" + page]);					

			}

		else

			{

			obj = document.all["pagenav2_" + page];

			}

			

		if (obj != null)

			{

			obj.className = "lightgreyboldselected";			

			}

		}

}







function select_footer()

{

	var obj;

	

	//IE & W3C DOM

	if ((document.all) || (document.getElementById))

		{

		if (!document.all)

			{ 	//handle W3C DOM browsers

			obj = document.getElementById(["foot_" + section]);					

			}

		else

			{

			obj = document.all["foot_" + section];

			}

			

		if (obj != null)

			{

			obj.className = "navfootselected";

			}

		}

}



function select_arrowImg()

{

		

	var image, imgSel;

	

	image = image_path + "n_arrow.gif";



	preloadImages(image);

	

	//IE & W3C DOM

	if ((document.all) || (document.getElementById)) {

		if (!document.all) { 	//handle W3C DOM browsers

			imgSel = document.getElementById(["imga_" + section]);

		}

		else {

			imgSel = document.all["imga_" + section];

		}

		

		if (imgSel != null) {

			imgSel.src= image;

		}

	}

	else { //Netscape 4 or below

		//eval("document.img_" + section + ".src= '" + image + "'");

	}

}



function select_topnav()

{

	var obj;

	

	//IE & W3C DOM

	if ((document.all) || (document.getElementById))

		{

		if (!document.all)

			{ 	//handle W3C DOM browsers

			obj = document.getElementById(["topnav_" +section]);					

			}

		else

			{

			obj = document.all["topnav_" + section];

			}

			

		if (obj != null)

			{

			obj.className = "topnavselected";

			}

		}

}





function select_subnav()

{

	var obj;



	//IE & W3C DOM

	if ((document.all) || (document.getElementById))

		{

		if (!document.all)

			{ 	//handle W3C DOM browsers

			obj = document.getElementById(["subnav_" + sub_section]);					

			}

		else

			{

			obj = document.all["subnav_" + sub_section];

			}

			

		if (obj != null)

			{

			obj.className = "subnavselected";

			}

		}

}





function select_images2()

{ 

	var image, imgSel;

	

	image = image_path + "sn_" + sub_section + "_n.gif";



	preloadImages(image);

	

	//IE & W3C DOM

	if ((document.all) || (document.getElementById))

		{

		if (!document.all)

			{ 	//handle W3C DOM browsers

			imgSel = document.getElementById(["img2_" + sub_section]);					

			}

		else

			{

			imgSel = document.all["img2_" + sub_section];

			}

			

		if (imgSel != null)

			{

			imgSel.src= image;

			}

		}

	else //Netscape 4 or below

		{

		eval("document.img2_" + sub_section + ".src= '" + image + "'");

		}

		

}



function preloadImages() { 

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function select_thispagenav()

{



	//SetObjectProperty("pagenav_" + page, "src","/images/"+section+"/i_nav_"+section+".gif");



	var obj;

	

	//IE & W3C DOM

	if ((document.all) || (document.getElementById))

	{

		if (!document.all)

		{ 	//handle W3C DOM browsers

			obj = document.getElementById(["pagenav_" + page]);					

		}

		else

		{

			obj = document.all["pagenav_" + page];

		}

			

		if (obj != null)

		{

			//obj.className = "mainnavselected";			

			obj.src="/images/i_bullet_flash.gif";

		}

	}

	

	//IE & W3C DOM

	if ((document.all) || (document.getElementById))

	{

		if (!document.all)

		{ 	//handle W3C DOM browsers

			obj = document.getElementById(["pagenav_row_" + sub_section]);					

		}

		else

		{

			obj = document.all["pagenav_row_" + sub_section];

		}

			

		if (obj != null)

		{

			//obj.className = "mainnavselected";			

			//alert(obj.style.bgcolor);

			obj.bgColor=navColour;

			//alert(obj.style.bgcolor);

		}

	}



}



function SetObjectProperty(objName, propName, propValue)

{

	var obj;

	

	//IE & W3C DOM

	if ((document.all) || (document.getElementById))

	{

		if (!document.all)

		{ 	//handle W3C DOM browsers

			obj = document.getElementById([objName]);

		}

		else

		{

			obj = document.all[objName];

		}

		if (obj != null)

		{

			alert();

			//eval("obj."+propName+" = "+propValue+";");



		}				

	}



}



function set_styles()

{

	//select_images();

	//select_images2();

	select_mainnav();

	//select_topnav();

	select_subnav();

	//select_thispagenav();

	select_footer();

	//select_arrowImg();

	//select_pagenav2();

	}





if (section == "")

	{

	section = section_name();

	}



if (! window.navColour) navColour="#183482";

sub_section = sub_section_name();

page = page_name();



// This function hides all elements on the page with the id



// This function hides all elements on the page with the id



function Hide(id){



	var d = window.document.all;

	for (var i = 0; i < d.length; i++)

	{

		

		if (d[i].id==id)

		{

			d[i].style.display="none";

			d[i].style.visibility="hidden";

		}

	

	}

	//ChangeBGColor();

}



function ChangeBGColor()

{

	if (document.bgColor=="#ffffff") document.bgColor="#000000";

	else document.bgColor="#ffffff";

}

// This function shows all elements on the page with the id

function Show(id){



	//ChangeBGColor();

	var d = window.document.all;

	for (var i = 0; i < d.length; i++)

	{

		if (d[i].id==id)

		{

			d[i].style.display="block";

			d[i].style.visibility="visible";

		}

	

	}

	

}



// This is the code for the Navigation