<html>
<head>
<title>Cookies for Last Course Used</title>
<script>
var ourck=location.search.split('ck=')[1] ? location.search.split('ck=')[1].split('&')[0] : '';
var ourpp=location.search.split('pp=')[1] ? location.search.split('pp=')[1].split('&')[0] : '';
var ourpn=location.search.split('pn=')[1] ? location.search.split('pn=')[1].split('&')[0] : '';
var ourpage=location.search.split('page_id=')[1] ? location.search.split('page_id=')[1].split('&')[0] : '';
var ourp=location.search.split('p=')[1] ? location.search.split('p=')[1].split('&')[0] : '';
var ourcourseurl='';
var ourcoursetitle='';
var rtitle='';

function myInit() {
var j;
var myNow = new Date();
var yourLastUrl = myCookieValue("lastcourse", 0, "");
var ourl = ourcourseurl;
var yourExpireDate = new Date();

yourExpireDate.setMonth(yourExpireDate.getMonth() + 6);

ourcourseurl = decodeURIComponent(window.top.document.URL);

var ourcbits = ourcourseurl.split("#");
var preourccbits = ourcbits[0].split("&backto=");
var ourccbits = preourccbits[0].split("&title=");
if (ourccbits.length > 1) ourcoursetitle = ourccbits[ourccbits.length - 1].replace(/~~/g, "#~").replace(/~/g, " ").replace(/_/g, " ");
var bits = "";

if (ourcoursetitle != "") {
if ((ourpp != "" || ourpn != "") && ourpp != ourp && ourpn != ourp) {
//alert("z " + document.URL + " ourpp=" + ourpp + " ourpn=" + ourpn + "ourp=" + ourp + " " + ourcoursetitle);
bits = "lastcourse=" + encodeURIComponent(window.top.document.URL) + ";expires=" + yourExpireDate.toGMTString();
myCookieValue("lastcourse", 1, bits);
yourLastUrl = "";
} else {
//alert("zz " + document.URL + " ourpp=" + ourpp + " ourpn=" + ourpn + "ourp=" + ourp + " " + ourcoursetitle);
bits = "lastcourse=" + encodeURIComponent(window.top.document.URL) + ";expires=" + yourExpireDate.toGMTString();
}
} else if ((ourpp != "" || ourpn != "") && ourpp != ourp && ourpn != ourp) {
//alert("y " + ourcoursetitle);
bits = "lastcourse=" + encodeURIComponent(window.top.document.URL + "&title=" + window.top.document.title) + ";expires=" + yourExpireDate.toGMTString();
ourcoursetitle = decodeURIComponent(window.top.document.title);
myCookieValue("lastcourse", 1, bits);
yourLastUrl = "";
}

if (yourLastUrl != "") {
//alert("m " + yourLastUrl);
var lipar=window.top.document.getElementsByClassName("page_item page-item-10014");
var liparcontent=window.top.document.getElementById("content");
if (lipar != null) {
if (lipar.length >= 1) {
//lipar[0].innerHTML = lipar[0].innerHTML.replace("href", " onmouseover='actCourseOnHover();' id='aicourse' href");
//alert("b " + "<a target='_blank' title='" + window.top.document.title + "' href='" + encodeURIComponent(ourl) + "'>Last</a>&nbsp;<br>" + lipar[0].innerHTML);
if (lipar[0].innerHTML.indexOf(">Last") == -1) {
if (rtitle != "") lipar[0].innerHTML = "<span><a target='_blank' title='" + decodeURIComponent(rtitle) + "' href='" + decodeURIComponent(ourl).replace("PHP/coursecookies.html", "wordpress/") + "'>Last</a>&nbsp;" + lipar[0].innerHTML.replace("title", " style='margin-top:-30px;' title") + "</span>";
if (rtitle == "") lipar[0].innerHTML = "<span><a target='_blank' title='" + decodeURIComponent(ourcoursetitle) + "' href='" + decodeURIComponent(ourl).replace("PHP/coursecookies.html", "wordpress/") + "'>Last</a>&nbsp;" + lipar[0].innerHTML.replace("title", " style='margin-top:-30px;' title") + "</span>";
lipar=window.top.document.getElementsByClassName("page_item page-item-10014");
liparcontent=window.top.document.getElementById("content");
if (lipar[0].innerHTML.indexOf("-30") == -1) {
lipar[0].innerHTML=lipar[0].innerHTML.replace(">Course<", " style='margin-top:-30px;'>Course<");
}
if (liparcontent != null) liparcontent.style.marginTop = "-50px";
}
}
}
}
}

