/*******************************************************************************

*   FILENAME    : inc_functions.js                                             *

*   DESCRIPTION : Contains functions used by LOB's left navigation.            *

*   MODIFIED    : 09/10/2001                                                   *

*										                   *

*******************************************************************************/





var navHeight         = 20;

var navWidth          = 200;

var navColor          = "#CCCCCC";

var subnavColor       = "#CCCCCC";

var subnavOnColor     = "#CCCCCC"; //To turn off hovering color change, set this variable the same as subnavColor;

var borderColor       = "#999999";

var navSepColor       = "#999999";

var subnavSepColor    = "#FFFFFF";

var subnavBorderColor = "#000000";

var homenavColor      = "#666666"; // "Home" & "About us" nav color;

var aboutnavColor     = "#666666";

var titlenavColor     = "#CCCCCC";

var textLinkColor     = "red";

var background        = "/bigbruno/ImageDir/stripe01.gif";



/********* Netscape variables *******/

var Xpos = -2;

var Ypos = -7;



var ie4only	 = (navigator.userAgent.indexOf('MSIE 5') != -1)? true:false;

var mac = (navigator.userAgent.indexOf('Mac') != -1)? true:false;

var win = (navigator.userAgent.indexOf('Win') != -1)? true:false;



/**********************************************

    These fucntions take in the levelOne and

    levelTwo_# string variables and return the

    titles and links separately.

**********************************************/



function setArrays(id) {

    return levelArray = id.split("|");

}



function findTitle(id){

    return title = id.indexOf('(');

}



function findUrl(id){

    return url = id.lastIndexOf(')');

}



/**********************************************

    Utility functions.

**********************************************/



function findLayer(id) {

    if (ns4) return eval('document.layers["'+id+'"]');

    if (ie4up) return eval('document.all["'+id+'"]');

    if (ns6up) return eval('document.getElementById("'+id+'")');

    return null;

}



function changeVisible(id,viz) {

		if (ns4	&& findLayer(id))

			findLayer(id).visibility = (viz) ? 'show' :	'hide';

		if ((ie4up || ns6up) &&	findLayer(id))

			findLayer(id).style.visibility = (viz) ? 'visible' : 'hidden';  

}





function navsOff(id1,id2){;

    if ((id1 != "none") && (id1 != "aboutNav")) findLayer(id1).style.backgroundColor = subnavColor;

    if (id1 != "none") findLayer(id1).style.color = "#000000";

}





var oldID1 = "none";

var oldID2 = "none";



function navsOn(newID1,color,isLinked,newID2){

    if (ns4){ var style = ""; }

    else if (ie4up){ var style = ".style"; }

    navsOff(oldID1,oldID2);

    if (newID1 != "aboutNav"){ findLayer(newID1).style.backgroundColor = color; }

    if (isLinked){ findLayer(newID1).style.color = textLinkColor; }

    if (isLinked && newID2 != "none"){ findLayer(newID2).style.color = textLinkColor; }

    oldID1 = newID1; oldID2 = newID2;

}



//******** for Netscape use only ***************



oldLayer = "none"



function layerOn(newLayer){

    if (oldLayer != "none"){

		changeVisible(newLayer,1);

		changeVisible(oldLayer,0);  

    } else {

		changeVisible(newLayer,1);

    }

    oldLayer = newLayer;

}



//**********************************************

var oldNav = "none";

var oldID = "none";

var isNav = 0;



function switchMenu(newNav,newID){

    isNav = 1;

    navsOff (oldID1);

    if (oldNav != "none") { 

		changeVisible(oldNav,0);

		changeVisible(oldID,0);

		changeVisible(newNav,1);

		if (newID != "none") changeVisible(newID,1);

    } else {

		changeVisible(newNav,1);

		if (newID != "none") changeVisible(newID,1);

    }

    changeVisible('menuClose1',1);

    changeVisible('menuClose2',1);

    changeVisible('menuClose3',1);

    changeVisible(oldLayer,0);

    oldNav = newNav; oldID = newID;

}



