<!--
// ========================================= Setup global constants and variables ========================================
// Setup browser version check
var bIS_NETSCAPE = (navigator.appName == "Netscape") ? true : false;
var bIS_IE		 = (navigator.appName == "Microsoft Internet Explorer") ? true : false;

var bWINDOWOPEN = false;				// Global flag to alert if image viewing popup is open
var oWindow = new Object();				// Create a globally accessible window object reference



// ================================================== DHTML ==============================================================
// Function to attach events to dynamically created elements
// obj		is the object to attach event to
// strEvent	is the event without the prefix "on"
// fn		is the event-handler function
function attachEvent(obj, strEvent, fn)
{
    if(obj.addEventListener)
    {
        obj.addEventListener(strEvent,fn,false);
    }
    else if(obj.attachEvent)
    {
        obj.attachEvent("on"+strEvent,fn);
    }
}

// Function to remove all child nodes of an object
function removeChildren(oObject)
{
	for (var count = oObject.childNodes.length - 1; count != -1; --count)
	{
		if (oObject.childNodes[count].childNodes.length != 0)
		{
			removeChildren(oObject.childNodes[count]);
		}
		oObject.removeChild(oObject.childNodes[count]);
	}
}

// Function to dynamically create a table
function createTable(iCellspacing, iCellpadding, sWidth, iBorder, sClass, sAlign, sBgColor)
{
	var oTable = document.createElement("table");
	oTable.cellSpacing = iCellspacing?iCellspacing:0;
	oTable.cellPadding = iCellpadding?iCellpadding:0;
	oTable.width = sWidth?sWidth:"100%";
	oTable.border = iBorder?iBorder:0;
	oTable.className = sClass?sClass:"";
	oTable.align = sAlign?sAlign:"";
	oTable.bgColor = sBgColor?sBgColor:"";
	return oTable;
}

// Function to dynamically create a table cell
function createCell(sAlign, sVAlign, sWidth, sClass, sBgColor)
{
	var oCell = document.createElement("td");
	oCell.align = sAlign?sAlign:"left";
	oCell.vAlign = sVAlign?sVAlign:"top";
	oCell.width = sWidth?sWidth:"";
	oCell.className = sClass?sClass:"";
	oCell.bgColor = sBgColor?sBgColor:"";
	return oCell;
}



// ======================================= Function for popup windows - for images =======================================
// THE createWindow FUNCTION REPLACES THIS ONE.  DELETE THIS FUNCTION AFTER WEBSITE HAS BEEN COMPLETELY REVAMPED.
// This function opens a new window to display images
// strURL		is the URL of the webpage to load within the pop-up
// iWidth		is the width of the window
// iHeight		is the height of the window
function openwinsize(strURL, iWidth, iHeight)
{
	window.open(strURL,"image","toolbar=no,resize=yes,scrollbars=yes,location=no,directories=no,status=no,menubar=no,width=" + iWidth + ",height=" + iHeight);
}



// =================================== New Function for popup windows - for images =======================================
// This function opens a new window to display images
// iWidth				is the width of the window
// iHeight				is the height of the window
// strWindowTitle		is the title of the Window to be appended to school name
// strTitle				is the title to display in window
// strImageURL			is the URL of the image to load.
function createWindow(iWidth, iHeight, strWindowTitle, strTitle, strImageURL)
{
	// First check if popup is previously open...
	if (bWINDOWOPEN)
	{
		// Popup window is already open
		if (oWindow)
		{
			// Close window
			oWindow.close();
		}

		// Reset flag
		bWINDOWOPEN = false;
	}

	oWindow = window.open("","image","channelmode=no,directories=no,fullscreen=no,toolbar=no,scrollbars=no,location=no,status=no,menubar=no,top=0,left=0,width=" + iWidth + ",height=" + iHeight);
	//oWindow = window.open("","image","channelmode=no,directories=no,fullscreen=no,toolbar=no,scrollbars=no,location=no,status=no,menubar=no,top=0,left=0");

	// Begin building window content
	var strDocument = "<html>";
	strDocument += "<head>";
	strDocument += "<title>" + strWindowTitle + "</title>";
	strDocument += "<link rel='stylesheet' href='/css/style_pics.css' type='text/css'>";
	strDocument += "</head><body>";
	strDocument += "<div align='center'><table cellpadding='0' cellspacing='0' border='0'><tr>";
	strDocument += "<td align='center' valign='bottom'><table width='100%' cellpadding='2' cellspacing='1' border='0' bgcolor='#cccccc' style='margin-bottom:10px;'><tr>";
	strDocument += "<td align='left' valign='bottom' bgcolor='#ffffff' style='padding-left:5px'><b>" + strTitle + "</b></td>";
	strDocument += "<td align='right' valign='bottom' bgcolor='#ffffff' style='padding-right:5px'><nobr><a href='javascript: window.close();'> <b>Close</b> <img src='/images/elements/10x10_X.gif' width='10' height='10' border='0' alt=''></a></nobr></td>";
	strDocument += "</tr></table></td>";
	strDocument += "</tr><tr>";
	strDocument += "<td align='center' valign='top'><img src='" + strImageURL + "' alt='" + strWindowTitle + "' border='0' style='border-style:solid;border-width:1px;border-color:#ffffff'></td>";
	strDocument += "</tr></table></div>";
	strDocument += "</body></html>";

	// Write content in window
	oWindow.document.write(strDocument);

	// Activate window flag
	bWINDOWOPEN = true;
}
// The following code was obtained from http://www.hunlock.com/blogs/Everything_You_Ever_Needed_To_Know_About_Video_Embedding#quickIDX3
// It provides for embedding floating video in DHTML pop up windows
//
// Added by Bob on 2-10-08
//
function getElementsByClass (searchClass) {
// This function returns an array of all HTML objects with the
// specified className. Tag is optional 
var returnArray = [];
var els = document.getElementsByTagName('*');
var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
for (var i = 0; i < els.length; i++) {
if ( pattern.test(els[i].className) ) { returnArray.push(els[i]); }
}
return returnArray;
}

