<!-- All JavaScript and HTML copyright The Library Corporation, Inwood, WV
	var appVersion=navigator.appVersion.toLowerCase();
	
	function getElementsByClass(searchClass,node,tag) {
		var classElements = new Array ();
		if ( node == null )
			node = document;
		if ( tag == null )
			tag = '*';
		var els = node.getElementsByTagName(tag);
		var elsLen = els.length;
		var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
		for (i = 0, j = 0; i < elsLen; i++) {
			if ( pattern.test(els[i].className) ) {
				classElements[j] = els[i];
				j++;
			}
		}
		return classElements;
	}
//Add event on load function.  Presevers current Onload functions
	function addLoadEvent(func) {
		var oldonload = window.onload;
  		if (typeof window.onload != 'function') {
    		window.onload = func;
  		} else {
    		window.onload = function() {
      			if (oldonload) {
        			oldonload();
      			}
      			func();
    		}
  		}
	}
//Javascript Cookie Handling
	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}else{
			var expires = "";
		}
		document.cookie = name+"="+value+expires+"; path=/TLCScripts/";
	}

	function readCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		
		return null;
	}

	function eraseCookie(name) {
		createCookie(name,"",-1);
	}

// Code to replace Checkmarks with images
//var imgFalse = '/TLCImages/false.gif';
//var imgTrue = '/TLCImages/true.gif';

	function checkChange(cbId, ImgId, tChangeValue)
	{
		var cb = document.getElementById(cbId);
		var im = document.getElementById(ImgId);
		
		var s_imagePath = im.src;
		var n_indexOfLastSlash = s_imagePath.lastIndexOf('/');
		
		if (tChangeValue)
		{
		    if(cb.checked)
		    {
			    cb.checked = '';
		    }
		    else
		    {
			    cb.checked = 'checked';
		    }
		}
	
		if(cb.checked)
		{
			if (n_indexOfLastSlash != -1)
			{
				im.src = s_imagePath.substring(0, n_indexOfLastSlash + 1) + "true.gif";
			}
		}
		else
		{
			if (n_indexOfLastSlash != -1)
			{
				im.src = s_imagePath.substring(0, n_indexOfLastSlash + 1) + "false.gif";
			}
		}
	}

//Session Timer
	var Timer ={
		refresh: null,
		time: 0,
		t: 0,
		url: null,
		
		Start: function(){
			if(document.all){
				document.attachEvent("onmousemove",Timer.Reset);
				document.attachEvent("onkeydown",Timer.Reset);
				document.attachEvent("onscroll",Timer.Reset);
			}else{
				window.onmousemove=Timer.Reset;
				window.onkeydown=Timer.Reset;
				window.onscroll=Timer.Reset;
			}
			Timer.t = self.setInterval("Timer.Tick()",1000);
		},
		
		Tick: function(){
			Timer.time++;
			if(Timer.time>Timer.refresh){
				Timer.Kill();
				window.location.href=Timer.url;
			}
		},
		
		Reset: function(){
			Timer.time=0;
		},
		
		Kill: function(){
			clearInterval(Timer.t);
		},
		
		Popup: function(win){
			if(document.all){
				win.document.attachEvent("onmousemove",parent.Timer.Reset);
				win.document.attachEvent("onkeydown",parent.Timer.Reset);
				win.document.attachEvent("onscroll",parent.Timer.Reset);
			}else{
				win.onmousemove=parent.Timer.Reset;
				win.onkeydown=parent.Timer.Reset;
				win.onscroll=parent.Timer.Reset;
			}
		}
	};
	
//Hide Select Boxes.  Used for IE6 
	function toggleSelect(me,state){
		state = (state==0) ? "hidden" : "visible";
		if(me.nodeName.toLowerCase()!="iframe"){
			// Hide ALL selects embedded within the page
			var els2=document.getElementsByTagName("select");
			for(var i=0; i<els2.length; i++){
				els2[i].style.visibility = state;
			}
			//Show selects within popup
			var els1=me.getElementsByTagName("select");
			for(var i=0; i<els1.length; i++){
				els1[i].style.visibility = (state=="hidden") ? "visible" : "hidden";
			}
		}else{
			var els1=parent.document.getElementsByTagName("select");
			for(var i=0; i<els1.length; i++){
				//var e=document.createElement("input");
				//input.type="text";
				//input.style.width=els1[i].clientWidth;
				//input.value=els1[i].value;
				els1[i].style.visibility = state;
			}
		}
	}
