// JavaScript Document
$(document).ready(function () {
	$("#inline, #inline2, #inline3, #inline4, #inline5, #inline6").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
	});

	$('#homeContent')
	.cycle({
		fx: 'scrollHorz',
		speed: 'slow',
		timeout: 12000,
		delay: 9000,
		pager: '#nav'
	});

	$(window).load(function () {
		bannerAdjust();
	});

	$(window).resize(function () {
		bannerAdjust();
	});
	
	function bannerAdjust() {
		var WR;
		var W = $(window).width();
		WR = (1193 - W);

		if (W <= 1193 && W > 1084) {
			$('#homeContent').css('left', '').css('right', (59 - (W - 1084) / 2) + 'px'); 
			$('#nav').css('left', '').css('right', (59 - (W - 1084) / 2) + 'px'); 
		}
		else if (W <= 1084 && W > 975) {
			$('#homeContent').css('right', '').css('left', (-1 * (59 - (W - 1084) / 2)) + 'px');
			$('#nav').css('right', '').css('left', (-1 * (59 - (W - 1084) / 2)) + 'px');
		}
		else if (W < 975) {
			$('#homeContent').css('right', '').css('left', '-109px');
			$('#nav').css('right', '').css('left', '-109px');
		}
		else {
			$('#homeContent').css('left', '').css('right', '');
			$('#nav').css('left', '').css('right', '');
		}	
	}
	
	$('#example1').fbWall({ 
		id:'efficiencymatters',
		accessToken:'206158599425293|4bd2dd26c5bffb0b0333d9e8.1-100001499320725|pigBAIjauMporHyitLHwuzIdK4o',
		showGuestEntries:false,
		showComments:false,
		max:10,
		timeConversion:12
	});		
	
	$('.ArrowLink').click(function() {
		var current = $(this).attr('id');
		
		$('.ArrowLink').each(function() {
			$(this).removeClass("ArrowLinkON");					
		});	
		
		$('#' + current).addClass("ArrowLinkON");
		
		$('#txtGroup p').each(function() {
			$(this).fadeOut('fast', function() {
				// Animation complete.					
			});					
		});				

		$('#txt' + current).fadeIn(2000, function() {
			// Animation complete.							
		});

		$('#txtImg').attr('src', 'images/txtImg' + current + '.png');
	});
});		
