// +------------------------------------------------------------+
// | Created 08/25/2003              Last Modified 08/25/2003   |
// | Web Site:             				  http://StAnthony.org  |
// +------------------------------------------------------------+
// | Contains all the scripts for the Catalog advanced search;  |
// | Less clutter on page				                        |
// |                                                            |
// |                            								|
// +------------------------------------------------------------+

// "Calendar" Script begins
<!--
var objCalendar;
var calURL;
var calWinWidth;
var calWinHeight;
var calOptions;


function openCalendar(calURL) {
calWinWidth = 200;
calWinHeight = 460;
var calOptions = "width=" + calWinWidth + ",height=" + calWinHeight + ",scrollbars=no,resizable=yes,menubar=no,status=no,toolbar=no,location=no,directories=no";
 if (calURL) {  
  if (!objCalendar || objCalendar.closed){
    objCalendar = window.open(calURL,'Calendarwin', calOptions);  // Open a new window and show the specified page
    objCalendar.focus();
	objCalendar.moveTo(506,40);   
   									  }
  else{
    objCalendar.close();
	objCalendar = window.open(calURL,'Calendarwin', calOptions);  // Open a new window and show the specified page
    objCalendar.focus();
	objCalendar.moveTo(506,40);
  	  }
 	    }
}

// Script Ends -->
// +------------------------------------------------------------+

// "Layers" Script begins
<!--
	// set global browser identification variables
	browser = navigator.appName;
	browserNum = parseInt(navigator.appVersion);
	N4 = false;
	N6 = false;
	IE = false;
	
	if ((browser == "Netscape") && (browserNum < 5))
	{
		// Netscape 4.x
		layerRef = "document.layers['";
		endLayerRef = "']";
		styleRef = "";
		N4 = true;
	}
	else if ((browser == "Netscape") && (browserNum >= 5))
	{
		// Netscape 6
		layerRef = "document.getElementById('";
		styleRef = ".style";
		endLayerRef = "')";
		N6 = true;
	}
	else
	{
		// Internet Explorer
		layerRef = "document.all['";
		endLayerRef = "']";
		styleRef = ".style";
		IE = true;
	}
	
	// create way to remember which layer is visible
	oldLayer = "none";
	
	// set animation variables
	initialTop = 120;
	newTop = initialTop;
	
function showPic(layerName)
{
	// show the layer the user wants to see
	eval(layerRef + layerName + endLayerRef + styleRef + ".visibility = 'visible'");
	
	
	// move other window
	if (oldLayer != "none")
	{
		// alter z-indices of layers to place
		// the new menu above older menu
		eval(layerRef + layerName + endLayerRef + styleRef + ".zIndex = 11");
		eval(layerRef + oldLayer + endLayerRef + styleRef + ".zIndex = 10");
		
		// slide the old menu layer up and out of sight
		slideMenu(oldLayer);
	}
	
	
	// update which window is currently visible
	if (oldLayer == layerName)
	{
		oldLayer = "none";
	}
	else
	{
		oldLayer = layerName;
	}
	
}
	
function slideMenu(layerName)
{
	// find layer height
	if(N4)
	{
		height = eval(layerRef + layerName + endLayerRef + ".clip.height");
	}
	else
	{
		height = eval(layerRef + layerName + endLayerRef + ".offsetHeight");
	}
	
	// animate the layer upwards
	moveLayer(layerName,height);

	return;
}
	
function moveLayer(layerName,height)
{
	// newTop and initialTop are global variables, set earlier
	endTop = initialTop - height;
	newHeight = height - newTop;
	
	if(newTop > endTop)
	{
		// move layer again
		newTop = newTop - 20;
		eval(layerRef + layerName + endLayerRef + styleRef + ".top = " + newTop);
		//eval(layerRef + layerName + endLayerRef + ".offsetHeight = " + newHeight);
	}
	else
	{
		// hide the old menu and reset its position
		eval(layerRef + layerName + endLayerRef + styleRef + ".visibility = 'hidden'");
		eval(layerRef + layerName + endLayerRef + styleRef + ".top = " + initialTop);
		
		// reset global variable in preparation for the next menu
		newTop = initialTop;
		return;
	}

	// wait a bit, then call this function again
	setTimeout("moveLayer('" + layerName + "'," + height + ")",1);
}
// Script Ends -->
// +------------------------------------------------------------+