
//Make new text window -- This function loads external links in new browser windows. The new window is 70% of the height and 85% of the width of the current window and should be centered. If the current window is not maximized or otherwise small, the new window will be even smaller.  Function checkWindowSize() gets dimensions of current window.

var newTextWindow
function makeNewTextWindow(url,wid,hgt){
	checkWindowSize();
	if (screen.availHeight){
	hgt = screen.availHeight * .7;
	wid = screen.availWidth * .85;
	}
	var right = screen.availWidth * .075;
	var down = screen.availHeight * .05;
	
	if (myWidth < wid){wid = myWidth * .8}
	if (myHeight < hgt){hgt = myHeight * .8}
	
	var parameters = "status,menubar,location,resizable,titlebar,toolbar,height=" + hgt + ",width=" + wid + ",left=" + right + ",top=" + down + ",scrollbars";
	if(!newTextWindow || newTextWindow.closed){
	newTextWindow = window.open(url,"",parameters)
	if (!newTextWindow.opener) {
	newTextWindow.opener = window;
	}
	} else {
	newTextWindow.location = url;
	newTextWindow.focus()
	}
}

var myWidth = 0, myHeight = 0;  // These will be current window's dimensions

//  This funcion gets the width and height of the current window. This information is then used so that the new window will not cover the current one.

function checkWindowSize() {
  //var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );
}

// End function to get size of current window
