// apricot.js / Tit Petric / Monotek d.o.o.

var apricot = {
	keys: [],
	time: 0,
	start: function(ts) {
		this.time = ts;
	},
	add: function(key,val1,val2,val3,val4) {
		if (key) {
			this.keys[this.keys.length] = key;
		}
		if (val1) { this.keys[this.keys.length] = val1; }
		if (val2) { this.keys[this.keys.length] = val2; }
		if (val3) { this.keys[this.keys.length] = val3; }
		if (val4) { this.keys[this.keys.length] = val4; }
	},
	save: function(id) {
		if (this.keys.length<=0) {
			return;
		}
		var path = "http://img.rtvslo.si/_stats/" + this.time + "/" + this.keys.join("/");

		var ie = /*@cc_on!@*/0;
		if (!ie && document.getElementsByTagName && (document.createElementNS || document.createElement))
		{
			var tag = (document.createElementNS) ? document.createElementNS('http://www.w3.org/1999/xhtml', 'script') : document.createElement('script');
			tag.type = 'text/javascript';
			tag.src = path;
			document.getElementsByTagName('head')[0].appendChild(tag);
		}
		else if (document.write)
		{
			document.write('<' + 'script type="text/javascript" src="' + path + '"><' + '/script>');
		};
	}
}
