loc = location.href
if (loc.search(/#/) != -1) { loc = loc.split("#"); loc = loc[0] }
if (loc.search(/set\.display\.htm/) != -1 || loc.search(/index\.shtml/) != -1 || loc.search(/partners\/$/) != -1) { loc = "./" }


ID = "0"; data = unescape(document.cookie); parts = data.split("; ");
len = parts.length; PtnrCnt = 0


for (a=0; a<len; a++) {
	if (parts[a].search(/partnerlink/) != -1) { ID = parts[a].split("="); ID = ID[1] }
}


if (ID > "") {
	document.write("<sty","le type=\"text/css\">\n.partner",ID," { background-color: #eeeeee; }\n<","/style>")
}


function PutPartnerAssign() {
	partner = prompt("Enter your partner ID: ",""); date = new Date()
	cdt = 1000 * 60 * 60 * 2; currentdate = date.getTime() + cdt; date.setTime(currentdate)

	document.cookie = "partnerlink=" + partner + "; expires=" + date.toGMTString() + "; path=/"

	cdt = 1000 * 60 * 60 * 24 * 365 * 5; currentdate = date.getTime() + cdt; date.setTime(currentdate)
	document.cookie = "partnerRet=" + partner + "; expires=" + date.toGMTString() + "; path=/"

	data = unescape(document.cookie)
	if (data.length == 0) {
		alert("Oops, cannot highlight your listings because you have\ncookies disabled.This feature requires that\nyou enable your cookies.")
		alert("We do not track anything with the\nparticular cookie that is required.")
	} else {
		location.replace(loc)
	}
}


function ClearAssign() {
	document.cookie = "partnerlink=ERASEGONE; expires=-1; path=/"; location.replace(loc)
}


function PermClearAssign() {
	document.cookie = "partnerlink=ERASEGONE; expires=-1; path=/"
	document.cookie = "partnerRet=ERASEGONE; expires=-1; path=/"
	document.cookie = "cancel=1; expires=-1; path=/"; location.replace(loc)
}


function ShowAssign() {
	data = unescape(document.cookie); parts = data.split("; "); len = parts.length

	for (a=0; a<len; a++) {
		if (parts[a].search(/partnerRet/) != -1) { ID = parts[a].split("="); ID = ID[1] }
	}

	date = new Date()
	cdt = 1000 * 60 * 60 * 2; currentdate = date.getTime() + cdt; date.setTime(currentdate)
	document.cookie = "partnerlink=" + ID + "; expires=" + date.toGMTString() + "; path=/"

	cdt = 1000 * 60 * 60 * 24 * 365 * 5; currentdate = date.getTime() + cdt;
	date.setTime(currentdate); document.cookie = "partnerRet=" + ID + "; expires=" +
	date.toGMTString() + "; path=/"

	data = unescape(document.cookie)
	if (data.length == 0) {
		alert("Oops, cannot highlight your listings because you have\ncookies disabled.This feature requires that\nyou enable your cookies.")
		alert("We do not track anything with the\nparticular cookie that is required.")
	} else {
		location.replace(loc)
	}
}


function ShowControls() {
	for (a=0; a<len; a++) {
		if (parts[a].search(/partnerRet/) != -1 && parts[a].search(/ERASEGONE/) == -1) {
			controls = "<p class=\"f8\">" +
			"<a href=\"javascript: ClearAssign()\">Remove Highlights</a> " +
			"| <a href=\"javascript: ShowAssign()\">See Highlights</a> " +
			"| <a href=\"javascript: PermClearAssign()\">Erase Partner Code</a> "
			document.write(controls)
		}
	}
}
