// TEST
jQuery(document).ready(
function(){
	jQuery('#homepagePhotoSlideshow ul').innerfade({
		speed: 2000,
		timeout: 5000,
		type: 'sequence'
	});
});

jQuery(document).ready(
	function(){
		if(jQuery('#myGallery').length > 0){
			startGallery();
		}
	}
);

/**** REL = EXTERNAL ***/
addLoadEvent(function() {
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank"; 
		}
	} 
})
/**** NAV MENU DROPDOWNS ***/
addLoadEvent(function() {
	var navLIs = document.getElementById("navWrap").getElementsByTagName("LI");
	for (var i=0; i<navLIs.length; i++) {
		navLIs[i].onmouseover = function() {
			if (this.className.match("parent") != null) {
				this.className += " both";
			} 
			this.className += " active";
		}
		navLIs[i].onmouseout = function() {
			this.className = this.className.replace(/active/g,"");
			this.className = this.className.replace(/both/g,"");
		}
	}
})

function startGallery(){
	var myGallery = new gallery($('myGallery'), {
		thumbCloseCarousel:false,
		timed: true,
		delay: 5000
	});
	myGallery.showCarousel();
}