//Window Opener
	function jsOpenWindow(url, width, height, windowname){
		var nWinTop,  nWinLeft;
		var strFeatures;
		nWinTop = (screen.availHeight/2) - height/2;
		nWinLeft = (screen.availWidth/2) - width/2;
		window.open(url,windowname,'width=' + width + ',height=' + height + ',top=' + nWinTop + ',left=' + nWinLeft + ',resizable=0,scrollbars=no,menubar=no,status=no' );
	}
	
//Branch Checker
	function fnCheckAllBranches(tCheckTheBox){
		var x_branchElements = document.getElementsByName("Branch");
		for (var i = 0; i < x_branchElements.length; i++){
			if (x_branchElements[i].type == 'checkbox'){
				x_branchElements[i].checked = tCheckTheBox;
			}
		}
	}
	
//PopUP windows
	function openPopUpDlg(url){
		document.getElementById("popup").src=url;
	}
	
//Help PopUP
	function ighelp(popupurl, contenturl){
		var x_url = popupurl + '&url=' + escape(contenturl);
		var n_width=window.screen.width/2;
		var n_height=window.screen.height * .75;
		var n_top=(window.screen.height - n_height)/2;
		var n_left=(window.screen.width - n_width)/2;
		var x_details = 'left=' + n_left + ',top=' + n_top + ',width=' + n_width + ',height=' + n_height;
		x_details += 'toolbar=no,menubar=no,scrollbars=yes,resizable=yes';
		igwin = window.open(x_url,"igpage",x_details);
		igwin.focus();
		if (!igwin.opener){
			igwin.opener = "self";
		}
	}

//labeldisplay functions
	function igERAccess(linkURL,tagNumber, recordNumber){
		var url = "/TLCScripts/interpac.dll?ERAccess&Config=pac&Branch=,0,&RecordNumber="+recordNumber+"&TagNumber="+tagNumber+"&URI="+escape(linkURL);
		//window.open(url, "_blank");
		jsOpenWindow(ulr,"100%","100%","_self");
	}
	
	function fnCheckSelection(){
		for (n_index=0; n_index < document.PlaceHoldForm.elements.length; n_index++){
			if (document.PlaceHoldForm.elements[n_index].checked){
				return true;
			}
		}
		alert ("Please select an item for Hold Request");
		return false;
	}
	
	function fnSortItemTitles(url, nSortField, selectControl){
 		if (nSortField < 100 ) 
			url = url + nSortField;
		else
			url = url + selectControl.options[selectControl.selectedIndex].value;
		OnSearch();
  		window.open(url, "_self");
	}

//Javascript function to mimic fixed positioning in IE6
	function IE6Fixed(){
		if(appVersion.indexOf("msie 6")!=-1){
			window.onscroll=function(){
				if(document.getElementById("editpane")){document.getElementById("editpane").style.top=0 + document.documentElement.scrollTop + "px";}
				var els=getElementsByClass("popup");
				for(var i=0; i<els.length; i++){
					els[i].style.top=(document.documentElement.clientHeight/2) + document.documentElement.scrollTop + "px";
				}
			}
			window.onresize=function(){
				var els=getElementsByClass("popup");
				for(var i=0; i<els.length; i++){
					els[i].style.top=(document.documentElement.clientHeight/2) + document.documentElement.scrollTop + "px";
				}
			}
		}
	}
	addLoadEvent(IE6Fixed);
