function checkWhichSlide() {
	var slideId = $('#slider li.active').attr('id');
	$('#controls li').removeClass('current');
	
	switch (slideId) {
		case 'slide0':
			$('#slideControl0').addClass('current');
			break;
		case 'slide1':
			$('#slideControl1').addClass('current');
			break;
		case 'slide2':
			$('#slideControl2').addClass('current');
			break;
		case 'slide3':
			$('#slideControl3').addClass('current');
			break;
		case 'slide4':
			$('#slideControl4').addClass('current');
			break;
	}
}
function slideSwitch() {
    var $active = $('.twitter li.active');

    if ( $active.length == 0 ) $active = $('.twitter li:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('.twitter li:first');

    // uncomment the 3 lines below to pull the images in random order

    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
	
	$('.twitter-item.active .twitter-link').last().hide();
	$('.readMoreTwitterBtn').attr('href', $('.twitter-item.active .twitter-link').last().attr('href'));
}
function slideSwitchHome() {
    var $active = $('#slider ul li.active');

    if ( $active.length == 0 ) $active = $('#slider ul li:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slider ul li:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
		});
		
	var slideId = $('#slider li.active').attr('id');
	$('#controls li').removeClass('current');
	
	switch (slideId) {
		case 'slide0':
			$('#slideControl1').addClass('current');
			break;
		case 'slide1':
			$('#slideControl2').addClass('current');
			break;
		case 'slide2':
			$('#slideControl3').addClass('current');
			break;
		case 'slide3':
			$('#slideControl4').addClass('current');
			break;
		case 'slide4':
			$('#slideControl0').addClass('current');
			break;
	}
}
function testimonialSlideSwitch() {
    var $active = $('.sideTestimonialContainer.active');

    if ( $active.length == 0 ) $active = $('.sideTestimonialContainer:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('.sideTestimonialContainer:first');

    // uncomment the 3 lines below to pull the images in random order

    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(document).ready(function() {	
	// $("#slider").easySlider({
	// 	auto: true,
	// 	continuous: true,
	// 	numeric: true,
	// 	pause: 10000,
	// 	controlShow: true
	// });
	
	$('.twitter li:first, #slider li:first, sideTestimonialContainer:first').addClass('active');
	
	$('.twitter-item.active .twitter-link').last().hide();
	$('.readMoreTwitterBtn').attr('href', $('.twitter-item.active .twitter-link').last().attr('href'));
/*	$(function() {*/
	    setInterval( "slideSwitch()", 5000 );
		setInterval( "slideSwitchHome()", 10000 );
		setInterval( "testimonialSlideSwitch()", 5000 );
/*	});*/
	
	
	$('#sliderPrev').click(function(){
		var currentSliderNum = $('#controls li.current a').attr('rel');
		currentSliderNum = currentSliderNum * 1;
		var currentNum = currentSliderNum;
		var controlCount = $('#controls li').size() * 1;
		if (currentNum == 0) {
		    nextNum = (controlCount - 1);
		} else {
		    nextNum = currentSliderNum - 1;
		}
		$('#controls a[rel='+ nextNum +']').click();
	});
	
	$('#sliderNext').click(function(){
		var currentSliderNum = $('#controls li.current a').attr('rel');
		currentSliderNum = currentSliderNum * 1;
		var currentNum = currentSliderNum;
		var controlCount = $('#controls li').size() * 1;
		if (currentNum == (controlCount - 1)) {
		    nextNum = 0;
		} else {
		    nextNum = currentSliderNum + 1;
		}
		$('#controls a[rel='+ nextNum +']').click();
	});
	
	$('.subNav').hide();

	//On Click
	$('.subNav').addClass('hidingSubNav'); //Hide/close all containers
	$('.topNav .open').removeClass('hidingSubNav').show();
	$('.navItemBtn, .navItemText').click(function(){
		if ($(this).siblings('.subNav').hasClass('hidingSubNav')) {
			// $(this).siblings('.subNav').slideDown();
			$(this).siblings('.subNav').show();
			$(this).siblings('.subNav').removeClass('hidingSubNav');
		} else {
			// $(this).siblings('.subNav').slideUp();
			$(this).siblings('.subNav').hide();
			$(this).siblings('.subNav').addClass('hidingSubNav');
		}
	});
	
});
$(document).ready(function(){
	$("#calloutRight, .openpdflb").colorbox({width:"942px", height:"472px", inline:true, href:"#lb-exploreNM"});
	$("#nmLB-link").colorbox({width:"942px", height:"472px", inline:true, href:"#lb-exploreNM"});
	$(".link-stimuli").colorbox({width:"942px", height:"575px", inline:true, href:"#lb-stimuli"});
/*	$('#calloutLeft').colorbox({width:"942px", height:"402px", inline:true, href:"#lb-video-1"});*/
/*	$('#calloutLeft').click(function(){
		var cssObj = {
			'display' : 'block',
			'width' : '618px',
			'height' : '350px'
		}
		$('#lb-video-1 object').css(cssObj);
	});*/
	
/*	$('#whyAndHowBtn, #homeSlide3').colorbox({width:"942px", height:"402px", inline:true, href:"#lb-video-2"});*/
	$("#homeSlide4").colorbox({width:"942px", height:"472px", inline:true, href:"#lb-exploreNM"});
});
$(document).ready(function(){
	$('div.lb-btn.3brains').click(function(){ window.location = "/why-you-need-the-neuromap/the-3-brains/"; });
	$('div.lb-btn.6stim').click(function(){ window.location = "/why-you-need-the-neuromap/the-6-stimuli/"; });
	$('div.lb-btn.4steps').click(function(){ window.location = "/why-you-need-the-neuromap/the-4-steps/"; });
	$('div.lb-btn.6blocks').click(function(){ window.location = "/why-you-need-the-neuromap/6-message-blocks/"; });
	$('div.lb-btn.7boost').click(function(){ window.location = "/why-you-need-the-neuromap/7-message-boosters/"; });
});
$(document).ready(function(){
/*
	if ($('.subNav-4 .current_page_item').length != 0) {
		$('.subNav-4').removeClass('hidingSubNav').show();
	}
	if ($('.subNav-17 .current_page_item').length != 0) {
		$('.subNav-17').removeClass('hidingSubNav').show();
	}
	if ($('.subNav-19 .current_page_item').length != 0) {
		$('.subNav-19').removeClass('hidingSubNav').show();
	}
	if ($('.subNav-21 .current_page_item').length != 0) {
		$('.subNav-21').removeClass('hidingSubNav').show();
	}
	if ($('.subNav-23 .current_page_item').length != 0) {
		$('.subNav-23').removeClass('hidingSubNav').show();
	}
*/
	$('.current_page_item>a').css('font-weight', 'bold');
	$('.current_page_item').parents('ul').show();

});

