function BrowserInfo() {
// browser checking by Charles Farrier
  var agent = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);
  this.ns = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
  this.ns2 = (this.ns && (this.major == 2));
  this.ns3 = (this.ns && (this.major == 3));
  this.ns4b = (this.ns && (this.minor < 4.04));
  this.ns4 = (this.ns && (this.major >= 4));
  this.ns5 = (this.ns && (this.major >= 5));
  this.ie = (agent.indexOf("msie") != -1);
  this.ie3 = (this.ie && (this.major == 3));
  this.ie4 = (document.all);
  this.ie5 = ( (document.all) && (window.print) );
  this.dom1 = (document.getElementById);
  this.op3 = (agent.indexOf("opera") != -1);
  this.win = (agent.indexOf("win")!=-1);
  this.mac = (agent.indexOf("mac")!=-1);
  this.unix = (agent.indexOf("x11")!=-1);
  this.macie4 = (this.mac && this.ie4 && !this.ie5);  
}

var is = new BrowserInfo();//browser info loaded into is

// taks a layer id and recursively steps through Nav4's
// layer heirarchy.  Returns the layer with the specified id.
function getNav4Layer(layerId, parent) {
    var objLayer;
    var parentObj = (parent)? parent : document;
    for (var i=0; i<parentObj.layers.length && !objLayer; i++) {
        if(parentObj.layers[i].id == layerId) {
            objLayer = parentObj.layers[i];
        }
        else {
            objLayer = getNav4Layer(layerId, parentObj.layers[i]);
        }
    }
    return objLayer;
}
// object constructor for CSSObject.
function CSSObject(obj)  {
    if (is.dom1)  {
        this.name = obj;
        this.elem = document.getElementById(obj);
        this.css = this.elem.style;
    }
    else if(is.ns4)  {
        this.name = obj;
        this.elem = getNav4Layer(obj, 0);
        this.css = this.elem;
    }
    else if(is.ie4)  {
        this.name = obj;
        this.elem = document.all[obj];
        this.css = this.elem.style;
    }
}
// ----------- defines the moveBy method of CSSObject-----------------------
function moveByNav(x, y) {
    this.css.left = parseInt(this.css.left) + x;
    this.css.top = parseInt(this.css.top) + y;
}
function moveByIE(x, y) {
    this.css.pixelLeft += x;    
	this.css.pixelTop += y;
}
if (is.ns4 || is.ns5)       CSSObject.prototype.moveBy = moveByNav
else if (is.ie4 || is.ie5)    CSSObject.prototype.moveBy = moveByIE;
// ----------- defines the getX and getY methods --------------------------
function getX(){
	return this.css.left;
}
function getY(){
		return this.css.top;
}
CSSObject.prototype.getX = getX;
CSSObject.prototype.getY = getY;
//------------ defines show and hide methods -------------------------------
function show(){
	this.css.visibility = 'visible';
}
function hide(){
	this.css.visibility = 'hidden';
}
CSSObject.prototype.show = show;
CSSObject.prototype.hide = hide;
// ----------- defines the moveTo method of CSSObject-----------------------
function moveToNav(x, y) {
    this.css.left = x;
    this.css.top = y;
}
function moveToIE(x, y) {
    this.css.pixelLeft = x;
    this.css.pixelTop = y;
}
if (is.ns4 || is.ns5)       CSSObject.prototype.moveTo = moveToNav
else if (is.ie4 || is.ie5)    CSSObject.prototype.moveTo = moveToIE;
// ----------- defines the write method of CSSObject-----------------------
// What follows only works with IE4 on Win (for css objects defined with<div>
// and not <span>), IE5 on both Win and Mac, Nav4, and Nav5.
function HTMLWriteNav4(html) {
    this.css.document.open();
    this.css.document.write(html);
    this.css.document.close();
}
function HTMLWriteIE5(html) {
    this.elem.innerHTML = html;
}
function HTMLWriteNav5(html) {
    var rng = document.createRange();
    rng.selectNodeContents(this.elem);
    rng.deleteContents();
    var htmlFrag = rng.createContextualFragment(html);
    this.elem.appendChild(htmlFrag);
}
if (is.ns5)    CSSObject.prototype.write = HTMLWriteNav5
else if (is.ns4) CSSObject.prototype.write = HTMLWriteNav4
else if (is.ie5 || (is.ie4 && is.win))CSSObject.prototype.write = HTMLWriteIE5;					
//---------------------------------------------------------------

//returns x co-ord which is percent % of availableWidth
function percentX(percent)
{
	return Math.round(availableWidth*percent/100);
}

//returns y co-ord which is percent % of availableHeight
function percentY(percent)
{
	return Math.round(parseInt(availableHeight)*parseInt(percent)/100);
}

//place an object at just off Left
function placeItJustOffLeft(obj,width,y)
{
	//set at -width*2 so meet in middle
	obj.moveTo(-(width*2),y)
}					

//place an object at just off Right
function placeItJustOffRight(obj,width,y)
{
	obj.moveTo(availableWidth+width,y)
}					

