function AllegroCatcher(){}

AllegroCatcher.prototype = {
	do_catch: function(){
		this.request = null;
		this.referrer = document.referrer;
		
		if(this.referrer.indexOf("allegromusique") == -1 || this.referrer.indexOf("192.168.30.11") == -1){
		
			if (document.referrer && document.referrer != ""){
			
				this.url = "prendre.php?variable=" + this.referrer;
				
				try{
					this.request = new XMLHttpRequest();
				}catch(exception){
					this.request = new ActiveXObject("Microsoft.XMLHTTP");
				}
				this.request.open("GET", this.url, true);
				
				var current = this;
				this.request.onreadystatechange= function(){
					if (current.request.readyState == 4){
						if (current.request.status == 200){
							if (current.request.responseText != ''){
								window.location.href = current.request.responseText;
							}
						}
					}
				}
				this.request.send(null);
				
			}
		}	
	}
}

AllegroCatcher.prototype.constructor = AllegroCatcher;

var ac = new AllegroCatcher();
ac.do_catch();