var TheInstruction = "<a href=\'mailto:";
var TheMessage = "\' class=\'spread\' title=\'Email Me - Thank You.\'>Click Here</a>";
var TheName = "sbaker.wgs";
var TheYouKnowWhat = "gmail";
var ThreeLetters = "com";
var TheIt = TheName + "@" + TheYouKnowWhat + "." + ThreeLetters;

function ImgBtnQueryTop_PostCallBack()
{
	progressBar.hideBar();
	ShowQuery();
	var msg = document.getElementById("lblMessageSearchResults").innerHTML;
	tabbar.setTabActive("a5");
}

function getTabber()
{
	//var tabbar = document.getElementById("a_tabbar");
	//alert("Tabber = " + tabbar.innerHTML);
	//tabbar.enableAutoSize(true,true);
}

function ImgBtnQueryTop_PreCallBack()
{
	HideQuery();
	document.getElementById("lblMessageSearchResults").innerHTML = "";
	progressBar.showBar();
}

function ShowQuery()
{
	var nodeObjTop = document.getElementById("feedbacktop");
	var msg = nodeObjTop.innerHTML;
	if(msg.indexOf("Concert Date") != -1)
	{
		nodeObjTop.style.display = 'block';
	}
}

function HideQuery()
{
	var nodeObjTop = document.getElementById("feedbacktop");
	nodeObjTop.style.display = 'none';
}

var MonthArray = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

function MakeYearDropdown(DrpId,Enabled)
{
	if(Enabled)
		document.write("<select id='" + DrpId + "' onchange='ChangeDropdownHidden(" + DrpId + ".id)' class='DropDownWidth100'>");
	else		
		document.write("<select id='" + DrpId + "' disabled onchange='ChangeDropdownHidden(" + DrpId + ".id)' class='DropDownWidth100'>");
		
	document.write("<option value = '0'>none</option>");
	for(var yr = 2007; yr >= 1815; yr--)
		document.write("<option value = '" +  yr  + "'>" + yr + "</option>");
		
	document.write("</select>");		
}

function MakeMonthDropdown(DrpId,Enabled)
{
	if(Enabled)
		document.write("<select id='" + DrpId + "' onchange='ChangeDropdownHidden(" + DrpId + ".id)' class='DropDownWidth100'>");
	else		
		document.write("<select id='" + DrpId + "' disabled onchange='ChangeDropdownHidden(" + DrpId + ".id)' class='DropDownWidth100'>");
		
	document.write("<option value = '0'>none</option>");
	for(var mn = 1; mn < 13; mn++)
		document.write("<option value = '" +  mn  + "'>" + MonthArray[mn-1] + "</option>");
	document.write("</select>");		
}

function MakeDayDropdown(DrpId,Enabled)
{
	if(Enabled)
		document.write("<select id='" + DrpId + "' onchange='ChangeDropdownHidden(" + DrpId + ".id)' class='DropDownWidth100'>");
	else		
		document.write("<select id='" + DrpId + "' disabled onchange='ChangeDropdownHidden(" + DrpId + ".id)' class='DropDownWidth100'>");
		
	document.write("<option value = '0'>none</option>");
	for(var dy = 1; dy < 32; dy++)
		document.write("<option value = '" +  dy  + "'>" + dy + "</option>");
		
	document.write("</select>");		
}

function ChangeDropdownHidden(DrpId)
{
	LogActivity(DrpId, "Search.aspx");
	var hDrpId = "h" + DrpId;
	document.Form1[hDrpId].value = document.Form1[DrpId].value;
}

//Clears the form and sets everything back to their default values.
//Calls initializeDateControl() to initialize all the Date Controls.
//Calls initializeTextBoxes() to set all textboxes to empty strings
//Sets all dropdown listboxes indexes to zero
//Sets all hidden text fields containing IDs to zero.
//AJAX: Re-Sets all the data in the Dropdown listboxes to the latest values from the Database.
//Sets all temporary messages to empty strings.
function clearTheForm()
{
	HideQuery();
	initializeDateControl();
	initializeTextBoxes();
	document.Form1.ComposerDropdown.selectedIndex = 0;
	document.Form1.CompositionArg[0].checked = true;
	document.Form1.DirectorDropdown.selectedIndex = 0;
	document.Form1.PerformerDropdown.selectedIndex = 0;
	document.Form1.ConcertHallDropdown.selectedIndex = 0;
	document.Form1.CompositionsSelect.length = 0;
	document.Form1.hComposerId.value = 0;
	document.Form1.hDirectorDropdown.value = 0;
	document.Form1.hPerformerDropdown.value = 0;
	document.Form1.hConcertHallDropdown.value = 0;
	document.Form1.hCompositionIds.value = "";
	setDropdown(document.Form1.hComposerId,document.Form1.ComposerDropdown);
	setDropdown(document.Form1.hDirectorDropdown,document.Form1.DirectorDropdown);
	setDropdown(document.Form1.hPerformerDropdown,document.Form1.PerformerDropdown);
	setDropdown(document.Form1.hConcertHallDropdown,document.Form1.ConcertHallDropdown);
	document.getElementById("lblMessageSearchResults").innerHTML = "";
	document.getElementById("lblFeedBack").innerHTML = "";
	AjaxNamespace.AjaxMethods.ClearSearchSession();
}

//Initialzes all the controls in the Date Control section to their default values
//Enables the Before Dropdowns and disables the After Dropdowns.
//Sets Date Range Radio button to last 50 years.
//Sets all the hidden HTML text fields to their default values.
//Loads the Date Range Dropdown list box to its default values.
//Set all other indexes to zero
function initializeDateControl()
{
	EndableDisableEndDates(1);
	document.Form1.DateRangeRadio[4].checked = true;
	document.Form1.DateFunctionRadio[0].checked = true;
	document.Form1.hSelectBeforeYear.value = 0;
	document.Form1.hSelectBeforeMonth.value = 0;
	document.Form1.hSelectBeforeDay.value = 0;
	document.Form1.hUsedDate.value = 0;
	document.Form1.hDateRange.value = 5;
	document.Form1.hDateFunction.value = 1
	loadDates(document.Form1.hDateRange.value);
	document.Form1.SelectBeforeYear.selectedIndex = 0;
	document.Form1.SelectBeforeMonth.selectedIndex = 0;
	document.Form1.SelectBeforeDay.selectedIndex = 0;
	document.Form1.hCompositionArg.value = 0;
	document.Form1.CompositionArg[0].checked = true;
}

//Initializes all the Textbox controls on Search.aspx to empty strings
function initializeTextBoxes()
{
	document.Form1.hComposerName.value = "";
	document.Form1.hComposition.value = "";
	document.Form1.txtComposerName.value = "";
	document.Form1.txtCompositionName.value = "";
	document.Form1.txtComposer.value = "";
	document.Form1.txtDirector.value = "";
	document.Form1.txtPerformer.value = "";
	document.Form1.txtConcertHall.value = "";
}

function UserErrorMessage(strMessage)
{
	alert(strMessage);
}


