function loadNav () {
	var div = document.getElementById ("breadcrumbs");
	var pArray = document.location.pathname.split ("/");

	var a = document.createElement ("a");
	a.setAttribute ("href", "/");
	a.innerHTML = "home";
	div.appendChild (a);
	
	var dir = "";
	for (i=1; i < pArray.length; ++i)
	{
		dir += "/" + pArray[i];
		a = document.createElement ("a");
		a.setAttribute ("href", dir);
		if (pArray[i].search (".") != -1)	 {
			a.innerHTML = pArray[i].split (".")[0];
		} else {
			a.innerHTML = pArray[i];
		}
		if (pArray[i] != "") {
			div.appendChild (a);
		}
	}
	
	// grab menu object (ul)
	var menu = document.getElementById (pArray[1]);
	// add clone of menu object to page-menu div
	if (p = document.getElementById ("page-menu"))
		if (menu !== null)
			p.appendChild (menu.cloneNode (true));

}

if ($.cookie("css")) {
	$("link").attr("href",$.cookie("css"));
}
$(document).ready(function() { 
	loadNav();
	$("div.image a").fancyZoom ();
	$("a.style").click(function() {
		$("link").attr("href",$(this).attr('rel'));
		$.cookie("css",$(this).attr('rel'), {expires: 365, path: '/'});
		return false;
	});
});
