/**
* Home page image slideshow
**/

jQuery(document).ready(function($){

	$('#images').append('<div><a href="Mixed_Up_North.php"> <img src="wp-content/uploads/2011/02/ftimageN1.jpg" alt="Mixed Up North by Out of Joint at Wilton\'s Music Hall - photographer Ian Tilton" /></a></div>');
	$('#images').append('<div><a href="Mixed_Up_North.php"> <img src="wp-content/uploads/2011/02/ftimageN2.jpg" alt="Mixed Up North by Out of Joint at Wilton\'s Music Hall - photographer Ian Tilton" /></a></div>');
	$('#images').append('<div><a href="Patrick_Osborne.php"> <img src="wp-content/uploads/2011/02/PatrickOsborne_portrait.jpg" alt="Patrick Osborne at our AGM - photographer Paul Mills" /></a></div>');
	$('#images').append('<div><a href="Mixed_Up_North.php"> <img src="wp-content/uploads/2011/02/ftimageN3.jpg" alt="Mixed Up North by Out of Joint at Wilton\'s Music Hall - photographer Ian Tilton" /></a></div>');
	$('#images').append('<div><a href="Mixed_Up_North.php"> <img src="wp-content/uploads/2011/02/ftimageN4.jpg" alt="Mixed Up North by Out of Joint at Wilton\'s Music Hall - photographer Ian Tilton" /></a></div>');
	$('#images').append('<div><img src="wp-content/uploads/2011/02/ftimage2.jpg" alt="Youth Theatre Projects at the Salisbury Playhouse - photographer Dominic Parkes" /></div>');
	$('#images').append('<div><img src="wp-content/uploads/2011/02/ftimage3.jpg" alt="Paradise Lost by Headlong Theatre Productions at Watford Palace Theatre - photographer John Haynes" /></div>');
	$('#images').append('<div><a href="Ian_Talbot.php"> <img src="wp-content/uploads/2011/02/IanTalbotOBE.jpg" alt="Ian Talbot - Friends of Theatre Hon Life Member - receiving his OBE in January 2008" /></a><div>'); 
	$('#images').append('<div><img src="wp-content/uploads/2011/02/ftimage6.jpg" alt="Youth Theatre Projects at the Salisbury Playhouse - photographer Dominic Parkes" /></div>');
	$('#images').append('<div><img src="wp-content/uploads/2011/02/ftimage7.jpg" alt="Youth Theatre Projects at the Salisbury Playhouse - photographer Dominic Parkes" /></div>');
	$('#images').append('<div><a href="Our_President.php"> <img src="wp-content/uploads/2011/02/DesBarrit_Wicked.jpg" alt="Our President, Desmond Barrit (The Wizard) in Wicked - photographer Tristram Kenton" /></a></div>');
	$('#images').append('<div><a href="Coventry_weekend_2.php"> <img src="wp-content/uploads/2011/02/ftimage11.jpg" alt="The Curve Theatre, Leicester - photographer Ken Archer" /></a></div>');

	$('#images').onImagesLoad({
            selectorCallback: runShow 
        }); 
});

function runShow(container) {
	$('#images').cycle({
		speed: 1000,
		timeout: 5000,
		before: onBefore,
		after: onAfter,
		random: 1
	});
}

function onAfter() {
	$('#caption').html('<span>' + $('img', this).attr("alt") + '</span>');
	$('#caption span').fadeIn();
}

function onBefore() {
	$('#caption span').html("").hide();
}

// end home slide show


// usps slide show
jQuery(document).ready(function($){	
  	 $('#newusps').css('height','127px'); 		
  	 $('#newusps h3').hide(); 		
  	 $('#newusps h4').hide(); 		
  	 var newusps = $('#newusps>div');
	 newusps.before('<ul id="uspnav">\n</ul>\n').cycle({
		speed: 250,
		cleartype:  1,
		pager: '#uspnav',
		pagerAnchorBuilder: function(idx, slide){
			return '<li name="' + slide.id + '"><a href="#">' + $('h4', slide).text() + '</a></li>\n';
		}
	});

	$('#newusps li a').hover(function(){
		newusps.cycle('pause');
		newusps.cycle($('#newusps li a').index(this));
	},function(){
		newusps.cycle('resume');
	});
});

