function setQuotes(quotesBox, array)
{
	quotesBox.children('p').text(array[0]);
	quotesBox.children('q').text(array[1]);
}

$(function(){
	
	$('#scroller').simplyScroll({
			autoMode: 'loop',
			pauseOnHover: false
	});
	
	var $nav = $('#nav');
	var page = $nav.data('page');
	
	$('img').bind('dragstart', function() { return false; });
	
	$nav.children().each(function(index, element){
		if ($(element).hasClass(page))
		{
			$(element).addClass('navselected');
		}
	});
	
	if (typeof quotes !== "undefined")
	{
		var $quoteBox = $('.quote');

		var i = 0;

		setQuotes($quoteBox, quotes[i]);
		i++;
		if (quotes.length !== 1)
		{
			setInterval(function(){
				$quoteBox.fadeOut('slow', function(){
					if (i >= quotes.length)
					{
						i = 0;
					}
				
					setQuotes($quoteBox, quotes[i]);
					i++;
				}).fadeIn('slow');
			},10000);
		}
	}
	
	var $content = $('#content');
	
	/* === Home Page 'more' buttons === */
	$('.more').click(function(){
		var person = $(this).parent().attr('id');
		var text;
		
		if (person == "yvonne")
		{
			text = "<h2>Yvonne</h2><p>Studied Natural Sciences at King’s College, Cambridge<br>Yvonne then worked her way through several of London’s top advertising agencies during the 80’s - the heyday of British advertising<br>Strategic planner at BMP for 3 years 84-87 (now DDB)<br>Strategic planner at DMB&amp;B for 2 years 87-89 (now Leo Burnett)<br>Strategic planner at BBH for 3 years 89-92<br>From 1992 worked as a ‘brain for hire’ specialising in brand development and innovation.</p>";
		}
		else if (person == "anneke")
		{
			text = "<h2>Anneke</h2><p>Studied History at Bristol University<br>1983 began her career as a brand planner at BMP. 1987 appointed to the board of BMP DDB as planning director.<br>1994 wrote Nations For Sale a study of the brand equity of Britain, Japan and America which led to consultancy work for British Council and Foreign Office on cultural identity and branding Britain.<br>2001 commissioned to write a book, Creativity Works, which explored the concept of creativity in business through interviews with industrial leaders, entrepreneurs and thinkers. It was launched at a seminar held at 11 Downing Street.</p>";
		}
		else if (person == "partnership")
		{
			text = "<h2>Our Partnership</h2><p>We met in our first jobs in advertising in 1984.<br>In the mid 1990s we teamed up as freelance strategic planners conducting group discussions, facilitating workshops and idea generation sessions, and managing quantitative projects to give joined up thinking and thoughtful analysis to brand strategy and NPD.<br>In 1999 we formed the cre8ive.net partnership which then became a company in 2005.<br>Between us we have 3 children, 3 cats and 50 years of strategic and creative development research experience.</p>";
		}
				
		if ($content.html() !== text)
		{
			$content.fadeOut('fast', function() {
				$content.html(text);
			}).fadeIn('fast');
		}
	});
	
	/* === Video viewer === */
	$('.vimeo').fancybox();
			
});
