$(document).ready(function(){

/*	iterate over the top level navs
 *	and swap the nav text with images
 *	also add click event to show subnav
 */
	$('ul.nav-toplevel>li').each(
		function(){

			var r = $('a:first', this).attr('rel');
			$('a:first', this)
			.html('<img src="img/btn-'+r+'.gif" alt="'+r+'" />')
			.mouseover(function(){
			
			//don't do anything if this is already active
			if($(this).siblings('ul.sub-active').length==1 || $(this).parent(':first').is('#current')) return;
				$('.sub-active').hide('slow').removeClass('sub-active');
				$(this).siblings('ul')
				.show('slow')
				.addClass('sub-active');
				
				//if($(this).siblings('ul').length == 0) return true;
			});
		}
	);
	
/*	for h1s with an ID, swap out the h1 text 
 *	with an image
 */
	$('h1[id], h2[id]').each(
		function(){
			var i = $(this).attr('id');
			var t = $(this).text();
			$(this).html('<img src="img/txt-'+i+'.gif" alt="'+t+'" />');
		}
	);
	
/*	hide all subnavs except current
 */
	$('div#nav-main ul ul').addClass('hidden');
	$('li#current>ul').show('slow');
/* start slideshow */
$.slideshow({
		container : 'quote',
		loader: 'img/loader.gif',
		linksPosition: 'top',
		linksClass: 'pagelinks',
		fadeDuration : 400,
		activeLinkClass: 'activeSlide',
		nextslideClass: 'nextSlide',
		prevslideClass: 'prevSlide',
		captionPosition: 'bottom',
		captionClass: 'slideCaption',
		autoplay: 8
	}
)
	$('form').submit(function(){
		alert('Invalid Password');
		return false;
	});
});