function popVideo(vid, darken) {
// This function accepts a division ID (vid), either a string or the actual
// object itself. vid is mandatory. darken is optional, if it's true
// the page will be greyed out under the video.
var videos = getElementsByClass('video'); // Get all the videos on the page.
var isplaying=null;
for(i=0; i<videos.length; i++) { // Loop through all the videos
if (videos[i].style.display=='block') { // This video is playing 
isplaying=videos[i].id; // remember its name
var tmp=videos[i].innerHTML; // Get the division contents
videos[i].innerHTML=''; // destroy the contents
videos[i].style.display='none'; // Terminate the video.
videos[i].innerHTML=tmp; // rebuild the contents.
}
}
// This handles the darkening of the background while a video is playing.
// First we see if the dark layer exists.
var dark=document.getElementById('darkenScreenObject');
if (!dark) {
// The dark layer doesn't exist, it's never been created. So we'll
// create it here and apply some basic styles.
var tbody = document.getElementsByTagName("body")[0];
var tnode = document.createElement('div'); // Create the layer.
tnode.style.backgroundColor='rgb(0, 0, 0)'; // Make it black.
tnode.style.opacity='0.7'; // Set the opacity (firefox/Opera)
tnode.style.MozOpacity='0.70'; // Firefox 1.5
tnode.style.filter='alpha(opacity=70)'; // IE.
tnode.style.zIndex='1'; // Zindex of 50 so it "floats"
tnode.style.position='absolute'; // Position absolutely
tnode.style.top='0px'; // In the top
tnode.style.left='0px'; // Left corner of the page
tnode.style.overflow='hidden'; // Try to avoid making scroll bars 
tnode.style.display='none'; // Start out Hidden
tnode.id='darkenScreenObject'; // Name it so we can find it later
tbody.appendChild(tnode); // Add it to the web page
dark=document.getElementById('darkenScreenObject'); // Get the object.
}
dark.style.display='none';
if ((isplaying==vid)||(/^close$/i.test(vid))) { return false; }
if (typeof(vid)=="string") { vid=document.getElementById(vid); }
if (vid&&typeof(vid)=="object") {
if (darken) {
// Calculate the page width and height 
if( window.innerHeight && window.scrollMaxY ) { 
var pageWidth = window.innerWidth + window.scrollMaxX;
var pageHeight = window.innerHeight + window.scrollMaxY;
} else if( document.body.scrollHeight > document.body.offsetHeight ) {
var pageWidth = document.body.scrollWidth;
var pageHeight = document.body.scrollHeight;
} else { 
var pageWidth = document.body.offsetWidth + document.body.offsetLeft; 
var pageHeight = document.body.offsetHeight + document.body.offsetTop; 
}
//set the shader to cover the entire page and make it visible. 
dark.style.width= pageWidth+'px';
dark.style.height= pageHeight+'px';
dark.style.display='block'; 
}
// Make the video visible and set the zindex so its on top of everything else
vid.style.zIndex='100'; 
vid.style.display='block';
var scrollTop = 0;
if (document.documentElement && document.documentElement.scrollTop)
scrollTop = document.documentElement.scrollTop;
else if (document.body)
scrollTop = document.body.scrollTop;

// set the starting x and y position of the video
vid.style.top=scrollTop+Math.floor((document.documentElement.clientHeight/2)-(vid.offsetHeight/2))+'px';
vid.style.left=Math.floor((document.documentElement.clientWidth/2)-(vid.offsetWidth/2))+'px';
}
return false;
}

//-->