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

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

function on_document_ready(e) {

    $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');
	});

	

	$("#nav-icons li a, #navigation a, .arrows a").click(function(e) {
		
		var newText = '';
		var el = $("#creative-concept");
		
		switch($(this).attr('href')) {
			case '#welcome':
				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 '#investment':
				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 '#wealth':
				newText = '<h2><em>Visual:</em> Swiss watch</h2><p>Rich in invention and craftsmanship that perpetually increases it’s reputation with a fine attention to detail chronologically.</p>';
			break;
			case '#treasury':
				newText = '<h2><em>Visual:</em> Fine Silk Thread</h2><p>Choosing the correct material is vital in any tailored bespoke solution. 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);
			}
		});
	
	});

}

