function showEditOptions(elementId,isShow)
{	
	if (document.getElementsByTagName) {
		var anchors = $(elementId).getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++)
		{
			if (isShow) {
				if ( anchors[i].id.startsWith('editable'))
					anchors[i].style.display = "inline";
			} else {
				if ( anchors[i].id.startsWith('editable'))
					anchors[i].style.display = "none";
			}
		}
	}
}

function showTourEditingHelp() {
	alert("To edit your tours, move your mouse over your tour of interest and editing options will display.  Click the 'Edit' link next to the tour item you wish to edit." );
}

var parentDescriptionElement;
function showFullJourneyDescription(parentElement, journeyId)
{	
	parentDescriptionElement = parentElement
	new Ajax.Request(
		"ajaxGetCompleteJourneyDescription.do", 
		{
	 		onSuccess  : loadCompleteJourneyDescriptionSuccessful,
	 		onFailure  : loadCompleteJourneyDescriptionFailed,
			parameters : "journeyId=" + journeyId
		}
	);
}

function loadCompleteJourneyDescriptionSuccessful(xhrObject)
{
	if ( xhrObject.responseText.indexOf("fail") >= 0 || xhrObject.responseText.indexOf("success") < 0) {
		// Was really a failure on the server-side but HTTP request processed OK so this method was still called...
		loadCompleteJourneyDescriptionFailed(xhrObject);
	} else  {
		var index = xhrObject.responseText.indexOf("success:");
		$(parentDescriptionElement).innerHTML = xhrObject.responseText.substring(index+8,xhrObject.responseText.length);
	}
	parentDescriptionElement = null;
}
	
function loadCompleteJourneyDescriptionFailed(xhrObject)
{
	alert("An error occurred while loading the complete description for this journey.\n\n"
		  + "Please refresh your page and contact us if the problem persists.");
	  parentDescriptionElement = null;
}
