/** This is the implementation of our default geobase tracker.
 *  Use it's track() method to capture impressions and clickthroughs.
 *
 *  @author Stefan T.
 *  @copyright Godengo Inc.
 */
GeobaseTracker = Class.create({
	initialize: function (config) {
        this.config = config || {};
    	this.backendurl = this.config.backendurl || '/core/tracker.php';
	},

	/**
	 * performs a XHR to a server-sided tracking script for
	 * a given item and itemid
	 * @param itemid - the item's unique identifier, e.g. a listing id
	 * @param item - type of the entity that's being tracked, e.g. 'listing'
	 */
	track: function(itemid, item) {
		//params itemid and item are mandatory, if missing then
		//don't perform a tracking call
		if (!itemid || !item)
			return;
		var ajaxRequest = new Ajax.Request(this.backendurl, {
    		method:       'get',
    		parameters:   {	'url' : this.backendurl,
    						'item' : item,
    						'itemid' : itemid
						  },
    		asynchronous: true,
    		onComplete: function(transport){}
       });
	}
});
