/*
	Created By: Richard Delph
	For: Enhance Investments Website 2009
	Date: 2009-09-29
*/

$(function($) {
    $(document).ready(on_document_ready);
});

function on_document_ready(e) {

	$('#flash-main').flash({
		swf: '/media/main.swf',
		width: 490,
		height: 498,
		params: {
			play: true,
			loop: true,
			quality: 'high',
			scale: 'showall',
			wmode: 'transparent',
			name: 'welcome-flash',
			id: 'welcome-flash',
			allowfullscreen: false,
			allowscriptaccess: 'sameDomain'			
		}
	});
	
	$('#flash-logo').flash({
		swf: '/media/logo.swf',
		width: 77,
		height: 95,
		params: {
			play: true,
			loop: true,
			quality: 'high',
			scale: 'showall',
			wmode: 'transparent',
			name: 'logo-flash',
			id: 'logo-flash',
			allowfullscreen: false,
			allowscriptaccess: 'sameDomain'			
		}
	});

    $panels = $('#panels .panel');
    $panelsWrapper = $('#panels-wrapper');
    $panelsContainer = $('#panels');

    var totalWidth = $panels[0].offsetWidth * $panels.length;
    $panelsContainer.css('width', totalWidth);

    var scrollOptions = {
        target: $panelsWrapper,
        items: $panels,
		navigation: '#navigation a',
        axis: 'x',
        offset: 0,
        duration: 1200,
		cycle: true,
		constant: true,
        easing: 'easeInOutQuart'
    };

    $panelsContainer.serialScroll(scrollOptions);

    $.localScroll(scrollOptions);


	// scroller for team members
	$teamPanels = $('.team-panel');
	$teamPanelsWrapper = $('#team');
	$teamPanelsContainer = $('#team-panels')
	
	var totalHeight = $teamPanels[0].offsetHeight * $teamPanels.length;
	$teamPanelsContainer.css('height',totalHeight);
	
	var scrollOptions = {
        target: $teamPanelsWrapper,
        items: $teamPanels,
        axis: 'y',
        offset: 0,
        duration: 1200,
		constant: true,
        easing: 'easeInOutQuart'
    };

	$teamPanelsContainer.serialScroll(scrollOptions);
	$teamPanelsContainer.localScroll(scrollOptions);
	
	$("a[href='#team']").click(function() {
		$("a[href='#team-main']").trigger('click');
	});

	

	$("a.cctextupdate").click(function() {
		
		var newText = '';
		var el = $("#creative-concept");
		
		switch($(this).attr('href')) {
			case '#planning':
				newText = '<h2><em>Visual:</em> Titanium Chain</h2><p>A strong, lustrous and non corrosive series of flexible links that are secured to an anchored environment.</p>';
			break;
			case '#selection':
				newText = '<h2><em>Visual:</em> Nautilus Shell</h2><p>A protective, innovative shell with an interior made up of various chambers that are used to Jet propel buoyant directional movements at the first sign of risk</p>';
			break;
			case '#monitoring':
				newText = '<h2><em>Visual:</em> Lighthouse (stairwell)</h2><p>A structure used as a significant Beacon that highlights risk and advises of any near and present dangers.</p>';
			break;
			case '#consultancy':
				newText = '<h2><em>Visual:</em> Navigational Sextant</h2><p>Measures the altitude of a celestial object above the horizon with excellent precision.</p>';
			break;
			case '#integrity':
				newText = '<h2><em>Visual:</em> Fine Silk Thread</h2><p>Choosing the correct material is vital in any tailored bespoke solution.</p><p>When the right materials are partnered with a skilled craftsmen, the end result is quintessentially impressive.</p>';
			break;
			default:
				newText = '';
			break;
		}
		
		el.fadeOut(500,function() {
			if ( newText != '' ) {
				el.html(newText);
				el.fadeIn(500);
			}
		});
	
	});

}
