// JavaScript Document
// Home page image slideshow etc

//image rotation			
				function slideSwitch() {
				var $active = $('#slideshow IMG.active');
			
				if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
			
				var $next =  $active.next().length ? $active.next()
					: $('#slideshow IMG:first');
			
				$active.addClass('last-active');
			
				$next.css({opacity: 0.0})
					.addClass('active')
					.animate({opacity: 1.0}, 2000, function() {
						$active.removeClass('active last-active');
					});
				}
				
				$(function() {
					setInterval( "slideSwitch()", 6000 );
				});

//market link rotation			
				function sectorSwitch() {
				var $active = $('#sector_overlay li.active');
			
				if ( $active.length == 0 ) $active = $('#sector_overlay li:last');
			
				var $next =  $active.next().length ? $active.next()
					: $('#sector_overlay li:first');
			
				$active.addClass('last-active');
			
				$next.css({opacity: 0.0})
					.addClass('active')
					.animate({opacity: 1.0}, 2000, function() {
						$active.removeClass('active last-active');
					});
				}
				
				$(function() {
					setInterval( "sectorSwitch()", 6000 );
				});


//list item rotation - whats hot at VFA
$(document).ready(function() {  
				$('ul.cyclelist li:first-child').addClass( 'active' );
});

				function cycleList() {
				var $active = $('ul.cyclelist li.active');
			
				if ( $active.length == 0 ) $active = $('ul.cyclelist li:last');
			
				var $next =  $active.next().length ? $active.next()
					: $('ul.cyclelist li:first');
			
				$active.addClass('last-active');
			
				$next.css({opacity: 0.0})
					.addClass('active')
					.animate({opacity: 1.0}, 2000, function() {
						$active.removeClass('active last-active');
					});
				}
				
				$(function() {
					setInterval( "cycleList()", 5000 );
				});

//list item rotation - whats hot at VFA  - between countries
$(function() {
		$('div#home2 ul').hide();
		$('div#home2 ul.cyclelist').show(); 
	
		$('a#can_selector').click(function() {
			$('div#home2 ul#can').addClass('cyclelist');
			$('div#home2 ul#usa').removeClass('cyclelist');
			$('div#home2 ul#uk').removeClass('cyclelist');
			$('div#home2 ul').hide();
			$('div#home2 ul.cyclelist').show();
			return false;
		});
		
		$('a#uk_selector').click(function() {
			$('div#home2 ul#uk').addClass('cyclelist');
			$('div#home2 ul#usa').removeClass('cyclelist');
			$('div#home2 ul#can').removeClass('cyclelist');
			$('div#home2 ul').hide();
			$('div#home2 ul.cyclelist').show();
			return false;
		});
		
		$('a#us_selector').click(function() {
			$('div#home2 ul#usa').addClass('cyclelist');
			$('div#home2 ul#uk').removeClass('cyclelist');
			$('div#home2 ul#can').removeClass('cyclelist');
			$('div#home2 ul').hide();
			$('div#home2 ul.cyclelist').show();
			return false;
		});
	});

//press releases - between countries
$(function() {
		$('div#home4_usa').show();
		$('div#home4_uk').hide();
		$('div#home4_can').hide();
	
		$('a#can_selector').click(function() {
			$('div#home4_usa').hide();
			$('div#home4_uk').hide();
			$('div#home4_can').show();
			return false;
		});
		
		$('a#uk_selector').click(function() {
			$('div#home4_usa').hide();
			$('div#home4_uk').show();
			$('div#home4_can').hide();
			return false;
		});
		
		$('a#us_selector').click(function() {
			$('div#home4_usa').show();
			$('div#home4_uk').hide();
			$('div#home4_can').hide();		
			return false;
		});
	});

//upcoming events - between countries
$(function() {
		$('div#home6_usa').show();
		$('div#home6_uk').hide();
		$('div#home6_can').hide();
	
		$('a#can_selector').click(function() {
			$('div#home6_usa').hide();
			$('div#home6_uk').hide();
			$('div#home6_can').show();
			return false;
		});
		
		$('a#uk_selector').click(function() {
			$('div#home6_usa').hide();
			$('div#home6_uk').show();
			$('div#home6_can').hide();
			return false;
		});
		
		$('a#us_selector').click(function() {
			$('div#home6_usa').show();
			$('div#home6_uk').hide();
			$('div#home6_can').hide();		
			return false;
		});
	});

//address - between countries
$(function() {
		$('div#footer_left1_usa').show();
		$('div#footer_left1_uk').hide();
		$('div#footer_left1_can').hide();
		$('div#footer_left2_usa').show();
		$('div#footer_left2_uk').hide();
		$('div#footer_left2_can').hide();
	
		$('a#can_selector').click(function() {
			$('div#footer_left1_usa').hide();
			$('div#footer_left1_uk').hide();
			$('div#footer_left1_can').show();
			$('div#footer_left2_usa').hide();
			$('div#footer_left2_uk').hide();
			$('div#footer_left2_can').show();
			return false;
		});
		
		$('a#uk_selector').click(function() {
			$('div#footer_left1_usa').hide();
			$('div#footer_left1_uk').show();
			$('div#footer_left1_can').hide();
			$('div#footer_left2_usa').hide();
			$('div#footer_left2_uk').show();
			$('div#footer_left2_can').hide();
			return false;
		});
		
		$('a#us_selector').click(function() {
			$('div#footer_left1_usa').show();
			$('div#footer_left1_uk').hide();
			$('div#footer_left1_can').hide();
			$('div#footer_left2_usa').show();
			$('div#footer_left2_uk').hide();
			$('div#footer_left2_can').hide();
			return false;
		});
	});

