function printfire() {
   if (document.createEvent)                     // Test if can create events
   {
      printfire.args =  arguments;               // Copy function args to obj
      var ev = document.createEvent("Events");   // Create browser event obj
      ev.initEvent("printfire", false, true );   // Init the event
      dispatchEvent( ev);                        // Trigger the event
   }
}
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

var mouseovers = {
	'a img.mo' : function (el) {
		el.onmouseover = function () {
			this.src = this.src.replace("_off","_over");
		}
		el.onmouseout = function () {
			this.src = this.src.replace("_over","_off");
		}
	},
	'.mo img' : function (el) {
		el.onmouseover = function () {
			this.src = this.src.replace("_off","_over");
		}
		el.onmouseout = function () {
			this.src = this.src.replace("_over","_off");
		}
	}
}
Behaviour.register(mouseovers);

var selectedLinks = {
	'li.current_page_item' : function (el) {
		var content = "";
		var nodes = el.childNodes;
		for(i=0;i<nodes.length;i++) {
			if (i == 0) {
				printfire (i + ": " + nodes[i].innerHTML);
				content += "<b class=\"selectedPage\">"+nodes[i].innerHTML+"</b>";
			} else if (typeof nodes[i].tagName != "undefined"){
				printfire (i + ": " + nodes[i].tagName);
				content += "<"+nodes[i].tagName+">"+nodes[i].innerHTML+"</"+nodes[i].tagName+">";
			}
		}
		el.innerHTML = content;
	}
}
Behaviour.register(selectedLinks);


	function getHTML(divId, url)
	{
		var myAjax = new Ajax.Updater( divId, url, { method: 'get', onFailure: reportError, evalScripts: true });
	}

	function reportError(request)
	{
		alert('Sorry. There was an error.');
	}
	
	function swapit(hide, show) {
		$(hide).style.display = "none";
		$(show).style.display = "block";
	}