// set_bookmark() sets the bookmark to the current page.  This is should be called from body.onload()

function set_bookmark ()
{
	var bookmark;
	var body_class;
	
	// if the body has the NO_BOOKMARK class, then don't set a bookmark

	body_class = document.body.getAttribute("class");
	if (body_class == null) body_class = document.body.getAttribute("className"); // i hate ie
	
	if (!body_class || body_class.indexOf("NO_BOOKMARK") != -1) return;
 
 	// create Cookie object
 
	bookmark = new Cookie(document, "artic_bookmark");	

	// set the bookmark to the current url

	bookmark.url = window.location.href;
	
//	alert("set_bookmark()" + bookmark.url);

	// store it

	bookmark.store();
}

// goto_bookmark(a) jumps to the current bookmark, if set.  If the bookmark is not set, then it tries to goto the
// url of the anchor element a.  Typical usage in HTML would look like:

// <a onclick="goto_bookmark(this); return false;" href="default.html">Back</a>

function goto_bookmark (a)
{
	var bookmark;
	var url = "";

 	// create Cookie object

	bookmark = new Cookie(document, "artic_bookmark");

	// try to read the cookie and the cookie value

	if (bookmark.load() && bookmark.url) {
		url = bookmark.url;                  // use the url from the cookie
	} else {
		if (a) url = a.getAttribute("href"); // use the href from the anchor, if passed in
	}

//	alert("goto_bookmark() " + url);

	// goto the new url if it has been set

	if (url != "") window.location.href = url;
}

