<!--
function openDir( form ) {

	var newIndex = form.wildlifeSearch.selectedIndex;

	if ( newIndex == 0 ) {
		alert( "Please select a location!" );

	} else {
		cururl = form.wildlifeSearch.options[ newIndex ].value;
		window.location.assign( cururl );
	}
}

// -->

<!--
//Show/Hide Search Function
//preload image
var collimg = new Image();
collimg.src = "/img/searchtab_close.gif";

function ShowHideLayer_OLD(boxID) {
	/* Obtain reference for the selected boxID layer and its button */
	var box = document.getElementById("box"+boxID);
	var boxbtn = document.getElementById("btn"+boxID);

    /* Obtain cookie if it exists */
    var cookieValue = getCookieValue("searchdisplay");
    if (!cookieValue) {
        cookieValue = "0";
    }

    if (cookieValue == "1") {
        box.style.display = "block";
        boxbtn.src = "/img/searchtab_close.gif";
    }
    else {
        box.style.display = "none";
        boxbtn.src = "/img/searchtab.gif";
    }

    /* If the selected box is currently invisible, show it */
/*
	if(box.style.display == "none" || box.style.display=="") {
		box.style.display = "block";
 		boxbtn.src = "/img/searchtab_close.gif";
	}
*/
	/* otherwise hide it */
/*
	else {
		box.style.display = "none";
		boxbtn.src = "/img/searchtab.gif";
	}
*/
}

function ShowHideLayer(boxID) {
	/* Obtain reference for the selected boxID layer and its button */
	var box = document.getElementById("box"+boxID);
	var boxbtn = document.getElementById("btn"+boxID);

    /* Obtain cookie if it exists */
    var cookieValue = getCookieValue("searchdisplay");
    if (!cookieValue) {
        cookieValue = "0";
    }

    if (cookieValue == "1") {
        var searchHtml = box.innerHTML;
        if (searchHtml == "") {
            searchHtml = '<form name="searchCriteriaForm" method="POST" action="/apps/searchlibrary/ctl/submitBasicTQSearch"><table width="100%" border="0" cellspacing="0" cellpadding="0" background="/img/bg_search.gif">';
            searchHtml += '<tr>';
            searchHtml += '<td><img src="/img/spacer.gif" width="4" height="4"></td>';
            searchHtml += '</tr>';
            searchHtml += '<tr>';
            searchHtml += '<td height="25"><table border="0" cellspacing="0" cellpadding="0">';
            searchHtml += '<tr>';
            searchHtml += '<td width="1"><img src="/img/spacer.gif" width="402" height="4">';
	    searchHtml += '<!--<table border="0" cellspacing="0" cellpadding="0">';
            searchHtml += '<tr>';
            searchHtml += '<td width="50"><img src="/img/spacer.gif" width="50" height="10"></td>';
            searchHtml += '<td width="1"><input type="checkbox" name="collectionTypes" value="SP"></td>';
            searchHtml += '<td width="4"><img src="/img/spacer.gif" width="4" height="10"></td>';
            searchHtml += '<td class="searchtext">Sports</td>';
            searchHtml += '<td width="25"><img src="/img/spacer.gif" width="25" height="10"></td>';
            searchHtml += '<td width="1"><input type="checkbox" name="collectionTypes" value="ARCH"></td>';
            searchHtml += '<td width="4"><img src="/img/spacer.gif" width="4" height="10"></td>';
            searchHtml += '<td class="searchtext">Archival</td>';
            searchHtml += '<td width="25"><img src="/img/spacer.gif" width="25" height="10"></td>';
            searchHtml += '<td width="1"><input type="checkbox" name="collectionTypes" value="CO"></td>';
            searchHtml += '<td width="4"><img src="/img/spacer.gif" width="4" height="10"></td>';
            searchHtml += '<td class="searchtext">Contemporary</td>';
            searchHtml += '<td width="25"><img src="/img/spacer.gif" width="25" height="10"></td>';
            searchHtml += '<td width="1"><input type="checkbox" name="collectionTypes" value="WILD"></td>';
            searchHtml += '<td width="4"><img src="/img/spacer.gif" width="4" height="10"></td>';
            searchHtml += '<td class="searchtext">Wildlife</td>';
            searchHtml += '</tr>';
            searchHtml += '</table>--></td>';
            searchHtml += '<td width="45"><img src="/img/spacer.gif" width="45" height="10"></td>';
            searchHtml += '<td width="1"><input type="text" name="comment" value="" onclick="this.value=\'\'" class="searchbox"></td>';
            searchHtml += '<td width="7"><img src="/img/spacer.gif" width="7" height="10"></td>';
            searchHtml += '<td width="30"><input type="image" src="/img/button_go.gif" width="30" height="10"></td>';
            searchHtml += '<td width="35"><img src="/img/spacer.gif" width="75" height="10"></td>';
            searchHtml += '<td class="advancedsearch"><a href="/apps/searchlibrary/ctl/gotoAdvancedTQSearch">Advanced Search</a> | <a href="/help/">Help</a></td>';
            searchHtml += '</tr>';
            searchHtml += '</table></td>';
            searchHtml += '</tr>';
            searchHtml += '</table>';
            searchHtml += '</form>';
            box.innerHTML = searchHtml;
        }
        box.style.display = "block";
        boxbtn.src = "/img/searchtab_close.gif";
    }
    else {
		box.innerHTML = "";
		box.style.display = "none";
        boxbtn.src = "/img/searchtab.gif";
    }
}

