pageTracker._setCampForceManual = function (a) {
	__sfm = a
};
pageTracker._setCampValues = function (e, a, b, c, d) {
	if (__sfm || !__sfr) {
		if (e) {
			__s_n._setCampSource(e)
		}
		if (a) {
			__s_n._setCampMedium(a)
		}
		if (b) {
			__s_n._setCampName(b)
		}
		if (c) {
			__s_n._setCampTerm(c)
		}
		if (d) {
			__s_n._setCampContent(d)
		}
	}
	
	var _cz = new __s_ct(__src("__utmz"));
	if (__s_o.s != _cz.s) this._setLandingPage();
	
};
pageTracker._getCampValues = function () {
	var a = {
		sr: "source",
		cn: "name",
		md: "medium",
		ct: "content",
		tr: "term"
	};
	var b = unescape(__src("__utmz"));
	var c = {
		source: "",
		medium: "",
		name: "",
		term: "",
		content: ""
	};
	if (b != null) {
		b.replace(/utmc([a-z]{2})=([^\|]*)/g, function (e, d, f) {
			c[a[d]] = f
		})
	}
	return c
};
pageTracker._isLandingPage = function () {
    return __sfr;
}

function __ssc(b, c, d) {
	var a = new Date();
	a.setTime(a.getTime() + (((typeof(d) != "undefined") ? d : 3) * 24 * 60 * 60 * 1000));
	document.cookie = b + "=" + c + "; expires=" + a.toGMTString() + "; path=/;domain=.mansioncasino.com"
}
function __src(a) {
	var b = new RegExp(a + "=([^;]*)", "i");
	var c = document.cookie.match(b);
	return (c && c.length == 2) ? c[1] : null
}
var __sfm = false;
var __sfr = false;

function __s_ct(a) {
	this.v = unescape(a);
	this.sr = "(direct)";
	this.cn = "(direct)";
	this.cmd = "(none)";
	this.s = "utmcsr=" + this.sr + "|utmccn=" + this.cn + "|utmcmd=" + this.cmd;
	if (a != null) {
		this.s = a.replace(/^[0-9\.]*/, "");
		a.replace(/utmcsr=([^\|]*)\|utmccn=([^\|]*)\|utmcmd=([^|]*)/, function () {
			this.sr = arguments[1];
			this.cn = arguments[2];
			this.cmd = arguments[3]
		})
	}
}
__s_ct.prototype._setCampName = function (a) {
	this.v = this.v.replace(/utmccn=([^\|]*)/, "utmccn=" + a);
	this.sv()
};
__s_ct.prototype._setCampSource = function (a) {
	this.v = this.v.replace(/utmcsr=([^\|]*)/, "utmcsr=" + a);
	this.sv()
};
__s_ct.prototype._setCampMedium = function (a) {
	this.v = this.v.replace(/utmcmd=([^\|]*)/, "utmcmd=" + a);
	this.sv()
};
__s_ct.prototype._setCampTerm = function (a) {
	this.v = this.v.match(/utmctr=/) ? this.v.replace(/utmctr=([^\|]*)/, "utmctr=" + a) : this.v + "|utmctr=" + a;
	this.sv()
};
__s_ct.prototype._setCampContent = function (a) {
	this.v = this.v.match(/utmcct=/) ? this.v.replce(/utmcct=([^|]*)/, "utmcct=" + a) : this.v + "|utmcct=" + a;
	this.sv()
};
__s_ct.prototype.sv = function () {
	__ssc("__utmz", this.v, 182)
};
pageTracker._setLandingPage = function() {
	__sfr = true;
	if (typeof(_extga) != "undefined" && typeof(_extga.flp) != "undefined" && _extga.flp === true) {
		pageTracker._setCustomVar(1, "FLP", typeof(_extga.lp) != "undefined" ? _extga.lp : document.location.href.replace(/http[s]?:\/\/[^\/]*/, ""), 1);
	}
	
	if (typeof(_extga) != "undefined" && typeof(_extga.ufss) != "undefined" && _extga.ufss === true) {
		var upperfunnelsources = parseInt(pageTracker._getVisitorCustomVar(2), 10);
		if (isNaN(upperfunnelsources)) upperfunnelsources = 0;
		upperfunnelsources += 1;
		pageTracker._setCustomVar(2, "UFSS", upperfunnelsources, 1);
		// todo: store upper funnel in stats.mansioncasino.com
	}
/*	
	if (typeof(_extga) != "undefined" && typeof(_extga.tp) != "undefined" && _extga.tp === true) {
		var transitionpath = pageTracker._getVisitorCustomVar(3);
		transitionpath = (typeof(transitionpath) == "undefined") ? "" : unescape(transitionpath)+",";
		transitionpath += pageTracker._getCampValues().term;
		pageTracker._setCustomVar(3, "TP", transitionpath, 1);
	}

	if (typeof(_extga) != "undefined" && typeof(_extga.sp) != "undefined" && _extga.sp === true) {
		var values = pageTracker._getCampValues();
		var sourcepath = pageTracker._getVisitorCustomVar(4);
		sourcepath = (typeof(sourcepath) == "undefined") ? "" : unescape(sourcepath)+",";
		sourcepath += ((values.source != "(direct)") ? values.source+"-" : "")+values.medium;
		pageTracker._setCustomVar(4, "SP", sourcepath, 1);
	}
*/
};

var __s_o = new __s_ct(__src("__utmz"));
pageTracker._initData();
var __s_n = new __s_ct(__src("__utmz"));
if (__s_o.s != __s_n.s) {
	__sfr = true
	pageTracker._setLandingPage();
	__s_o = new __s_ct(__src("__utmz"));
}
/* Casino.com functions */
function _getAffiliateValues() {
        var a = __src("banner_click");
        var b = __src("banner_download");
        var c = {member:"", profile:""}
        if (a != null) a.replace(/([^,]*),[^,]*,([^,]*)/, function (d, e, f) {
                c.member = e;
                c.profile = f;
        });
        else if (b != null) b.replace(/([^,]*),[^,]*,([^,]*)/, function (d, e, f) {
                c.member = e;
                c.profile = f;
        });
        return c;
}

if (typeof(document.ignoregadb) == "undefined") {
	if (document.location.search.match(/(\&|\?)SID=[0-9]+/)) {
	        var source, medium, name, term;
	        source = document.referrer != "" ? document.referrer.replace(/^http[s]*:\/\/([^\/]*).*$/, "$1") : "(direct)";
	        medium = "media";
       	 	name = document.location.search.match(/(\&|\?)p=1/) ? "popunder" : "banner";
       	 	term = document.location.search.match(/(?:\&|\?)SID=([0-9]+)/)[1];
        	if (pageTracker._getCampValues().medium == "referral") pageTracker._setCampForceManual(true);
        	pageTracker._setCampValues(source, medium, name, term);
	} else {
	        var aff = _getAffiliateValues();
	        var v = pageTracker._getCampValues();
	        if (aff.member != "" && !aff.member.match(/(convertonet|default02)/i) && aff.member != v.source) { //} && v.medium.match(/(referral|affiliate)/i)) {
	                var source = document.referrer != "" ? document.referrer.replace(/^http[s]*:\/\/([^\/]*).*$/, "$1") : "(direct)";
	                if (v.medium == "referral") pageTracker._setCampForceManual(true);
	                pageTracker._setCampValues(source, "affiliate", aff.member, aff.profile);
	        }
	}
}
