var XHRCreator = {
    // List of functions to try when creating a XHR.
    // Order is important, these are ranked from preferred mechanism
    // to least preferred.
    _factories: [function() { return new XMLHttpRequest(); },
        function() { return new ActiveXObject("Msxml2.XMLHTTP"); },
        function() { return new ActiveXObject("Microsoft.XMLHTTP"); }
    ],
    
    // Used to track which function to use when creating a new XHR.
    _factory: null,
    
    // Creates an XHR referencing the 'right' logic.
    CreateRequest: function() {
        var retval = null;
        if (this._factory == null) {
            for (var i = 0; i < this._factories.length; ++i) {
                try {
                    retval = this._factories[i]();
                    if (retval != null) {
                        this._factory = this._factories[i];
                        break;
                    }
                } catch (e) {
                    continue;
                }
            }
        }

        if (retval == null) {
            retval = this._factory();
        }
        return retval;
    }
};
	
function dolog(which){
	var formName = which.name;
	var formValue = which.value;
	
	var xhr = XHRCreator.CreateRequest();
        
	if (xhr != undefined) {
	    xhr.open("GET", "/scripts/DoLog.ashx?formName=" + formName + "&formValue=" + formValue + "&page=" + window.location.href);
		xhr.send(null);
	}
}
