// browser detection
var ie5	  = ( document.getElementById && document.all ); 
var moz	  = ( document.getElementById &&! document.all );
var opera = ( navigator.userAgent.indexOf( 'Opera' ) != -1 );
if ( opera ) ie5 = false;




function getObject( obj ) {
	var strObj
	if ( document.all ) {
		strObj = document.all.item( obj );
	} else if ( document.getElementById ) {
		strObj = document.getElementById( obj );
	}
	return strObj;
}



// fading menu system
function menuSystem(divID){
navID= divID;
}
var wait, goIn, intRightNow, inUse;

function swapNav( intNavSpan, id ) {
	var maxInt = 2;
	if ( getObject( 'nav' + intNavSpan ).style.display == 'inline' )
		return;
	
	if ( intNavSpan != intRightNow ) {
		// called more than once, cancel last
		if ( typeof wait != 'undefined' ) { clearTimeout( wait ); }
		if ( typeof goIn != 'undefined' ) { clearTimeout( goIn ); }
		intRightNow = intNavSpan;
		inUse = '';
		swapNav( intNavSpan );
		return;
	}
	
	if ( inUse != '' ) {
		wait = setTimeout( 'swapNav( ' + intNavSpan + ' )', 10 );
		return;
	}
	fader( navID, 'out' );
	
	if ( inUse != '' ) {
		wait = setTimeout( 'swapNav( ' + intNavSpan + ' )', 10 );
		return;
	}
	
	for ( var i = 1; i <= maxInt; i++ ) {
		getObject( 'nav' + i ).style.display = 'none';
	}
	getObject( 'nav' + intNavSpan ).style.display = 'inline';
	
	fader( navID, 'in' );
}


//navID= 'navSystem';
function fader( navID, dir ) {

	var fade_index;
	if ( inUse != '' && inUse != dir ) {
		return;
	}
	
	if ( ie5 || moz ) {
		inUse = dir;
		if( ie5 ) {
			fade_index = getObject( navID ).filters.alpha.opacity;
		}
		if( moz ) {
			fade_index = getObject( navID ).style.MozOpacity * 100; 
		}
		
		fade_index  = dir == 'in' ? fade_index + 5 : fade_index - 5;
		index_limit = dir == 'in' ? 100 : 0;

		if( ie5 ) {
			getObject( navID ).filters.alpha.opacity = fade_index;
		}
		if( moz ) {
			getObject( navID ).style.MozOpacity = fade_index / 100; 
		}
		
		goIn = setTimeout( 'fader( \'' + navID + '\', \'' + dir + '\' )', .015);//Set timeout for fade
		if( ( dir == 'in' && fade_index >= index_limit ) || ( dir == 'out' && fade_index <= index_limit ) ) { //reached limit
			clearTimeout( goIn );
			inUse = '';
		}
	}
}

//Common Dreamweaver scripts
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