//Javascript to view a popup window
	function displayMe(me, shade, w, h){
		shade.style.display="block";
		me.style.display="block";
		if(appVersion.indexOf("msie 6")!=-1){
			toggleSelect(me,0);
		}
		
		if(w==null){
			if(me.nodeName.toLowerCase()=="iframe"){
				w = document.documentElement.scrollWidth;
				if(navigator.appName.toLowerCase().indexOf("netscape")) w = w + 5;
			}else{
				w = me.clientWidth;
			}
		}
		if(h==null){
			if(me.nodeName.toLowerCase()=="iframe"){
				h = document.documentElement.scrollHeight;
			}else{
				h = me.clientHeight;
			}
		}
		/*if(me.nodeName.toLowerCase()=="iframe"){
			var w = document.documentElement.scrollWidth;
			var h = document.documentElement.scrollHeight;
			if(navigator.appName.toLowerCase().indexOf("netscape")) w = w + 5;
		}else{
			var w = me.clientWidth;
			var h = me.clientHeight;
		}*/
		var l = -w/2;
		var t = -h/2;
	//alert(h);
	//alert(w);
		me.style.width = w + "px";
		me.style.height = h + "px";
		me.style.marginLeft = l + "px";
		me.style.marginTop = t + "px";
		me.style.top="50%";
		me.style.left="50%";
	}
	
	function closeMe(me, shade){
		if(appVersion.indexOf("msie 6")!=-1){
			toggleSelect(me,1);
		}
		shade.style.display="none";
		me.style.display="none";
		me.style.top="-10000px";
		me.style.left="-10000px";
		me.style.width="auto";
		me.style.height="auto";
	}

	function disableOrEnable(sId, tDisable)
	{
		var x_div = document.getElementById(sId);
		x_div.disabled = tDisable;

		var ax_inputs = x_div.getElementsByTagName("input");
		for(var i = 0; i < ax_inputs.length; i++)
		{
			ax_inputs[i].disabled = tDisable;
		}
	}
	
	function limitsSelectChange(xSelectBox)
	{
		for (x = 0; x < xSelectBox.options.length; x++)
		{
			if (((xSelectBox.options[x].value == '0') || (xSelectBox.options[x].value == '-1')) &&
				(xSelectBox.options[x].selected))
			{
				xSelectBox.selectedIndex = x;
				break;
			}
		}
	}
	
	function fnFindOptionByValue(xSelectControl, xValue)
	{
		for (var n_option = 0; n_option < xSelectControl.options.length; n_option++)
		{
			if (xSelectControl[n_option].value == xValue)
			{
				return xSelectControl[n_option];
			}
		}
		
		return null;
	}
	
	function clearAllLimits()
	{
		clearDateLimits();
		if (document.LimitsForm.Collection)
		{
			document.LimitsForm.Collection.selectedIndex = 0;
		}
		document.LimitsForm.Format.selectedIndex = 0;
		document.LimitsForm.Language.selectedIndex = 0;
		document.LimitsForm.Place.selectedIndex = 0;
		
		if (document.LimitsForm.Branch && document.LimitsForm.Branch.type == 'select-multiple')
		{
			for (var n_option = 0; n_option < document.LimitsForm.Branch.options.length; n_option++)
			{
				if (document.LimitsForm.Branch[n_option].value == '0')
				{
					document.LimitsForm.Branch.selectedIndex = n_option;
					break;
				}
			}
		}

		document.LimitsForm.SearchAvailableOnly.checked = false;				
	}
	
	function clearDateLimits()
	{
		document.LimitsForm.DateOne.value = '';
		document.LimitsForm.DateTwo.value = '';
	}
	
	function limitsFormOnLoad()
	{
//		// Sync Period Limit
//		var x_sourcePeriodLimit = window.parent.document.getElementById('PeriodLimitInput');
//		var x_destPeriodLimit = document.getElementById('PeriodLimitInput');
//		if (x_sourcePeriodLimit)
//		{
//			x_destPeriodLimit.selectedIndex = x_sourcePeriodLimit.selectedIndex;
//		}
		
		// Sync Items per page
		var x_sourceItemsPerPage = window.parent.document.getElementById('ItemsPerPageInput');
		var x_destItemsPerPage = document.getElementById('ItemsPerPageInput');
		if (x_sourceItemsPerPage)
		{
			x_destItemsPerPage.selectedIndex = x_sourceItemsPerPage.selectedIndex;
		}
		
		// Sync Branches
		var x_sourceBranches = window.parent.document.getElementById('BranchesInput');
		var x_destBranches = document.getElementById('BranchesInput');
		if (x_sourceBranches && x_destBranches)
		{
			for (x = 0; x < x_sourceBranches.options.length; x++)
			{
				var x_destOption = fnFindOptionByValue(x_destBranches, x_sourceBranches[x].value);
				if (x_destOption)
				{
					x_destOption.selected = x_sourceBranches[x].selected;
				}
			}
		}
		
		// Sync Search Available Only Checkbox
		var x_sourceSrchAvaialCB = window.parent.document.getElementById('SrchAvailableOnlyInput');
		var x_destSrchAvaialCB = document.getElementById('SrchAvailableOnlyInput');
		if (x_sourceSrchAvaialCB)
		{
			x_destSrchAvaialCB.checked = x_sourceSrchAvaialCB.checked;
		}
		
		displayMe(parent.document.getElementById('popup'), parent.document.getElementById('editpane'));
	}
	
	function synchronizeLimits()
	{
//		var x_sourcePeriodLimit = document.getElementById('PeriodLimitInput');
//		var x_destPeriodLimit = window.parent.document.getElementById('PeriodLimitInput');
//	
//		// Sync Period Limit
//		if (x_destPeriodLimit)
//		{
//			if (window.parent.document.getElementById("NewItemsTab") &&
//				window.parent.document.getElementById("KeywordTab"))
//			{
//				if (x_sourcePeriodLimit.selectedIndex > 0)
//				{
//					if (window.parent.document.getElementById("formcontainer").className == 'search')
//					{
//						window.parent.fnChangeTab(3);
//					}
//				}
//				else
//				{
//					if (window.parent.document.getElementById("formcontainer").className == 'new')
//					{
//						window.parent.fnChangeTab(0);
//					}
//				}
//			}
//			x_destPeriodLimit.selectedIndex = x_sourcePeriodLimit.selectedIndex;
//		}
//		else
//		{
//			window.parent.document.SearchForm.PeriodLimit.value =
//				x_sourcePeriodLimit[x_sourcePeriodLimit.selectedIndex].value;
//		}

		// Sync Items per page
		var x_sourceItemsPerPage = document.getElementById('ItemsPerPageInput');
		var x_destItemsPerPage = window.parent.document.getElementById('ItemsPerPageInput');
		if (x_destItemsPerPage)
		{
			x_destItemsPerPage.selectedIndex = x_sourceItemsPerPage.selectedIndex;
		}
		else
		{
			window.parent.document.SearchForm.ItemsPerPage.value =
				x_sourceItemsPerPage[x_sourceItemsPerPage.selectedIndex].value;
		}

		// Sync Branches
		var x_sourceBranches = document.getElementById('BranchesInput');
		if (x_sourceBranches)
		{
			var x_destBranches = window.parent.document.getElementById('BranchesInput');
			if (x_destBranches)
			{
				for (x = 0; x < x_sourceBranches.options.length; x++)
				{
					var x_destOption = fnFindOptionByValue(x_destBranches, x_sourceBranches[x].value);
					if (x_destOption)
					{
						x_destOption.selected = x_sourceBranches[x].selected;
					}
				}
			}
			else
			{
				window.parent.document.SearchForm.Branch.value = ',';
				for (x = 0; x < x_sourceBranches.options.length; x++)
				{
					if (x_sourceBranches[x].selected)
					{
						window.parent.document.SearchForm.Branch.value += x_sourceBranches[x].value;
						window.parent.document.SearchForm.Branch.value += ',';
					}
				}
			}
		}

		// Sync Search Available Only Checkbox
		var x_sourceSrchAvaialCB = document.getElementById('SrchAvailableOnlyInput');
		var x_destSrchAvaialCB = window.parent.document.getElementById('SrchAvailableOnlyInput');
		if (x_destSrchAvaialCB)
		{
			x_destSrchAvaialCB.checked = x_sourceSrchAvaialCB.checked;
		}
		else
		{
			window.parent.document.SearchForm.SearchAvailableOnly.value =
				(x_sourceSrchAvaialCB.checked) ? '1' : '0';
		}
	}
