_isString = function(it){
	// summary:	Return true if it is a String.
	return (typeof it == "string" || it instanceof String);
}

function Connector(){
	this.req = null;
}

Connector.prototype.READY_STATE_UNINITIALIZED=0;
Connector.prototype.READY_STATE_LOADING=1;
Connector.prototype.READY_STATE_LOADED=2;
Connector.prototype.READY_STATE_INTERACTIVE=3;
Connector.prototype.READY_STATE_COMPLETE=4;

Connector.prototype.getXMLHTTPRequest = function() {
	var xRequest = null;
	if (window.XMLHttpRequest) {
		xRequest = new XMLHttpRequest();
	}else if (typeof ActiveXObject != "undefined"){
		xRequest = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xRequest;
}

Connector.prototype.send = function(location){
	this.req = this.getXMLHTTPRequest();
	if (this.req){
		this.req.open("GET",location,true);
		this.req.onreadystatechange = this.hitch(this, this.onReadyStateChange);
		this.req.setRequestHeader("Content-Type", "text/html");
		this.req.send(null);
	}
}

Connector.prototype.hitch = function(thisObject, method){
	var fcn = (_isString(method) ? thisObject[method] : method) || function(){};

	return function() {
		return fcn.apply(thisObject, arguments);
	};
}

Connector.prototype.submit = function(location, params){
	this.req = this.getXMLHTTPRequest();
	if (this.req){
		var query = this.queryStr(params);
		this.req.open("POST", location, true);
		this.req.onreadystatechange = this.hitch(this, this.onReadyStateChange);
		this.req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		this.req.setRequestHeader("Content-length", query.length);
		this.req.setRequestHeader("Connection", "close");
		this.req.send(query);
	}
}

Connector.prototype.onReadyStateChange = function(){
	var ready = this.req.readyState;
	var data = null;
	var status = "";
	if (ready == this.READY_STATE_COMPLETE){
		if (this.req.status == 200) {
		}
		else{
		}
	}
}

Connector.prototype.queryStr = function(params){
	listString = "";
	for (var word in params)
	    listString += word + "=" + params[word] + "&";
	return listString;
}

Connector.prototype.genUrl = function(location, query){
	if (location.indexOf("&") != -1)
		return location + query;
	else
		return location + "?" + query;
}

var connector = new Connector();
var params = {"url": location.href, "referrer": document.referrer};
connector.submit("/en-us/dailylog/page_view_record", params);