jQuery(function ($) {
	
	gogallery();	
	colorSwap();
	
});

function colorSwap() {
	jQuery('#colorswap li').hover(function() {
		jQuery('body').css({ backgroundColor : jQuery(this).text() });
	});
}

function gogallery() {
	if (document.getElementById("gallery")) {
		var lis = document.getElementById("gallerynav").getElementsByTagName("li");
	
		for(i=0;i<lis.length;i++) {
			var as = lis[i].getElementsByTagName("a");
			as[0].onclick = function() {
				document.getElementById("galleryphoto").setAttribute("src",this.href);	
				if (this.title) { document.getElementById("caption").childNodes[0].nodeValue = this.title; }
				else { document.getElementById("caption").childNodes[0].nodeValue = ""; }
				return false;
			}
		}
	}
}
