function fixURLTchegbeTableTags(url, configKey){
	if(url.indexOf("?") == -1)  url += '?';
	else if(url.lastIndexOf('&') != (url.length - 1)) url += '&';
	
	return (url + 'configKey=' + configKey + '&ajaxrand=' + Math.random());
}

function initTableTchegbeTableTags(url, configKey){
	var link = '';
	new Ajax.Request(fixURLTchegbeTableTags(url, configKey) + '&linkForAjaxTable=true', {
	  method: 'GET',
	  asynchronous: false,
	  onSuccess: function(transport) {
	  	link = transport.responseText;
	  }
	});
	
	updatePagingTchegbeTableTags(link, configKey);
	updateTableSelectionTchegbeTableTags(link, configKey);
	updateUserOptionsTchegbeTableTags(link, configKey);
	updateTableTchegbeTableTags(link, configKey);
}

function updateTableTchegbeTableTags(url, configKey){
	if(!isAjaxTableTchegbeTableTags(configKey)) return;
	
	new Ajax.Request(fixURLTchegbeTableTags(url, configKey) + '&component=table', {
	  method: 'GET',
	  onSuccess: function(transport) {
	  	document.getElementById(configKey + '_table').innerHTML = transport.responseText;
	  }
	});
}

function updateTablePostTchegbeTableTags(url, inPostBody, configKey){
	if(!isAjaxTableTchegbeTableTags(configKey)) return;

	new Ajax.Request(fixURLTchegbeTableTags(url, configKey) + '&component=table', {
	  method: 'POST',
	  postBody: inPostBody,
	  onSuccess: function(transport) {
	  	document.getElementById(configKey + '_table').innerHTML = transport.responseText;
	  }
	});
}

function updatePagingTchegbeTableTags(url, configKey){
	if(!isAjaxPagingTchegbeTableTags(configKey)) return;
	
	new Ajax.Request(fixURLTchegbeTableTags(url, configKey)  + '&component=paging', {
	  method: 'GET',
	  onSuccess: function(transport) {
	  	document.getElementById(configKey + '_paging').innerHTML = transport.responseText;
	  }
	});
}

function updateTableSelectionTchegbeTableTags(url, configKey){
	if(!isAjaxTableSelectionTchegbeTableTags(configKey)) return;
	
	new Ajax.Request(fixURLTchegbeTableTags(url, configKey) + '&component=tableSelection', {
	  method: 'GET',
	  onSuccess: function(transport) {
	  	document.getElementById(configKey + '_tableSelection').innerHTML = transport.responseText;
	  }
	});
}

function updateUserOptionsTchegbeTableTags(url, configKey){
	if(!isAjaxUserOptionsTchegbeTableTags(configKey)) return;
	
	new Ajax.Request(fixURLTchegbeTableTags(url, configKey) + '&component=userOptions', {
	  method: 'GET',
	  onSuccess: function(transport) {
	  	document.getElementById(configKey + '_userOptions').innerHTML = transport.responseText;
	  }
	});
}

function ajaxPagingTchegbeTableTags(configKey, url){
	updatePagingTchegbeTableTags(url, configKey);
	updateTableTchegbeTableTags(url, configKey);
	updateTableSelectionTchegbeTableTags(url, configKey);
}
