/**** tradiational javascript outside of ready() ****/





/**************** JQuery .ready() ******************/
$(function(){


	// manage home page slides
	// hide them all to begin with (the LI's with the images)
	$("#slidecarousel li").hide();
	
	// show just the first slide (as default)
	// should no longer be necessary as .tabs() will show it when initiated
	// $("#slidecarousel li:eq(0)").show();
	
	// determine the center position (left offset) of the controls
	// dynamic to allow any number of images & controls (max 10!!)
	var offset = (($("#controlWrap").width() - $("#slidecontrol").width()) / 2);
	$("#slidecontrol").css({
		'left':offset
	});
	
	// once the position has been determined, up the z-index [and .show()] to 
	// overlay the controls over the photo
	// this is done *after* positioning to avoid screen flicker
	// note: can not be display:none as the element is removed from the DOM (must be visibility:hidden)
	$("#controlWrap").css({
		'z-index':'3',
		'visibility':'visible'
	}).show();

	// highlight first button; 
	// should no longer be necessary as .tabs() will select it when initiated
	//	$("#slidecontrol li:eq(0) a").addClass('hover');

	// fire up the tabs (and define the slideshow params)
	$("#controlWrap ul").tabs("#slidecarousel li", {
    event:				'mouseover', 
    current:			'hover', 
		effect:				'fade',
		fadeOutSpeed:	100,
		fadeInSpeed:	300,
		rotate:				true
	}).slideshow({
		autoplay:			false,
		interval:			4000,
		clickable:		true
	});

	// fire up the slideshow
	//$("#controlWrap ul").data("slideshow").play();
	// use an optional delay if necessary;
	// interestingly, it seems as though a direct .play() fails to load **consistently**
	// if it fails to .play() the tabs never show and the images are hidden;
	// setting a timeout -- even one as short as 1ms! -- bypasses the failure and adds predictable stability;
	setTimeout('$("#controlWrap ul").data("slideshow").play()',1);



	//strong-arm IE
	if ($.browser.msie) {
		// something something
		
		/* check explicitly for version 6 */
		if ( $.browser.version<7 ) {
			// hide slideshow controls that overlay on photo (since ie6 can't render png-24 transparentcy)
			
		}
	}  // ie
});

