﻿/*

 Written by Bruce Valeriani, July 2009

*/



// the NAV script used in menu_array.js is designed to work with absolute screen values

// this means we have a problem when the browser window gets resized - so we have 

// to keep track of the window size and compare sizes when a resize event occurs

// (we can't just reload automatically because onResize() will get called if 

// scrollbars become enabled - potentially creating an endless loop)

var isFirefox = ( navigator.appName.indexOf( "Netscape" ) >=0 );

var isIE = ( navigator.appName.indexOf( "Microsoft" ) >=0 );



var loadWidth = 0;

var loadHeight = 0;



if ( isFirefox )	

{

	loadWidth = window.innerWidth;

	loadHeight = window.innerHeight;

}

else if ( isIE )	

{

	loadWidth = this.document.documentElement.offsetWidth;

	loadHeight = this.document.documentElement.offsetHeight;

}

/*

alert("isFirefox = " + isFirefox + "\n" + 

	  "isIE = " + isIE  + "\n" + 

	  "loadWidth = " + loadWidth + "\n" + 

	  "loadHeight = " + loadHeight );

*/



function refreshMenu()

{

	if ( isFirefox )

	{

		if ( loadWidth != window.innerWidth || loadHeight != window.innerHeight )

		{

			window.location.replace( location.href );

		}

	}

	else if ( isIE )

	{

		if ( loadWidth != this.document.documentElement.offsetWidth || loadHeight != this.document.documentElement.offsetHeight )

		{

			history.go( 0 );

		}

	}

}


