var	host=document.location.host+"/web";

addStat=function(action,value){
	jQuery.ajax({
		    url: "http://"+host+"/inc/indicator/IndicatorClient.php?mode=web&act=visit_"+action+value,
			method: "get"  
		});
};
addTrialError=function(action){
	jQuery.ajax({
		    url: "http://"+host+"/inc/indicator/IndicatorClient.php?mode=web&act=trial_error_"+action,
			method: "get"  
		});
};
addStatAlone=function(action){
	jQuery.ajax({
		    url: "http://"+host+"/inc/indicator/IndicatorClient.php?mode=web&act="+action,
			method: "get"  
		});
};
addStatHref=function(action,href){
	jQuery.ajax({
		    url: "http://"+host+"/inc/indicator/IndicatorClient.php?mode=web&act="+action,
			method: "get",
			success: function(){
				document.location='"'+href+'"';
			}		
		});
	
};
getPage=function(){
	path=document.location.pathname;
	path=path.substring(path.indexOf('/')+1,path.lenght);
	path=path.substring(path.indexOf('/')+1,path.lenght);
	path=path.substring(path.indexOf('/')+1,path.lenght);
	path=path.split('/');
	path=path.join('_');
	path=path.substring(0,path.lastIndexOf('.'));
	return path;
};

$(document).ready(function(){

	path=getPage();
	value='';
	
	if(path==''){
		path='index';
	}
	if(!document.referrer.match('/'+document.location.host+'/')&&document.referrer!=''){
		value='&val='+encodeURI(document.referrer);
	}
	addStat(path,value);
	


	
	
});


