
// var toolbar = document.getElementById("Toolbar");

function AdvancedSearchPane(pButtonIndex)
{
	this.buttonIndex = pButtonIndex;
}

AdvancedSearchPane.prototype =
{
	buttonIndex : null
	,
	AdvancedSearchPane : function(pButtonIndex)
	{
		buttonIndex = pButtonIndex;
	}
	,
	getPaneDiv : function()
	{
		return window.document.getElementById("StockSuperSearch");
	}
	,
	toggleDisplay : function()
	{
		var searchDiv = this.getPaneDiv();
		if (searchDiv)
		{
			if (this.isHidden())	this.show();
			else					this.hide();
		}
	}
	,
	isHidden : function()
	{
		var returnVal = null;
		var searchDiv = this.getPaneDiv();
		if (searchDiv)	returnVal = (searchDiv.style.display === "none");
		else			returnVal = null;
		return returnVal;
	}
	,
	show : function()
	{
		var searchDiv = this.getPaneDiv();
		if (searchDiv)
		{
			searchDiv.style.display = "";
			window.document.getElementById("btn"+this.buttonIndex).innerHTML = "Search Off";
			window.document.getElementById("advsearch").value = "on";
			getEl("ahref_" + this.buttonIndex).title = "Remove the Advanced Search panel from display.\r\n\r\nCtrl + F";
			createCookie("SearchVisible", "visible", 30);
			
			setLabelListDivHeight();
			getEl("String").focus();
		}		
	}
	,
	hide : function()
	{
		var searchDiv = this.getPaneDiv();
		if (searchDiv)
		{
			searchDiv.style.display = "none";
			
			window.document.getElementById("btn"+this.buttonIndex).innerHTML = "<font color=\"white\">O</font>Search <font color=\"white\">ff</font>";
			window.document.getElementById("nsform").reset();
			window.document.getElementById("advsearch").value = "off";
			getEl("ahref_" + this.buttonIndex).title = "Use the Advanced Search options to find any part of a label name or nominate a date to display recently introduced labels. Remember to press the Search button to commence the search and the Clear button to return to the original list.\r\n\r\nCtrl + F";
			if (getEl("labelType") != null)
				getEl("labelType").selectedIndex = "0";
			
			createCookie("SearchVisible", "hidden", 30);
			
			setLabelListDivHeight();
		}
	}
}
