// constants
var RECEIVER = APP_ROOT + 'ajax/receiver.aspx';

// write ajax content from the specified control name to the element of specified id
function writeAjaxContent(controlName, id, classToRemoveOnLoad, additionalQuerystringInfo)
{
	var url = getAjaxUrl(controlName);
	if(typeof(additionalQuerystringInfo) != 'undefined')
		url += '&' + additionalQuerystringInfo
	
	$.get(url, function(data){
		var jq = $('#' + id);
		if(jq.html(data).hasClass(classToRemoveOnLoad)){
			jq.removeClass(classToRemoveOnLoad);
		}
	});
}

// execute an ajax command and return the output
function executeAjaxCommand(commandName)
{
	var url = getAjaxCommandUrl(commandName);
	
	$.get(url, function(data){
		return data;
	});
}

// get the ajax url for the specified command name
function getAjaxCommandUrl(commandName)
{
	return RECEIVER + '?cmd=' + commandName;
}

// get the ajax url for the specified control
function getAjaxUrl(controlName)
{
	return RECEIVER + '?controlName=TVAjax' + controlName;
}