function hideAll(id){

    if (isNav){

		if (hasTitleNav) {

			var	length = (navArray.length - 1);

		} else { length	= navArray.length; }

		for	(var i=0; i<(setArrays(levelOne).length+length) ; i++){

			changeVisible(eval("'levelTwo'+i"),0);

			changeVisible(eval("'nav'+i"),0);

			if (ns4) changeVisible(eval("'layer'+i"),0);

		} 

		changeVisible('menuHome',0);

		if ((id=='menuClose1')||(id=='menuClose2')||(id=='menuClose3')||(id=='menuClose4')){

			changeVisible('menuClose1',0);

			changeVisible('menuClose2',0);

			changeVisible('menuClose3',0);

	    }

    } isNav = 0;

}



/**********************************************

    Accessibility (by tabbing) functions.

**********************************************/



function gotoLink(someUrl){

    if (someUrl != "") window.location.href = eval('"'+someUrl+'"'); 

}



function changeFocus(id){

    if (!ie4only){

		eval('document.all.'+id+'.focus()');

    }

}



/**********************************************

    This function is used when tabbing 

    through left nav to pop up submenu 

    and to go to link.

**********************************************/



function checkKey(i){

    var num = parseInt(i.valueOf());

    if ((num > 0) || (num < 100)){ 

		var	id1 = eval("'nav'+i");

		var	id2 = eval("'levelTwo'+i");

		var	id3 = eval("'link'+i");

		switchMenu(id1,id2); 

		changeFocus(id3);

    } else if ((window.event.keyCode == 13) && (i != "")){

		gotoLink(i);

    }

}



//Shifts focus away from the submenus and back to elements that don't have the tabIndex specified.

function returnFocus(){

    if(hasSearchNav){

		document.all.searchBox.focus();

    } else {

		document.all.refObj.focus();

    }

}



//Takes away focus from nav table elements when mouses over.

var lastVisitedLink = 'none';

function updateLink(id){

    lastVisitedLink = id;

}



function loseFocus(){

    if(lastVisitedLink != 'none') eval('document.all.'+lastVisitedLink+'.blur()');

}





////////////////

// Rotating Banner

////////////////





var slideImages = new Array(); var i = 0; 

slideImages[i] = '/bigbruno/ImageDir/ispmark_04.gif'; i++;

slideImages[i] = '/bigbruno/ImageDir/ispmark_05.gif'; i++;

slideImages[i] = '/bigbruno/ImageDir/ispmark_06.gif'; i++;

slideImages[i] = '/bigbruno/ImageDir/ispmark_07.gif'; i++;





var slideInc = 5000;

var slideCurr = Math.round((slideImages.length-1) * Math.random());



function slideShow() {

//	if (document.images) {

		document.images['slideshow'].src = slideImages[slideCurr];

		if (slideCurr < slideImages.length-1) slideCurr++;

		else slideCurr = 0;

		setTimeout('slideShow()',slideInc);

//	}

}





//////////////

// Browser Detect

//////////////



var ie4up = (document.all)? true : false;

var ns4   = (document.layers)? true : false;

var ns6up = (document.getElementById)? false : false;

if (ie4up) {ns6up = false; ns4=false;}

if (!ie4up && !ns4) location.href = 'http://www.bigbruno.com/bigbruno/netindex.asp';





//////////////

// Visibility

//////////////



function switchVisible(id,viz) {

    if (ns4 && getLayer(id))

        getLayer(id).visibility = (viz) ? 'show' : 'hide';

    if ((ie4up || ns6up) && getLayer(id))

        getLayer(id).style.visibility = (viz) ? 'visible' : 'hidden';}



function getLayer(id) {

    if (ns4) return eval('document.layers["'+id+'"]');

    if (ie4up) return eval('document.all["'+id+'"]');

    if (ns6up) return eval('document.getElementById("'+id+'")');

    return null;}







function netscapeCssFix()

{if (document.FT.netscapeCssFix.initWindowWidth != window.innerWidth || document.FT.netscapeCssFix.initWindowHeight != window.innerHeight) {document.location = document.location;

  }

}



function netscapeCssFixCheckIn()

{

  if (ns4 == true) {

    if (typeof document.FT == 'undefined'){

      document.FT = new Object;

    }

    if (typeof document.FT.FT_scaleFont == 'undefined') {

      document.FT.netscapeCssFix = new Object;

      document.FT.netscapeCssFix.initWindowWidth = window.innerWidth;

      document.FT.netscapeCssFix.initWindowHeight = window.innerHeight;

    }

    window.onresize = netscapeCssFix;

  }

}



netscapeCssFixCheckIn();


