/* * * * * * * * * * * * * * * * * * * * * * * 
 *	File: Utilities.js
 *	Functions: NewWindow(); IEopenWin(); preload;
 *	Instructions: Call NewWindow with address of document as a string,  
 *	height and width of window as numeric values, preloads images 
 *
 * * * * * * * * * * * * * * * * * * * * * * */

// declare popup variable
var popup;

// function for dealing with IE4 on the Mac
function IEopenWin(address,height,width) {
	if (height != null) {
	popup = window.open(address, 'sized_popup_window','statusbar,resizable,scrollbars,HEIGHT=' + height + ',WIDTH=' + width);
	} else {
	popup = window.open(address,scrollbars,'popup_window');
	}
}

// function for opening the pop-up window
// pass the address of the document, height of the window, and width of the window 
function NewWindow(address,height,width) {
	// workaround for ie4 on PC´s!
	if (navigator.appVersion.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Macintosh") == -1 ) {
		if (popup != null) {
			popup.close();
			}
			if (height != null) {
				setTimeout("IEopenWin(\'" + address + "\'," + height + "," + width + ")", 100);
			} else {
				setTimeout("IEopenWin(\'" + address + "\')", 100);
			}
	} else {
	if (height != null) {
		popup = window.open(address, 'sized_popup_window','statusbar,resizable,scrollbars,HEIGHT=' + height + ',WIDTH=' + width);
	} else {
		popup = window.open(address,scrollbars, 'popup_window');
	}
	popup.focus();
	}
}

//preloads images
function MM_preloadImages() { //v2.0
  if (document.images) {
    var imgFiles = MM_preloadImages.arguments;
    if (document.preloadArray==null) document.preloadArray = new Array();
    var i = document.preloadArray.length;
    with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){
      preloadArray[i] = new Image;
      preloadArray[i++].src = imgFiles[j];
  } }
}
//restores swap
function MM_swapImgRestore() { //v2.0
  if (document.MM_swapImgData != null)
    for (var i=0; i<(document.MM_swapImgData.length-1); i+=2)
      document.MM_swapImgData[i].src = document.MM_swapImgData[i+1];
}
//swaps image
function MM_swapImage() { //v2.0
  var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.MM_swapImgData;
  for (i=0; i < (MM_swapImage.arguments.length-2); i+=3) {
    objStr = MM_swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];
    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||
        (objStr.indexOf('document.all[')   ==0 && document.all   ==null))
      objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);
    obj = eval(objStr);
    if (obj != null) {
      swapArray[j++] = obj;
      swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];
      obj.src = MM_swapImage.arguments[i+2];
  } }
  document.MM_swapImgData = swapArray; //used for restore
}
//-->