	;(function($){
	     $.fn.extend({
	          center: function (options) {
	               var options =  $.extend({ // Default values
	                    inside:window, // element, center into window
	                    transition: 0, // millisecond, transition time
	                    minX:0, // pixel, minimum left element value
	                    minY:0, // pixel, minimum top element value
	                    withScrolling:true, // booleen, take care of the scrollbar (scrollTop)
	                    vertical:true, // booleen, center vertical
	                    horizontal:true // booleen, center horizontal
	               }, options);
	               return this.each(function() {
	                    var props = {position:'absolute'};
	                    if (options.vertical) {
	                         var top = ($(options.inside).height() - $(this).outerHeight()) / 2;
	                         if (options.withScrolling) top += $(options.inside).scrollTop() || 0;
	                         top = (top > options.minY ? top : options.minY);
	                         $.extend(props, {top: top+'px'});
	                    }
	                    if (options.horizontal) {
	                          var left = ($(options.inside).width() - $(this).outerWidth()) / 2;
	                          if (options.withScrolling) left += $(options.inside).scrollLeft() || 0;
	                          left = (left > options.minX ? left : options.minX);
	                          $.extend(props, {left: left+'px'});
	                    }
	                    if (options.transition > 0) $(this).animate(props, options.transition);
	                    else $(this).css(props);
	                    return $(this);
	               });
	          }
	     });
	})(jQuery);

	(function($) {
		  var cache = [];
		  // Arguments are image paths relative to the current page.
		  $.preLoadImages = function() {
		    var args_len = arguments.length;
		    for (var i = args_len; i--;) {
		      var cacheImage = document.createElement('img');
		      cacheImage.src = arguments[i];
		      cache.push(cacheImage);
		    }
		  }
		})(jQuery)

jQuery(document).ready(function(){
	jQuery("a[href$='.jpg'], a[href$='.png'], a[href$='.gif']").each(function(){
		jQuery.preLoadImages(jQuery(this).attr("href"));
	});
jQuery("a[href$='.jpg'] > img, a[href$='.png'] > img, a[href$='.gif'] > img").click(function(e){
		e.preventDefault();
		jQuery("#photo").remove();
		jQuery("<div id='photo' style='bottom: 0;left: 0;position: absolute;right: 0;top: 0;z-index: 9990;'><img style='display: none;' src='"+jQuery(this).parent("a").attr('href')+"' /></div><div id='pbg' style='position:fixed;top:0px;left:0px;right:0px;bottom:0px;background-color:black;display:none;'></div>").appendTo("body");
		jQuery("<div id='info' style='width:inherit;background-color:white;color:black;position:absolute;z-index:9991;'><div style='padding:5px;'></div></div>").appendTo("#photo");
		jQuery("<span id='close' style='background-color:white;font-family:Arial;cursor:pointer;color:black;position:absolute;top:5px;right:5px;padding:0px 4px;z-index:9992;'>x</span>").appendTo("#photo");
		jQuery('#pbg').fadeTo(0, 0.8);
		var wh = jQuery(window).height();
		var ih = jQuery("div#photo img").height();
		if(wh<=ih)
		{
			wh=wh-10;
			jQuery('#photo img').css("height", wh+"px");
		}
		var ww = jQuery(window).width();
		var iw = jQuery("div#photo img").width();
		if(ww<=iw)
		{
			ww=ww-10;
			jQuery('#photo img').css("width", ww+"px");
		}
		jQuery("div#photo").css("width", jQuery("div#photo img").css("width")).css("height", jQuery("div#photo img").css("height")).center();
		var t = jQuery("div#photo").css("top"); var l = jQuery("div#photo").css("left");
		jQuery("#info").css("right", "0px").css("bottom", "0px").css("left", "0px");
		var n = jQuery(this).parent("a").next("a[href$='.jpg'], a[href$='.png'], a[href$='.gif']").attr("href");
		var p = jQuery(this).parent("a").prev("a[href$='.jpg'], a[href$='.png'], a[href$='.gif']").attr("href");
		var na = (n==undefined)?"&nbsp;>":"&nbsp;<a class='pn' href='"+n+"'>></a>";
		var pa = (p==undefined)?"&nbsp;<&nbsp;|":"&nbsp;<a class='pn' href='"+p+"'><</a>&nbsp;|";
		jQuery("<div>"+pa+na+"&nbsp;&nbsp;&nbsp;"+jQuery(this).parent("a").attr('title')+"</div>").appendTo("div#info div");
		jQuery('#photo img').fadeTo(0, 1);
		jQuery('#info, #close').fadeTo(0, 0.6);
	});
jQuery("a.pn").live("click", function(e){
	e.preventDefault();
	jQuery("a[href='"+jQuery(this).attr("href")+"'] img").trigger("click");
});
	jQuery("span#close, div#pbg").live("click", function(){
		jQuery("div#photo").remove();
		jQuery("div#pbg").remove();
	});
	jQuery("div#photo").live("mouseenter", function(){
		if(jQuery("div#info").css("display")=='none')
		{
			jQuery("div#info").slideDown("slow", function(){
				jQuery("div#info").unbind();
			});
		}
	});
	jQuery("div#info, div#info *, div#photo").live("mousemove", function(){
			jQuery("div#info").slideDown("slow", function(){
				jQuery("div#info").unbind();
			});
	});
	jQuery("div#photo").live("mouseleave", function(){
		if(jQuery("div#info").css("display")!='none')
		{
			jQuery("div#info").slideUp("slow", function(){
				jQuery("div#info").unbind();
			});
		}
	});
});





jQuery("h2.menuheader").click(function(){
	if(jQuery(this).children("a").text()=='')
	{
		jQuery(this).next("div.menucontent").slideToggle("slow");			
	}
	jQuery(this).children("span").toggleClass("current");
});
jQuery("div.menucontent > ul > li.page_item span").click(function(){
	jQuery(this).next("ul").slideToggle("slow", function(){
		if(jQuery(this).css("display")=="block")
		{
			jQuery(this).prev("span").addClass("current");
		}
		else
		{
			jQuery(this).prev("span").removeClass("current");
		}
		jQuery("div.menucontent > ul > li.page_item > a.current").toggleClass("nocurrent");
	});
});

var current = jQuery(".current").parent().parent().parent().attr("class");
if(current)
{
	jQuery("div.menucontent").slideDown(0, function(){
		if(current=='page_item')
		{
			jQuery(".current").parent().parent().slideDown(0);
		}
	});
	if(current=="page_item")
	{
		jQuery(".current").parent().parent().prev("span").addClass("current");
		jQuery(".current").parent().parent().parent().parent().parent().prev("h2").children("span").addClass("current");			
	}
	else
	{
		jQuery(".current").parent().parent().parent().prev("h2").children("span").addClass("current");			
	}
}
