// Show/hide function for search selector
var detailVisible = false; 
	
function showTE_Inquira_searchselector(layerToShow)
{
	if(detailVisible == false)
	{
		document.getElementById(layerToShow).style.display="block";
		detailVisible = true;
		if( document.getElementById("search_type").value == "Text" ){
			document.getElementById("search_selector").selectedIndex = 1
		}
        else {
			document.getElementById("search_selector").selectedIndex = 0
		}

	}
}

function closeTE_Inquira_searchselector(layerToShow)
{
	if(detailVisible == true)
	{
		document.getElementById(layerToShow).style.display="none";
		detailVisible = false;
	}
}
// End show/hide function for search selector


var qna_submitOK       = true;

function TE_SetSearchType(){
	var searchTypeIndex;
	searchTypeIndex = document.getElementById("search_selector").selectedIndex
	if (searchTypeIndex == 1){
		document.getElementById("search_type").value = "Text";
	} 
	else {
		document.getElementById("search_type").value = "Part";
	}
}



function search_inquira_submitQuestion()
{   
    // leave if button is disabled - shouldn't be here...
	if (!qna_submitOK){
        return false;
	}
    // Prevent another quick submit and submit this question
    disableSubmit();    
    // Set the type of search Part vs Text
	TE_SetSearchType()
	// Strip leading and trailing whitespace of all kinds
	var qboxValue = document.getElementById("question_box").value.replace(/^\s+/g,'').replace(/\s+$/g,'');
    document.getElementById("question_box").value = qboxValue;
	// Post the question to the page (action reference)
    document.getElementById("inquiraSearchForm").submit();

    
    // Wait 10 seconds before submit available
    setTimeout("enableSubmit();", 10000);

    return false;
}


/**
  * Disable the submit feature.
  */
function disableSubmit()
{
    qna_submitOK = false;
    document.getElementById("TE_searchButton").disabled = true;
}

/**
  * Enable the submit feature.
  */
function enableSubmit()
{
    qna_submitOK = true;
    document.getElementById("TE_searchButton").disabled = false;
}
