var layoutAssist = {
	_name: 'layoutAssist',
	
	_$: function(eleName)
	{
		return document.getElementById(eleName);
	},
	_hide: function(eleName)
	{
		if(this._$(eleName))
			this._$(eleName).style.display = 'none';
	},
	_show: function(eleName)
	{
		if(this._$(eleName))
			this._$(eleName).style.display = 'block';
	},
	_show_inline: function(eleName)
	{
		if(this._$(eleName))
			this._$(eleName).style.display = 'inline';
	},
	_visible: function(eleName)
	{
		if(this._$(eleName))
			this._$(eleName).style.visibility = 'visible';
	},
	_invisible: function(eleName)
	{
		if(this._$(eleName))
			this._$(eleName).style.visibility = 'hidden';
	},
	
	visibleOnValue: function(eleName, matchVal, checkVal)
	{
		if(matchVal == checkVal)
			this._visible(eleName);
		else
			this._invisible(eleName);
	},
	
	displayOnValue: function(eleName, matchVal, checkVal)
	{
		if(matchVal == checkVal)
			this._show(eleName);
		else
			this._hide(eleName);
	},
	
	toggleOnValueInline: function(eleName, eleName2, matchVal, checkVal)
	{
		if(matchVal == checkVal)
		{
			this._hide(eleName);
			this._show_inline(eleName2);
		}
		else
		{
			this._show_inline(eleName);
			this._hide(eleName2);
		}
	},
	
	hideOnValue: function(eleName, matchVal, checkVal)
	{
		if(matchVal == checkVal)
		{
			this._hide(eleName);
			if(this._$('subSearch'))
				this._hide('subSearch');
		}
		else
			this._show(eleName);
	},
	
	submitOnElementExcept: function(eleName)
	{
		if(document.activeElement.name == eleName)
			return false;
	},
	
	actionOnElement: function (eleName, action)
	{
		if(document.activeElement.name != eleName)
			return false;
		
		eval(action);
	},
	
	submitSubSearch: function()
	{
		this._show('subSearch');
		var s = this._$('subSearchId').value;
		var iframe = this._$('iframeSearchResultsId');
		iframe.src = '/hope/received-hope-from-user-search/search/' + s;	
	},
	
	selectSubSearch: function(id, val)
	{
		var eleName = 'subSearchSelected';
		this._visible('subSearchSelectedDivId');
		this.populateElementWithValue(eleName + 'Id', id);
		this.populateElementWithValue(eleName + 'NameId', val);
	},
	clearSubSearch: function()
	{
		this._invisible('subSearchSelectedDivId');
		this._hide('subSearch');
		this.populateElementWithValue('subSearchSelectedId', '');
	},
	checkMyBox: function(ele)
	{
		this._$(ele).checked = "CHECKED";
	},
	
	populateElementWithValue: function(eleName, val)
	{
		this._$(eleName).value = val;
	}
}