<!--

function WinOpen(height,width,url)
{
 window.open(
  url,
  "RegHelp",
  "toolbar=no,location=no,resizable=yes,scrollbars=yes,status=no,height="+height+",width="+width);
}

// -->


<!--

// popname: window name
// fullattr: window properties minus height and width.  Remove any trailing commas in function call!

function WinOpenFullAttr(height,width,url,popname,fullattr)
{
 window.open(
  url,
  popname,
  fullattr + "," + "height=" + height + ",width=" + width);
}

// -->

<!--
function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

// this function takes the document field object - not the name!
function uncheckAll(field)
{
	for (i = 0; i < field.length; i++) {
		field[i].checked = false ;
	}
}


//-->

var saveURL = "";

<!--
function verifyCheckBoxes(field, selected_tape_id)
{
	document.searchResultsForm.inventoryId.value = selected_tape_id;
	// alert("inventoryId: " + document.searchResultsForm.inventoryId.value);

	var checkStatus = false;
	var elementsList = field;
	//var elementsList = document.forms['searchResultsForm'].elements;

	// alert("options: " + elementsList.length);
	for(var optionOffset = 0; optionOffset < elementsList.length; optionOffset++) {
		var currentOption = elementsList[optionOffset];
		if(currentOption.checked == true) {
			// alert("found checked" + currentOption.value);
			checkStatus = true;
			break;
		} else {
			//alert("not " + currentOption.value);
		}
	}

	//for (i=0; i<document.searchResultsForm.length; i++){
	//	if(document.searchResultsForm[i].checked) {
	//		checkStatus = true;
	//		break;
	//	}
	//}
	if (checkStatus) {
		if (confirm("Would you like to save clips before proceeding?")) {
		} else {
			uncheckAll(field);
		}
	}
	document.searchResultsForm.submit();
}

function toggleSearchHeader() {
    var cookieValue = getCookieValue("searchdisplay");
    if (cookieValue) {
        // cookie exists, toggle value
        if (cookieValue == "1") {
            writeSessionCookie("searchdisplay", "0");
        }
        else {
            writeSessionCookie("searchdisplay", "1");
        }
    }
    else {
        // cookie doesn't exist, meaning first time clicking on search
        writeSessionCookie("searchdisplay", "1");
    }
    ShowHideLayer(1);
}

//-->

