function Get_Cookie(name) {
	var start = document.cookie.indexOf(name+"=");
	var len = start+name.length+1;
	if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
	if (start == -1) return null;
	var end = document.cookie.indexOf(";",len);
	if (end == -1) end = document.cookie.length;
	return unescape(document.cookie.substring(len,end));
}

function Get_URL(name) {
	var documentlocation = new String(document.location);
	var start = documentlocation.indexOf(name+"=");
	var len = start+name.length+1;
	if ((!start) && (name != documentlocation.substring(0,name.length))) return null;
	if (start == -1) return null;
	var end = documentlocation.indexOf(";",len);
	if (end == -1) end = documentlocation.length;
	return unescape(documentlocation.substring(len,end));
}

var urldata = new Number(Get_URL("utm_id"));
if(urldata && urldata > 0) {
	var expdate = new Date ();
	expdate.setTime (expdate.getTime() + (1000 * 60 * 60 * 24 * 31));
	document.cookie = "refcode=PROMO " + urldata + "; path=/; expires=" + expdate;
}

var cookiedata = new Number(Get_Cookie("refcode"));
if(cookiedata && cookiedata > 0)
	if(cookiedata > 50000)
		document.write("<script src='/includes/scripts/promos/" + cookiedata + ".js' language='javascript' type='text/javascript'></script>");