/* 0.9.4 */
if(typeof tsedge == "undefined"){
	var tsedge = {};
	tsedge.instr = {
		PL_GO_IMG: "/careerscp/!crd_prm!.!cm",
		onLoadEventAttached: false,
		prmSent: false,
		random: Math.floor(Math.random() * 1000000),
		pagestart_ts : new Date().getTime(),
		pageend_ts: 0,
		counter: 0.00,


		bind: function(fct, context){ //allow execution of a function controlling it's context
			if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
			return function() {
			  return fct.apply(context);
			}
		},
		getCounter: function(){
			return (this.counter.toString().indexOf(".") >= 0) ? this.counter.toString() : this.counter.toString() + '.00';
		},
		getResourceURL: function(){
			var rxp = new RegExp("http[s]?://([^/]*)");
			return (rxp.exec(this.PL_GO_IMG)) ? this.PL_GO_IMG : rxp.exec(window.location)[0] + ((this.PL_GO_IMG.indexOf("/") > 0 || this.PL_GO_IMG.indexOf("/") == -1) ? "/" : "") + this.PL_GO_IMG;
		},

		sendPageRenderMarker: function(){
			if(!this.prmSent){
				this.pageend_ts = new Date().getTime();
				this.counter += 0.01;

				var markerURL = [];
				markerURL.push(tsedge.instr.getResourceURL());
				markerURL.push("?crd_rnd=");markerURL.push(this.random); //random unique page id
				markerURL.push("&crd_cnt=");markerURL.push(this.getCounter()); //counter
				if(this.pageend_ts > 0) {
					markerURL.push("&crd_tpb=");markerURL.push(this.pagestart_ts); //page start timestamp
					markerURL.push("&crd_olt=");markerURL.push(this.pageend_ts - this.pagestart_ts); //page load time
				}

				var markerImg = new Image();
				markerImg.src = markerURL.join("");
				this.prmSent = true;
			}
		},

		attachOnLoadPageRenderMarker: function(){
			if(this.onLoadEventAttached) { return; } //attach only once
			try{
				this._sendPageRenderMarker = tsedge.instr.bind(tsedge.instr.sendPageRenderMarker, this);
				if(window.attachEvent){ //IE
					window.attachEvent("onload", this._sendPageRenderMarker );
				}else
				if( window.addEventListener){ //FF, Opera, Safari...
					window.addEventListener("load", this._sendPageRenderMarker , false);
				}else
				if( document.addEventListener){ //FF, Opera, Safari... when window is not set
					document.addEventListener("load", this._sendPageRenderMarker , false);
				}
				this.onLoadEventAttached = true;
			}catch(e){ }
		}
	};
	tsedge.instr.attachOnLoadPageRenderMarker();
}

