(function() {
	if (window['MOTRAC'])
		return;
		
	var ns = window['MOTRAC'] = {};
	
	// extend object
	function _extend(src, target) {
		for (var key in src) {
			target[key] = src[key];
		}
		return target;
	}
	
	var _track_url = 'track.gif';
	ns.trace = function(info) {
		info = _extend(info, {
			href: '',
			title: '',
			category: '',
			action: ''
		});
		
		if (!info.href && !info.title && !info.category && !info.action) {
			return;
		}
		
		var image = new Image();
		image.src = _track_url + '?r=' + Math.random() 
			+ '&d=' + encodeURIComponent(document.location.host)
			+ '&c=' + encodeURIComponent(info.category)
			+ '&a=' + encodeURIComponent(info.action)
			+ '&u=' + encodeURIComponent(info.href) 
			+ '&t=' + encodeURIComponent(info.title);
	};
})();
