// Home page slideshow

jQuery(document).ready(function() {

	jQuery("body:not(.home) .gallery").append("<div id='prev'></div><div id='next'></div>").cycle({
		timeout:       0,  // milliseconds between slide transitions (0 to disable auto advance) 
		speed:         1000,  // speed of the transition (any valid fx speed value) 
		next:          "#next",  // id of element to use as click trigger for next slide 
		prev:          "#prev",  // id of element to use as click trigger for previous slide 
		before:        null,  // transition callback (scope set to element to be shown) 
		after:         null,  // transition callback (scope set to element that was shown) 
		sync:          1,     // true if in/out transitions should occur simultaneously 
		fit:           1,     // force slides to fit container 
		pause:         0,     // true to enable "pause on hover" 
		delay:         0,     // additional delay (in ms) for first transition (hint: can be negative) 
		slideExpr:     "dl",   // expression for selecting slides (if something other than all children is required)
		containerResize: 0,
		height: 790
	});
	
	// home page gallery is different
	
	jQuery("body.home .gallery").cycle({
		timeout:       3500,  // milliseconds between slide transitions (0 to disable auto advance) 
		speed:         1000,  // speed of the transition (any valid fx speed value) 
		next:          null,  // id of element to use as click trigger for next slide 
		prev:          null,  // id of element to use as click trigger for previous slide 
		before:        null,  // transition callback (scope set to element to be shown) 
		after:         null,  // transition callback (scope set to element that was shown) 
		height:        582, // container height 
		sync:          1,     // true if in/out transitions should occur simultaneously 
		fit:           1,     // force slides to fit container 
		pause:         0,     // true to enable "pause on hover" 
		delay:         -1000,     // additional delay (in ms) for first transition (hint: can be negative) 
		slideExpr:     "dl dt a img",   // expression for selecting slides (if something other than all children is required) 
		containerResize: 0,
		slideResize:    0

	});
	
	jQuery("body.home .gallery a").click(function(event) { event.preventDefault(); });
	/*
	jQuery("body:not(.home) .gallery a").each(function() {
		var temp = jQuery(this).html();
		jQuery(this).replaceWith(temp);	
	});
	*/
	
	jQuery(".gallery #next, .gallery #prev").hover(function() {
		jQuery(".gallery #next, .gallery #prev").not(this).stop(true,true).css("opacity",0);
		jQuery(this).fadeTo("fast",1).css("cursor","pointer");
		}, function() {
		jQuery(this).fadeTo("fast",0);
		}
		);

});