/*==============================================================================

    Routines written by John Gardner - 2003 - 2005

    See www.braemoor.co.uk/software for information about more freeware
    available.

/*==============================================================================

Routine to write a session cookie

    Parameters:
        cookieName        Cookie name
        cookieValue       Cookie Value

    Return value:
        true              Session cookie written successfullly
        false             Failed - persistent cookies are not enabled

   e.g. if (writeSessionCookie("pans","drizzle") then
           alert ("Session cookie written");
        else
           alert ("Sorry - Session cookies not enabled");
*/

function writeSessionCookie (cookieName, cookieValue) {
  if (testSessionCookie()) {
    document.cookie = escape(cookieName) + "=" + escape(cookieValue) + "; path=/";
    return true;
  }
  else return false;
}

/*==============================================================================

Routine to get the current value of a cookie

    Parameters:
        cookieName        Cookie name

    Return value:
        false             Failed - no such cookie
        value             Value of the retrieved cookie

   e.g. if (!getCookieValue("pans") then  {
           cookieValue = getCoookieValue ("pans2);
        }
*/

function getCookieValue (cookieName) {
  var exp = new RegExp (escape(cookieName) + "=([^;]+)");
  if (exp.test (document.cookie + ";")) {
    exp.exec (document.cookie + ";");
    return unescape(RegExp.$1);
  }
  else return false;
}

/*==============================================================================

Routine to see if session cookies are enabled

    Parameters:
        None

    Return value:
        true              Session cookies are enabled
        false             Session cookies are not enabled

   e.g. if (testSessionCookie())
           alert ("Session coookies are enabled");
        else
           alert ("Session coookies are not enabled");
*/

function testSessionCookie () {
  document.cookie ="testSessionCookie=Enabled";
  if (getCookieValue ("testSessionCookie")=="Enabled")
    return true
  else
    return false;
}

/*==============================================================================

Routine to see of persistent cookies are allowed:

    Parameters:
        None

    Return value:
        true              Session cookies are enabled
        false             Session cookies are not enabled

   e.g. if (testPersistentCookie()) then
           alert ("Persistent coookies are enabled");
        else
           alert ("Persistent coookies are not enabled");
*/

function testPersistentCookie () {
  writePersistentCookie ("testPersistentCookie", "Enabled", "minutes", 1);
  if (getCookieValue ("testPersistentCookie")=="Enabled")
    return true
  else
    return false;
}

/*==============================================================================

Routine to write a persistent cookie

    Parameters:
        CookieName        Cookie name
        CookieValue       Cookie Value
        periodType        "years","months","days","hours", "minutes"
        offset            Number of units specified in periodType

    Return value:
        true              Persistent cookie written successfullly
        false             Failed - persistent cookies are not enabled

    e.g. writePersistentCookie ("Session", id, "years", 1);
*/

function writePersistentCookie (CookieName, CookieValue, periodType, offset) {

  var expireDate = new Date ();
  offset = offset / 1;

  var myPeriodType = periodType;
  switch (myPeriodType.toLowerCase()) {
    case "years":
      expireDate.setYear(expireDate.getFullYear()+offset);
      break;
    case "months":
      expireDate.setMonth(expireDate.getMonth()+offset);
      break;
    case "days":
      expireDate.setDate(expireDate.getDate()+offset);
      break;
    case "hours":
      expireDate.setHours(expireDate.getHours()+offset);
      break;
    case "minutes":
      expireDate.setMinutes(expireDate.getMinutes()+offset);
      break;
    default:
      alert ("Invalid periodType parameter for writePersistentCookie()");
      break;
  }

  document.cookie = escape(CookieName ) + "=" + escape(CookieValue) + "; expires=" + expireDate.toGMTString() + "; path=/";
}

/*==============================================================================

Routine to delete a persistent cookie

    Parameters:
        CookieName        Cookie name

    Return value:
        true              Persistent cookie marked for deletion

    e.g. deleteCookie ("Session");
*/

function deleteCookie (cookieName) {

  if (getCookieValue (cookieName)) writePersistentCookie (cookieName,"Pending delete","years", -1);
  return true;
}