/*
    Form Script
    Used to control the way the form is submitted
*/

// Determines whether the form will be submitted
var Form_SubmitForm = true;

// Determines whether the form will be submitted
var Form_SubmitSearchForm = true;

// trims the form input by removeing white space from the start and end
function Form_Trim( str )
{
	str = str.replace(/^\s+/,'');
	str = str.replace(/\s+$/,'');
	return str ;
}

// checks the state of the Form_SubmitForm var before submitting the form
function Form_Submit()
{
	if (Form_SubmitForm) 
	{
	    return true;
	}
	// reset this var
	Form_SubmitForm = true;
	Form_SubmitSearchForm = true;
	return false;
} 

/* *** Code to handle the posting of search results in order to preserve the user's selected items *** */

function PostSearch(targetUrl){
    // first attempt to get the .Net form, this is based on the code used by .Net to drive __doPostBack
    if(theForm != null){
        // set the target for the form
        theForm.action = targetUrl;
        theForm.submit();
    }
}