
function showResponse(request){
	showClientData();
	var newData = request;		
		if(newData.indexOf('<ERROR>')>-1){		
			var y=newData.indexOf('<ERROR>');
			var z=newData.indexOf('</ERROR>');
			var length=z-(y+7);
			alert_id=newData.substr(y+7,length);		
			show_ghost(alert_id);			
			return false;
		}
		else
		{
			window.location='index.php';	
		}
		
}

function post_form(myForm){
	showLoad();
	var url='include/ajax_requests/register.php';
	new Ajax(url,{postBody: $(myForm),  onComplete: showResponse}).request();	
}

function showLoad () {
	document.getElementById('loader').style.display="block";
}

function show_ghost(text){
	Growl.Bezel({
	title: '',
	text: text,
	duration: 4
	});
	return false;
}


function show_banner(banner_id){
	if(banner_id==''){
				return false;
	}
	var pars = 'id=' + banner_id;
	var url = 'include/ajax_requests/banners.php?'+pars;	
	showLoad();
	new Ajax(url, {
		method: 'get',
		evalScripts:true,
		update: $('banners'),
		onComplete: function(){ showClientData(); }		
	}).request();
	
}

function get_tab(tab_id){
	if(tab_id==''){
				return false;
	}
	var pars = 'id=' + tab_id;
	var url = 'include/ajax_requests/tabs.php?'+pars;	
	showLoad();
	new Ajax(url, {
		method: 'get',
		evalScripts:true,
		update: $('whole'),
		onComplete: function(){ showClientData(); }		
	}).request();
	
}

function showClientData(){
	document.getElementById('loader').style.display="none";	
}
