function debug(e) {
	if(console)console.warn(e);
}
function wl_XMLHttp() {
	this.xmlhttp = false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	 try {
	  this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try { this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { this.xmlhttp = false; }
	 }
	@end @*/
	if (!this.xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try { this.xmlhttp = new XMLHttpRequest(); } catch (e) { debug(e);this.xmlhttp=false; }
	}
	if (!this.xmlhttp && window.createRequest) {
		try { this.xmlhttp = window.createRequest(); } catch (e) { debug(e);this.xmlhttp=false; }
	}
}


function wl_WorldLogger(hash, params) {
	this.getVars = function() {
		return {hash:this.wl_hash, referrer:document.referrer, page:window.location};	
	}
	
	
	
	this.getVarString = function() {
		var var_string = "";
		var vars = this.getVars();
		var first = true;
		for(var key in vars) {
			if(first) var_string += "?";
			else var_string += "&";
			first =  false;
			var_string += key + "=" + escape(vars[key]);
		}
		return var_string;
	}
	
	// constructor
	this.wl_hash = hash;
	var ping_location = params && params.ping_location ? params.ping_location : "http://ping.worldlogger.com/ping";
	ping_location += this.getVarString();
	this.xmlhttp = new wl_XMLHttp();
	
	this.xmlhttp.xmlhttp.open("GET", ping_location, false);
	this.xmlhttp.xmlhttp.send(null);
	
}



