
function HandleFt()
{

	// OR free text searching
	if (document.querybox.pm_SC.value == 'FT' )
	{
		if (typeof(document.ft.pm_FT) != "undefined")
		{
			document.ft.pm_FT.value = unescape(document.querybox.pm_SA.value);
			document.ft.pm_OPC.value = document.querybox.pm_OPC.value;
			document.ft.pm_MH.value = document.querybox.pm_MH.value;
		}
	}
	// AND free text searching
	if (document.querybox.pm_SC.value == 'AFT' )
	{ 
		if (typeof(document.ft.pm_AFT) != "undefined")
		{
			document.ft.pm_AFT.value = unescape(document.querybox.pm_SA.value);
			document.ft.pm_OPC.value = document.querybox.pm_OPC.value;
			document.ft.pm_MH.value = document.querybox.pm_MH.value;
		}
	}
}


function GetChecked()
{
	HandleFt();

	dml=document.querybox;
								//check to make sure at least one checkbox is selected in body
	rb = false;						//assume no collections are selected
	if (dml.pm_CL == null)					//assume that no collections exist
	{
								//Check local OPAC
		if(dml.pm_OPC && dml.pm_OPC.checked)
		{
			rb = true;				//as long as one is chosen this is set to true
		}
		if(rb==false)
		{
			alert("Please select a collection");
			return false;
		}
	 return validate_form_browse();				// Use this to call the querybox form to validate
								// if anything is in the search box
	}
	else
	{
		if(dml.pm_CL.length)
		{
			for(i = 0; i < dml.pm_CL.length; i++)
			{
				if(dml.pm_CL[i].checked)
				{
					rb = true;			//as long as one is chosen this is set to true
				}
			}
		}
		else if(dml.pm_CL)
		{
			if(dml.pm_CL.checked)
			{
				rb = true;		
			}
		}
		
		//Check local OPAC
		if(dml.pm_OPC && dml.pm_OPC.checked)
		{
			rb = true;				//as long as one is chosen this is set to true
		}
		if(rb==false)
		{									
			alert("Please select a collection");
			return false;
		}
	   return validate_form_browse();			//Use this to call the querybox form to validate 
								//if anything is in the search box
	}
}


								//This function is for childbrowseadvanced.xsl
function GetCheckedAdvanced()
{
	dml=document.fake;
								//check to make sure at least one checkbox is selected in body
	rb = false 						//assume no collections are selected
	if (dml.pm_CL == null) 					//assume that no collections exist
	{
		//Check local OPAC
		if(dml.pm_OPC && dml.pm_OPC.checked)
		{
			rb = true;				//as long as one is chosen this is set to true
		}
		if(rb==false)
		{
			alert("Please select a collection");
			return false;
		}
		return validate_form_advanced();		//Use this to call the querybox form to validate 
								//if anything is in the search box
	}

	else
	{
		for(i = 0; i < dml.pm_CL.length; i++)
		{
			if(dml.pm_CL[i].checked)
			{
				rb = true;			//as long as one is chosen this is set to true
			}
		}
		//Check local OPAC
		if(dml.pm_OPC && dml.pm_OPC.checked)
		{
			rb = true;				//as long as one is chosen this is set to true
		}
		if(rb==false)
		{
			alert("Please select a collection");
			return false;
		}
		return validate_form_advanced();		//Use this to call the querybox form to validate 
								//if anything is in the search box
	}
}

function AreAnyCollectionsChecked()
{
	dml=document.querybox;

	rb = false;									//assume no collections are selected
	if (dml.pm_CL == null)					//assume that no collections exist
	{
													//Check local OPAC
		if(dml.pm_OPC && dml.pm_OPC.checked)
		{
			rb = true;							//as long as one is chosen this is set to true
		}
		if(rb==false)
		{
			alert("Please select a collection");
		}
	}
	else
	{
		for(i = 0; i < dml.pm_CL.length; i++)
		{
			if(dml.pm_CL[i].checked)
			{
				rb = true;			//as long as one is chosen this is set to true
			}
		}
		//Check local OPAC
		if(dml.pm_OPC && dml.pm_OPC.checked)
		{
			rb = true;				//as long as one is chosen this is set to true
		}
		if(rb==false)
		{
			alert("Please select a collection");
		}
	}
	
	return rb;
}

// TF2 Querybox getchecked

function GetCheckedQueryBox()
{
	//alert("GetCheckedQueryBox");

	return validate_querybox();		
	
}

// TF2 Basic Search getchecked

function GetCheckedBasicSearch()
{
	//alert("GetCheckedBasicSearch");

	return validate_basicsearch();		
	
}

//TF2 Advanced Search getchecked()

function GetCheckedAdvancedSearch()
{
	//alert("GetCheckedAdvancedSearch");

	return validate_advancedsearch();		
	
}

// TF2 Search Again getchecked

function GetCheckedSearchAgain()
{
	//alert("GetCheckedBasicSearch");

	return validate_basicsearchagain();		
	
}