//------------------ bikini code -------
var unit;
var menus = new Array( new Object(), new Object(), new Object(), new Object());
var posDivs = new Array( new Object(), new Object(), new Object(), new Object());
var gutterDivs = new Array( new Object(), new Object(), new Object(), new Object());

var colOneMenus = new Object();
var colOnePosDivs = new Object();
var colOneGutterDivs = new Object();
var colOneStates = new Object();
var heights = new Object();
var loadDiv = null;
function setupMenu(num,cols)
{	
		loadDiv = new CSSObject('loadDiv');
		loadDiv.hide();
		for (var x=0;x<num;x++)
		{
			eval("menus[0]['drop" + x + "'] = new CSSObject('drop" + x + "')");				
			eval("menus[0]['drop" + x + "'].show()");
			eval("posDivs[0]['pos" + x + "'] = new CSSObject('pos" + x + "')");				
			eval("posDivs[0]['pos" + x + "'].show()");
			//eval("gutterDivs[0]['gutter" + x + "'] = new CSSObject('gutter" + x + "')");				
			//eval("gutterDivs[0]['gutter" + x + "'].show()");
		}
		menus[1]['drop100'] = new CSSObject('drop100');
		menus[1]['drop100'].show();
		posDivs[1]['pos100'] = new CSSObject('pos100');
		posDivs[1]['pos100'].show();
		//gutterDivs[1]['gutter100'] = new CSSObject('gutter100');
		//gutterDivs[1]['gutter100'].show();
		
		menus[2]['drop202'] = new CSSObject('drop202');
		menus[2]['drop202'].show();
		posDivs[2]['pos200'] = new CSSObject('pos200');
		posDivs[2]['pos200'].show();
		posDivs[2]['pos202'] = new CSSObject('pos202');
		posDivs[2]['pos202'].show();
		
}
function conditionalToggleMenu(menu,col,trueFalse)
{									
	if(!trueFalse && menus[col][menu].css.visibility == 'hidden')				
		openMenu(menu,col);
	if(trueFalse && menus[col][menu].css.visibility != 'hidden')				
		closeMenu(menu,col);
}
function toggleMenu(menu,col)
{									
	if(menus[col][menu].css.visibility == 'hidden')				
		openMenu(menu,col);
	else				
		closeMenu(menu,col);
}
function openMenu(menu,col)
{
	if(menus[col][menu].css.visibility == 'hidden')				
	{
		menus[col][menu].show();	
		var menuNum = parseInt(new String(menu).split("drop")[1])
		for (var m in menus[col])
		{					
			var num = parseInt(new String(m).split("drop")[1])
			if (num > menuNum)
			{
				posDivs[col]["pos" + (num)].moveBy(0, ( (heights["drop" + (menuNum)] * unit) + (unit/2) ) );
				menus[col]["drop" + (num)].moveBy(0, ( (heights["drop" + (menuNum)] * unit)  + (unit/2)) );
			}
			if (num >= menuNum)				
				;//gutterDivs[col]["gutter" + (num)].moveBy(0,(heights["drop" + (menuNum)] * unit));						
		}					
	}
}
function closeMenu(menu,col)
{
	if(menus[col][menu].css.visibility != 'hidden')
	{
		menus[col][menu].hide();
		var menuNum = parseInt(new String(menu).split("drop")[1])
		for (var m in menus[col])
		{					
			var num = parseInt(new String(m).split("drop")[1])	
			if (num > menuNum)
			{
				posDivs[col]["pos" + (num)].moveBy(0,-( (heights["drop" + (menuNum)] * unit) + (unit/2)) );
				menus[col]["drop" + (num)].moveBy(0,- ( (heights["drop" + (menuNum)] * unit) + (unit/2)) );
			}
			if (num >= menuNum)					
				;//gutterDivs[col]["gutter" + (num)].moveBy(0,-(heights["drop" + (menuNum)] * unit));
		}		
	}
}
function closeAll(col)
{
	for (var menu in menus[col])
		closeMenu(menu,col);
}
function allContacts(menu,ticked)
{
	if(ticked)
		menus[2][menu].hide();
	else
		menus[2][menu].show();
}
function useType(choice,check1,check2,check3)
{
	var checks = new Array(check1, check2, check3)
	if (choice.checked)
	for (var c=0;c<checks.length;c++)
	{
		if (checks[c] != choice)
			checks[c].checked = false;
	}
}
var loadString = "";

//alert (ie4);alert(ns5);
if (!is.ie4 && !is.ns5)
	window.location.href = 'select.asp';

var catDivs = new Object();	
function hideAllCats(){
	for(var cat in catDivs)
		catDivs[cat].hide();
}
function showCat(id){
	if (typeof catDivs[id]!="undefined"){ 
		hideAllCats();
		catDivs[id].show();
	}
}
function hideCat(id){
	if (typeof catDivs[id]!="undefined")
		catDivs[id].hide();
}
function hideAllSectors(){
	for (var m in menus[0])
		menus[0][m].hide();
	for (var p in posDivs[0])
		posDivs[0][p].hide();
}