$(function() {
	$('#flipbook').crossSlide({
		  fade: 2,
		  variant: true,
		  easing: 'easeInOutQuad'
	}, [
	  {
	    src:  'images/flipbook/lighttunnel.jpg',
	    alt:  '<strong>Finding </strong>Unique Solutions for Modern Challenges',
	    from: 'center center',
	    to:   'top center 1.5x',
	    time: 5
	  }, {
	    src:  'images/flipbook/leaves.jpg',
	    alt:  '<strong>Creating </strong>Opportunities for Growth through Innovation',
	    from: 'top center',
	    to:   'top right 1.5x',
	    time: 5
	  }, {
	    src:  'images/flipbook/wish.jpg',
	    alt:  '<strong>Helping </strong>Others by Reaching Out to the Community',
	    from: 'top center',
	    to:   'top right 1.1x',
	    time: 5
	  }, {
	    src:  'images/flipbook/butterfly.jpg',
	    alt:  '<strong>Pursuing </strong>a Bright Future with Passion and Dedication...',
	    from: '100% 50%',
	    to:   '30% 50% 1.5x',
	    time: 5
	  }
	], function(idx, img, idxOut, imgOut) {
	  if (idxOut == undefined)
	  {
	    // starting single image phase, put up caption
		  buildAnimatedString('div.flipbookCaption',img.alt,0,'');
		  $('div.flipbookCaption').fadeIn()

	  }
	  else
	  {
	    // starting cross-fade phase, take out caption
	   $('div.flipbookCaption').fadeOut()
		  
	  }
	});
});

function buildAnimatedString(el,text,pos,unique){

	  ctext=text.substring(0,pos)+(pos%2?'-':'_');
	  $(el).html(ctext);

	  if(pos==text.length)
	   $(el).html(text);
	  else
	   window.setTimeout('buildAnimatedString("'+el+'","'+text+'",'+(pos+1)+',"'+unique+'");',10);
}