function myCookieValue(myCkieName, zeroRead, writeBit) {
var i, cans="", j=-1, accum="", delim="", pth="";
var myCookie = document.cookie.split("; ");
pth = myCookie.length;

for (i=0; i<myCookie.length; i++) {
if (myCkieName == myCookie[i].split("=")[0]) {
j = i;
cans = myCookie[i].split("=")[1];
ourcourseurl = decodeURIComponent(cans);
var ourcbits = ourcourseurl.split("#");
var ourpreccbits = ourcbits[0].split("&backto=");
var ourccbits = ourpreccbits[0].split("&title=");
if (ourccbits.length > 1) {
ourcoursetitle = ourccbits[ourccbits.length - 1].replace(/~~/g, "#~").replace(/~/g, " ").replace(/_/g, " ");
rtitle = ourcoursetitle;
}
if (1 == 2) {
accum = writeBit + delim + accum;
} else if (zeroRead == 0) {
accum = accum + delim + myCookie[i];

} else {
accum = accum + delim + writeBit;
}
writeBit = "";
pth = pth + " TO " + i + ":" + accum.length + " ";
} else {
accum = accum + delim + myCookie[i];
pth = pth + " to " + i + ":" + accum.length + " ";
}
if (accum != "") delim = "; ";
}
if (zeroRead != 0 && accum != "" && (document.URL.indexOf("#content") == -1 && document.URL.indexOf("content=") == -1)) document.cookie = 'lastcourse=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
cans = accum + delim + writeBit;
if (zeroRead != 0) {
var yourExpireDate = new Date();

yourExpireDate.setMonth(yourExpireDate.getMonth() + 6);


if ((document.URL.indexOf("#content") == -1 && document.URL.indexOf("content=") == -1)) document.cookie = cans;
var lipar=window.top.document.getElementsByClassName("page_item page-item-10014");
var liparcontent=window.top.document.getElementById("content");
if (lipar != null) {
if (lipar.length >= 1) {
//lipar[0].innerHTML = lipar[0].innerHTML.replace("href", " onmouseover='actCourseOnHover();' id='aicourse' href");
//alert("a " + "<a target='_blank' title='" + ourcoursetitle + "' href='" + encodeURIComponent(window.top.document.URL) + "'>Last</a>&nbsp;<br>" + lipar[0].innerHTML);
if (lipar[0].innerHTML.indexOf(">Last") == -1) {
lipar[0].innerHTML = "<span><a target='_blank' title='" + decodeURIComponent(ourcoursetitle) + "' href='" + decodeURIComponent(window.top.document.URL).replace("PHP/coursecookies.html", "wordpress/") + "'>Last</a>&nbsp;" + lipar[0].innerHTML.replace("title", " style='margin-top:-30px;' title") + "</span>";
lipar=window.top.document.getElementsByClassName("page_item page-item-10014");
liparcontent=window.top.document.getElementById("content");
if (lipar[0].innerHTML.indexOf("-30") == -1) {
lipar[0].innerHTML=lipar[0].innerHTML.replace(">Course<", " style='margin-top:-30px;'>Course<");
}
if (liparcontent != null) liparcontent.style.marginTop = "-50px";
}
}
}
}
ourcoursetitle = "";
return cans;
}

</script>
</head>

<body onload="if (document.URL.indexOf('#content') == -1 && document.URL.indexOf('content=') == -1) { myInit(); }">
<ul style="display:none;">
<li class="page_item page-item-10014"><a href="#" title='huh'>huh</a></li>
</ul>
</body>
</html>