$(document).ready(function() {
	// put all your jQuery goodness in here.
  $("a.change").click(function () {
    var MyTime = new Date()

    $(".container").each(function () {
      $(this).find("div.image").find("img").attr("src", "captcha/cap_image.asp?time=" + MyTime.getTime() + "")
    });

    return false;
  });

	// Open links in new window when rel="external" is applyed to a tag										 
	$('a[@rel$="external"]').click(function(){this.target="_blank";});	
	
 $("#navigation ul li:has(ul)").hover(function(){
 	$(this).children("ul").css("display", "block");
 }, function() {
 	$(this).children("ul").css("display", "none");
 });
 
	$('#slideshow') 
	.after('<div id="slideshow-nav">')
	.cycle({ 
		fx:     'fade', 
		speed:  'fast', 
		timeout: 4000, 
		pager:  '#slideshow-nav'
	});
			 // hide show clickable h2
			$("#side-content ol").hide();
			$("#side-content a.title").eq(0).addClass("active");
			$("#side-content ol").eq(0).show();
			$("#side-content a.title").click(function(){
				$(this).next("ol").slideToggle("fast")
				.siblings("ol:visible").slideUp("fast");
				$(this).toggleClass("active");
				$(this).siblings("a.title").removeClass("active");
			});
			
	$("span.mailto").each(function(){
	  exp = $(this).text().search(/\((.*?)\)/) != -1 ? new RegExp(/(.*?) \((.*?)\)/) : new RegExp(/.*/);
	  match = exp.exec($(this).text());
	  addr = match[1] ? match[1].replace(/ at /,"@").replace(/ dot /g,".") : match[0].replace(/ at /,"@").replace(/ dot /g,".");
	  link = match[2] ? match[2] : addr;
	  subject = $(this).attr('title') ? "?subject="+$(this).attr('title').replace(/ /g,"%20") : "";
    $(this).after('<a href="mailto:'+addr+subject+'">'+ link + '</a>');
	$(this).remove();
	})

});