	//send to focus library search
	function StartNewSearch(){
		//if at home page or focus library search page
		if(ASPPage('Current') == 'index.asp' || ASPPage('Current') == 'focuslibrarysearch.asp' || ASPPage('Current') == 'focuslibrarysearchresult.asp' || ASPPage('Current') == ''){
			document.LibraryComparison.action = 'FocusLibrarySearch.asp';
			document.LibraryComparison.submit();
			}
		//if no focus libary has been selected yet
		else if(document.LibraryComparison.Focus.value == ''){
			document.LibraryComparison.action = 'FocusLibrarySearch.asp';
			document.LibraryComparison.submit();
			}
		//otherwise, ask the question
		else{
			if(confirm('By electing to start a new search, you will lose all current selections.  Are you sure you want to do this?') == true){
				document.LibraryComparison.action = 'FocusLibrarySearch.asp';
				document.LibraryComparison.submit();
				}
			}
		}
	
	//standard pop-up
	function Popup(FullURL,Style){
		var RandomNumber = Math.round(Math.random()*100)
		var Scrollbar = 'yes'
		var WindowName = 'PopupWindow' + RandomNumber

		if(FullURL.indexOf('?') > 0){
			var LinkURL = FullURL + '&Popup=1'
			}
		else{
			var LinkURL = FullURL + '?Popup=1'
			}
			
		//set popup style
		if(Style == 'Mini'){
			var Width = 230;
			var Height = 250;
			Scrollbar = 'no'
			WindowName = 'Mini'
			}
		if(Style == 'Note'){
			var Width = 400;
			var Height = 300;
			WindowName = 'Note'
			}
		if(Style == 'Tip'){
			var Width = 500;
			var Height = 400;
			WindowName = 'Tip'
			}
		if(Style == 'LibDetail'){
			var Width = 500;
			var Height = 600;
			WindowName = 'LibDetail'
			}
		if(Style == 'Warning'){
			var Width = 490;
			var Height = 560;
			Scrollbar = 'yes'
			WindowName = 'Warning'
			}
		if(Style == 'Page'){
			var Width = 750;
			var Height = 550;
			WindowName = 'Page'
			}
		if(Style == 'Chart'){
			var Width = 730;
			var Height = 590;
			WindowName = 'Chart'
			}
		if(Style == 'PageWithAddress'){
			var Width = 750;
			var Height = 550;
			WindowName = 'PageWithAddress'
			}
			
		//open window
		if(Style == 'PageWithAddress'){
			window.open(LinkURL,WindowName,'toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, resizable=yes, scrollbars=' + Scrollbar + ', screeny=0, screenx=0, top=0, left=0, width=' + Width + ', height=' + Height);
			}
		else if(Style == 'Warning'){
			window.open(LinkURL,WindowName,'toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, scrollbars=' + Scrollbar + ', screeny=0, screenx=0, top=0, left=0, width=' + Width + ', height=' + Height);
			}
		//warning
		else{
			window.open(LinkURL,WindowName,'toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=yes, scrollbars=' + Scrollbar + ', screeny=0, screenx=0, top=0, left=0, width=' + Width + ', height=' + Height);
			}
		//set appropriate target and action for referring page
		document.LibraryComparison.target = WindowName;
		document.LibraryComparison.action = FullURL;
		//if linking to an ASP page, submit form to pop-up window
		if(FullURL.indexOf('.asp') > 0){document.LibraryComparison.submit()};
		//reset form target and action for referring page
		document.LibraryComparison.target = '';		
		document.LibraryComparison.action = '';
		}
		
	//makes sure report at least one topic is selected
	function VerifyReportTopic(){
		var Result = false
		var ReportTopicCount = 0

		if(ASPPage('Current') == 'reporttopic.asp'){
			for(j=0; j<document.LibraryComparison.elements.length; j++){
				if(document.LibraryComparison.elements[j].id.indexOf('Check') == 0){
					if(document.LibraryComparison.elements[j].checked == true){
						ReportTopicCount++
						}
					}
				}

			if(ReportTopicCount > 0){
				Result = true;
				}
			else{
				alert("You must select at least one topic to create a report!");
				}

			//if(ReportTopicCount > 7){
			//	alert('You have selected ' + ReportTopicCount + ' topics.  Please limit to 7 topics.');
			//	Result = false;
			//	}
			}
		else if(LibraryComparison.ReportTopic.value != ''){
			Result = true;
			}

		return Result;
		}
	
	//get current or previous page name
	function ASPPage(PageType){
		if(PageType == "Current"){
			var CurrentPage = window.location.pathname;
			}
		if(PageType == "Previous"){
			var CurrentPage = document.referrer;
			}	
		var CurrentPage = CurrentPage.substring(CurrentPage.lastIndexOf('/') + 1);
		var CurrentPage = CurrentPage.toLowerCase();
		return CurrentPage;
		}

	//remove peer library from list
	function RemovePeer(Peer){
		document.getElementById('Peer').value = "," + document.getElementById('Peer').value + ","
		while(document.getElementById('Peer').value.indexOf(',' + Peer + ',') >= 0){
			document.getElementById('Peer').value = document.getElementById('Peer').value.replace(',' + Peer + ',',',')
			}
		document.getElementById('Peer').value = document.getElementById('Peer').value.replace(RegExp(",,","g"),',')
		//document.getElementById('Peer').value = document.getElementById('Peer').value.substr(2, document.getElementById('Peer').value.length - 4)
		}

	//valid number
	function isInteger(Value){
		var i;
		var Result = true;
		while(Value.indexOf(',') >= 0){
			Value = Value.replace(',','')
			}

	    for (i = 0; i < Value.length; i++){   
	        // Check that current character is number.
	        var Character = Value.charAt(i);
	        if((Character < '0' || Character > '9') && Character != '.'){
				Result = false;
				}
		    }

	    return Result;
		}

	//functionality for "Next" and "Previous" result set
	function ChangeResultSet(Direction){
		if(Direction == "Next"){
			if(document.LibraryComparison.ResultSetNumber.value != ''){
				document.LibraryComparison.ResultSetNumber.value = parseInt(document.LibraryComparison.ResultSetNumber.value) + 1;
				}
			else{
				document.LibraryComparison.ResultSetNumber.value = 2
				}
			}
		if(Direction == "Prev"){
			if(document.LibraryComparison.ResultSetNumber.value != ''){
				document.LibraryComparison.ResultSetNumber.value = parseInt(document.LibraryComparison.ResultSetNumber.value) - 1;
				}
			}
		document.LibraryComparison.submit();
		}

	//functionality for "Next" and "Previous" column set
	function ChangeColumnSet(Direction){
		if(Direction == "Next"){
			if(document.LibraryComparison.ColumnSetNumber.value != ''){
				document.LibraryComparison.ColumnSetNumber.value = parseInt(document.LibraryComparison.ColumnSetNumber.value) + 1;
				}
			else{
				document.LibraryComparison.ColumnSetNumber.value = 2
				}
			}
		if(Direction == "Prev"){
			if(document.LibraryComparison.ColumnSetNumber.value != ''){
				document.LibraryComparison.ColumnSetNumber.value = parseInt(document.LibraryComparison.ColumnSetNumber.value) - 1;
				}
			}
		document.LibraryComparison.submit();
		}