/*
  Copyright 2001 - Active Matter, Inc.
  ISSUES:
  NN 3.04 - Javascript browser name doesn't show up, neither does screen res
  IE 4.0  - New window scripts get error, then open 2 windows, one for the link, one for the JS
  NN 6.01 - screen size 'undefined'
*/

// This script makes the SfN site the parent of the window if it has been framed - fixes a problem with the login and frames
if (parent != self)
    top.location.href = location.href;

// PopupWindowLarge: Opens new window (600 x 400) with no navigation controls or menus, then focuses user on the new window.
// Parameters: Takes the url of the window to open
function PopupWindowLarge(url) {
  var previewWin = window.open(url,'PreviewWindow','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=600,height=400');
  previewWin.focus();
  return false;
}

// PopupWindowSmall: Opens new window (250 x 250) with no navigation controls or menus, then focuses user on the new window.
// Parameters: Takes the url of the window to open
// Use: Can be called in a <script> block, or in events such as OnClick.  Example: <a href="http://www.yahoo.com/" target="_blank" OnClick="return PopupWindowSmall('http://www.yahoo.com/')">
function PopupWindowSmall(url) {
  var previewWin = window.open(url,'PreviewWindow','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=250,height=250');
  previewWin.focus();
  return false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// ConfirmMessage: Confirm popup box for a user to confirm an action, such as deleting.
// Parameters: message - Text that user will see
// Use: Example: <a href="http://www.netscape.com/" OnClick="return ConfirmMessage('Netscape is a bad browser.')">
function ConfirmMessage(message){
  if( confirm (message) ){
    return true;
  }else{
    return false; 
  }
}

// standard image swap
function imgOn(imgName) {
  if (document.images) {
    document[imgName].src = eval(imgName + "on.src");
  }
}
function imgOff(imgName) {
  if (document.images) {
    document[imgName].src = eval(imgName + "off.src");
  }
}

//change url function for select box navigation
function ChangeURL(newurl) {
	location.href=newurl;
}

//protect emails from email crawlers
function ProtectEmail(user,site) {
	document.write('<a href=\"mailto:' + user + '@' + site + '\">' + user + '@' + site + '</a>');
}

//capwiz pop-up window center
	function NewWindow(capwizpage,capwiz,w,h,scroll)
	{
		var win = null;
		var LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
		var TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
		var settings =
		'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
		win = window.open(capwizpage,capwiz,settings);
		win.focus();
	}
