jQuery(document).ready(function(){
	//handles ( eg. nav1.jpg => nav1_on.jpg )
	var OverHandle = "_over";
	var ActiveHandle = "_active";

	//preloading
	jQuery('.rollover, #mainmenu ul li a > img').each(function(){
		//grab file extension
		var ext = "." + this.src.substr(this.src.length-3,3);

		//preload image
		jQuery(this).preload({
			find: ext,
			replace: OverHandle+ext
		});

		//add hover event
		jQuery(this).hover(function(){
			this.src = this.src.replace(ext,OverHandle+ext);
		},function(){
			this.src = this.src.replace(OverHandle,"");
		});

	});

	jQuery('.SelectedTab a > img:first-child','#mainmenu').each(function(){
		//grab file extension
		var ext = "." + this.src.substr(this.src.length-3,3);
		this.src = this.src.replace(ext,ActiveHandle+ext);
		
		jQuery(this).unbind().hover(function(){
			this.src = this.src.replace(ActiveHandle,OverHandle);
		},function(){
			this.src = this.src.replace(OverHandle,ActiveHandle);
		});
		
	});

	// gets rid of focus box on click
	jQuery("a").focus(function(){
		this.blur();
	});

	/*scrollbar */
/*	jQuery('#scroll').jScrollPane({showArrows:true});
	
	
	jQuery("input[min_icon='/images/minus.gif']").click(function(){
		jQuery('#scroll').jScrollPane({showArrows:true});	
	});
*/


		jQuery('#slideshow').cycle({
			fx:     'fade',
			speed:  'slow',
			timeout: 5000,
			pager:  '#imgNav',
			before: function() {  },
			after: onAfter,
         nowrap:	false,
			pause:	1
		});
});


function onAfter() {
    jQuery('#output').html('<p>' + this.alt + '</p>');
}