/*swaps image by parameters, only activates if images preloaded already
j and r are the states, on or off, i and q are the nav source images names
this also turns back off the current page's nav button when mouse over another one
0 is on, 1 is off
*/
function changeimage(i, j) 
{
	var imgName = 'nav' + i;
	if (!document.layers)
	{
		if (document.images && g_bPreloadFlag) 
		{
			document.images[imgName].src = g_aNav[0][j].src;
		}
	}
}

var g_bPreloadFlag = false;
var g_aNav = new Array();

//takes k from onload event call, this is the number of nav buttons or other image rollovers.
//then it puts each on/off array into the main g_aNav array. aOffOn must be inside the for loop.
function preloadimages( depth ) 
{
	if (document.images) 
	{
		var aOffOn = new Array(1);
		g_aNav[0] = aOffOn;
		g_aNav[0][0] = new Image();
		g_aNav[0][0].src = depth + 'images/envision/ballbar-on.gif';
		g_aNav[0][1] = new Image();
		g_aNav[0][1].src = depth + 'images/envision/ballbar-off.gif';
		g_bPreloadFlag = true; 
	}
}

/********************************************
Write out CSS link to onoff div CSS
********************************************/
function css_override( depth )
{
	if (!document.layers )
	{
		document.write( '<link rel="stylesheet" type="text/css" href="' + depth + 'css/ev_override.css">' );
	}
}
/********************************************
Show hide functions
********************************************/
// fill id value array
a_div_ids = new Array( 'onoff1', 'onoff2', 'onoff3','onoff4', 'onoff5', 'onoff6', 
	'onoff7','onoff8', 'onoff9','onoff10', 'onoff11', 'onoff12', 'onoff13' );

// begin ns4 and ie4 protection
if (!document.layers){

// switch visibility mode to visible, set position to top=0
function showDivs ( page, which_div )
{
	if (document.getElementById){// begin non dom browser protection.
	
	// call hideDivs to erase all open showhide divs
	
	
	if ( document.getElementById( which_div )	)
	{
		if ( page != 'index' )
		{
			hideDivs(which_div);
			document.getElementById( which_div ).style.top = '0px';
		}
		document.getElementById( which_div ).style.visibility = 'visible';
	}

	}// end non dom browser protection
}
function hideDivs( which_div )
{
	if (!document.layers)
	{
		for ( i = 0; i <= a_div_ids.length; i++ )
		{
			if ( document.getElementById( a_div_ids[i] )	)
			{
				document.getElementById( a_div_ids[i] ).style.visibility = 'hidden';
			}
		}
	}
}

}// end ns 4 protection

/***********************************************************
Spam elimination function
-------------------------
scripts all email addresses on site so spiders can't read them unless they
support javascripting

Note: you need to put this code on the web page where you want the email address to appear:
<script type="text/javascript">no_junk('name', 'domain', '', '', '');</script>

just put in the name, that's the part before the @ sign, and the domain, that's the part after it
where it says 'name' and 'domain', replace those with the actual name and domain that is.
**************************************************************/
function no_junk(name, domain, css_class, subject, text) 
{
	if (text)// do this first to avoid putting query string into printname
	{
		printname = text;
	}
	else 
	{
		printname = name + '&#064;' + domain;
	}
	if (subject)
	{
		domain += '?subject=' + subject;
	}
	if (css_class)
	{
		css_class += ' class="' + css_class + '\"';
	}
	
	email = '<a href=\"mailto:' + name + '&#064;' + domain + '\"' + css_class + '\>' + printname + '<\/a>';
	document.write(email);
}


