/*
*	File Name: validateAdvancedSearch.js
*	Methods:
*	--validateAdvancedSearch() - David Montgomery 04/09/08
*/

/*
*
*	This method will check to ensure that only 1 search section
*   has been completed.  If no search criteria has been entered
*   then a suitable text key will be returned, likewise when more
*   than 1 search criteria has been entered.
*/


// function that loads the selected quick links page 
function jumpMenuGoRedirect(objId, title, warningText)
{	
	var quickLink = document.getElementById(objId).value;
	
	if ((quickLink != null) && (quickLink != ''))
	{	
		window.location = quickLink;	
	}
	else
	{	
		openPopUp(title, warningText, "error");
	}
}	

// function that validates that the user has enetered a search tern
function validateSearch(objID, title, warningText)
{	
	var searchTerm = document.getElementById(objID).value;
	if ((searchTerm != null) && (searchTerm != ''))
	{	
		return true;
	}
	else
	{	
		openPopUp(title, warningText, "error");
		return false;
	}
}

// function that validates that the user has enetered a teacher
// login username and password
function validateTeacherLogin(objUsernameId, objPasswordId, title, warningUsernameText, warningPasswordText)
{	
	var username = document.getElementById(objUsernameId).value;
	var password = document.getElementById(objPasswordId).value;
	
	if ((username == null) || (username == ''))
	{	
		openPopUp(title, warningUsernameText, "error");
		return false;
	}
	else if ((password == null) || (password == ''))
	{	
		openPopUp(title, warningPasswordText, "error");
		return false;
	}	
	else
	{	
		return true;
	}
}
