
function c4j_a_tracker() {
	this.u_cookie = "_c4j_track_u";
	this.v_cookie = "_c4j_track_v";
	this.s_cookie = "_c4j_track_s";
	//this.l_cookie = "_c4j_track_l";
	
	this.get_uid = function() {
		var uid = "";
		for (i = 0; i < 16; i++) uid += Math.round(Math.random() * 10);
		return uid;
	};
	this.g_c = function(name) {
		var dc = document.cookie;
		var cname = name + "=";
		if (dc.length > 0) {
			begin = dc.indexOf(cname);
			if (begin != -1) {
				begin += cname.length;
				end = dc.indexOf(";", begin);
				if (end == -1) end = dc.length;
				return unescape(dc.substring(begin, end));
			}
		}
		return null;
	};
	this.s_c = function(name, value) {
		//var today = new Date();
		//var expires = new Date(today.getTime() + (1 * 1000 * 60 * 60 * 24));
		document.cookie = name + "=" + escape(value) + ";path=/" + "; expires=;";// + expires.toGMTString();
	};
	this.d_c = function(name) {
		if (this.g_c(name))
			document.cookie = name + "=; expires=01-Jan-1970 00:00:01 GMT; path=/";
	};
	this.g_q_s = function(name) {
		hu = window.location.search.substring(1);
		gy = hu.split("&");
		for (i = 0; i < gy.length; i++) {
			ft = gy[i].split("=");
			if (ft[0] == name) {
				return ft[1];
			}
		}
		return null;
	};
	this.track = function(m) {
		var u = this.g_c(this.u_cookie);
		var v = this.g_c(this.v_cookie);
		var s = this.g_c(this.s_cookie);
		
		var l = escape(document.location);
		//var l = this.g_c(this.l_cookie);

		if (u == null || v == null)
			return;

		var p = "";

		p += '?u=' + u;
		p += '&v=' + v;
		if (s != null)
			p += '&s=' + s;
		p += '&l=' + l;

		document.write('<img src="http://www.check4jobs.com/tracker/c4j_a_t.gif' + p + '&m='+m+'" alt="" style="position:absolute;top:-1px;left:-1px;" />');

		//this.d_c(this.u_cookie);
		//this.d_c(this.v_cookie);
		//this.d_c(this.s_cookie);
		//this.d_c(this.l_cookie);
	};
	this.application = function(){
		this.track("a");
	}
	this.search = function(){
		this.track("s");
	};
	this.registration = function(){
		if(!this.g_c("r_c4j_45jkd3")){
			this.track("r");
			
			var today = new Date();
			var expires = new Date(today.getTime() + (1 * 1000 * 60 * 60 * 24 * 365));
			document.cookie = "r_c4j_45jkd3=1;path=/" + "; expires=;" + expires.toGMTString();
		}
	};
	this.init = function() {
		var isCheck4Jobs_user = this.g_q_s("source");
		if (isCheck4Jobs_user == "check4jobs" && this.g_c(this.u_cookie) == null) {
			var v = this.g_q_s("v");
			if (v == null)
				return;
			var s = this.g_q_s("s");
			var u = this.get_uid();
			

			this.s_c(this.u_cookie, u);
			this.s_c(this.v_cookie, v);
			//this.s_c(this.l_cookie, escape(l));
			if (s != null)
				this.s_c(this.s_cookie, s);
		}
	};
};
