
function year() { //Update footer copyright year
	var today = new Date();
	if (today.getFullYear) {
		var year = today.getFullYear();
	} else {
		var year = today.getYear();
	}
	document.write(year);
}

function check(frm) //Quick Search Validation
{  if (frm.keywords.value.trim() == "" ) { return false }  
}

//======
// Show a given tab and the associated box contents.
//======
function tabshow(baseid) {
  if (document.getElementById(baseid+'Tab')) {
    document.getElementById(baseid+'Tab').className = "current";
    //Switches the hidden form value so we know which tab is active and which
    //search the user is going to do when they submit the form.
    /*if(baseid == "bool") {
    	document.getElementById("qTab").value = 1;
    } else if(baseid == "key") {
    	document.getElementById("qTab").value = 3;
    } else {
    	document.getElementById("qTab").value = 3;
   }*/
  }
  if (document.getElementById(baseid+'Search')) {
    document.getElementById(baseid+'Search').className = ""; // There is no class for displaying the box.
  }  
}
	
//======
// Hide a given tab and the associated box contents.
//======
function tabhide(baseid) {
  if (document.getElementById(baseid+'Tab')) 
  {
    document.getElementById(baseid+'Tab').className = ""; // There is no class for hiding the tab.
  }
  if (document.getElementById(baseid+'Search')) 
  {
    document.getElementById(baseid+'Search').className = "hide";
  }
  // Clear the form values.
  if(baseid == "boolean" && document.getElementById("booleanSearch"))
  {
    document.getElementById("ctl00_ContentPlaceHolder1_boolean_string").value = "";
  }
  else if(baseid == "keyword" && document.getElementById("keywordSearch"))
  {
     document.getElementById("ctl00_ContentPlaceHolder1_allKeyWords").value = "";
     document.getElementById("ctl00_ContentPlaceHolder1_exactKeyWords").value = "";
     document.getElementById("ctl00_ContentPlaceHolder1_anyKeyWords").value = "";
     document.getElementById("ctl00_ContentPlaceHolder1_noneKeyWords").value = "";
  }
}

function insertOperatorJsp(formValue) 
{	
	// Is this necessary?  If so, we can add it to the ASPX page.
	//var advSearchJspTab = document.getElementById("qTab").value;
	//if(advSearchJspTab == "1") {	// The Boolean search tab is selected
		var opValue = formValue[formValue.selectedIndex].value; // operator value
		//var qValue = document.advsearch.ctl00_ContentPlaceHolder1_boolean_string.value; // text in the query box
		var qValue = document.getElementById("ctl00_ContentPlaceHolder1_boolean_string").value; // text in the query box
		
		if(qValue != "") 
		{
			if(opValue != "*" & opValue != "?") // add space if not a wildcard character
			{ 
				opValue = " " + opValue + " ";
			}		
			if(opValue != "") 
			{
				//document.advsearch.ctl00_ContentPlaceHolder1_boolean_string.value = qValue + opValue;				
				document.getElementById("ctl00_ContentPlaceHolder1_boolean_string").value = qValue + opValue;
				//document.advsearch.ctl00_ContentPlaceHolder1_boolean_string.focus();
				document.getElementById("ctl00_ContentPlaceHolder1_boolean_string").focus();
			} 
		} 
		else 
		{
			alert("Your query really shouldn't begin with a Boolean term.");
		}
	//} 
	//document.advsearch.operators.selectedIndex = 0;
	document.getElementById("operators").selectedIndex = 0;
}

function openResources(theURL,winName,features) { 
	if (window.rWindow && !window.rWindow.closed) {
		rWindow.close()
	}	
	rWindow = window.open(theURL,winName,features);
	rWindow.focus();
}

function openCitation(theURL,winName) 
{ 
	// The features are not passed so they can be modified outside of the C# codebase.
	if (window.cWindow && !window.cWindow.closed) 
	{
		cWindow.close()
	}	
	cWindow = window.open(theURL,winName,'left=10,top=10,width=750,height=550,location=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
	cWindow.focus();
}