vnt_list_url = "http://uwdoko.s21.xrea.com/xmas/list.php?";
docname = document.URL;
if(docname.substr(docname.length - 7) == "-0.html"){
	setCookie("uwddocref", document.referrer);
}
if(docname.substr(docname.length - 7) == "-1.html"){
	setCookie("uwddocref", document.referrer);
}

function setCookie(key, val)
{
	var dtExpire = new Date();
	dtExpire.setTime(dtExpire.getTime() + 3600000);
	document.cookie = key + "=" + val + "; expires=" + dtExpire.toGMTString() + "; path=/";
}
function getCookie(key,  tmp1, tmp2, xx1, xx2, xx3) {
	tmp1 = " " + document.cookie + ";";
	xx1 = xx2 = 0;
	len = tmp1.length;
	while (xx1 < len) {
		xx2 = tmp1.indexOf(";", xx1);
		tmp2 = tmp1.substring(xx1 + 1, xx2);
		xx3 = tmp2.indexOf("=");
		if (tmp2.substring(0, xx3) == key) {
			return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
		}
		xx1 = xx2 + 1;
	}
	return("");
}

function returntolist() {

	if(getCookie('uwddocref') == vnt_list_url){
		location.href= vnt_list_url;
	} else {
		location.href= '../doclist.php?' + getCookie('uwddoclist');
	}
}
