$(document).ready(function() {

//TESTIMONIALS PAGE VIDEO BROWSER
$('.vidnav li').click(function() {

$('.vidnav li').each(function() {
$(this).css('opacity','0.75').removeClass('showThumb'); 
});
$(this).css('opacity','1').addClass('showThumb'); ; 
var index = $(this).index();

$('.vidholder li.showVid').fadeOut(500, function() {
$(this).removeClass('showVid');
$('.vidholder li').eq(index).fadeIn(500).addClass('showVid');
});




});



$('.vidnav li').hover(function(){

$(this).css('opacity','1');
},
function(){
if($(this).hasClass('showThumb')){}else{
$(this).css('opacity','0.75');
}
});
//END TESTIMONIALS PAGE VIDEO BROWSER

//TABBED INTERFACE CONTACTCENTER PAGE

$('.tabbuttons li a').click(function(event) { 
event.preventDefault();

var thisInd = $(this).parent('li').index();

$('.tabbuttons li a').each(function() {
$(this).removeClass('active');
});
$(this).addClass('active');

$('#tabbed article.showMe').animate({
    opacity: 0,
    height: 0
  }, 500, function() {
$('#tabbed article.showMe').removeClass('showMe');

$('#tab_' +  thisInd).animate({
    opacity: 1,
    height: 216
  }, 500, function() {
  
  $('#tab_' +  thisInd).addClass('showMe');
  });
  });
});
//END TABBED INTERFACE CONTACTCENTER PAGE

//RIGHT SIDE WIDGET

$('#fiveKeyOptions li').click(function(event) { 
event.preventDefault();

var thisInd = $(this).index();

$('#fiveKeyOptions li').each(function() {
$(this).removeClass('active');
});
$(this).addClass('active');

$('#rightWidget article.show').animate({
    opacity: 0

  }, 500, function() {
$('#rightWidget article.show').css('display','none');
$('#rightWidget article.show').removeClass('show');
$('#rightWidget article#' +  thisInd).css('display','block');
$('#rightWidget article#' +  thisInd).animate({
    opacity: 1
  }, 500, function() {
  
  $('#rightWidget article#' +  thisInd).addClass('show')
  });
  });
});

//END RIGHT SIDE WIDGET










if($('body#index').length > 0){

//MODERNIZR 3D DETECT
if(Modernizr.csstransforms3d == true){ 
//alert('3d');
//JQUERY CYCLE3D CSS TRANSFORM
var bc = $('#indicator'); 
var $container = $('#imgrotator').cycle({
        fx: 'fade', 
        pause: 'true', 
        sync: 'false',
        speed: 1000,
        timeout: 5000,
        easing: 'easeInOutSine',
        before: function(curr, next, opts, forwardFlag){
        		opts.animOut.opacity = 0;
		var next = ($(next).index() +1);
		$('#indicate' + next).css('background-color','#b7d373');
		var now = ($(curr).index() + 1);
		$('#indicate' + now).css('background-color','#ef8310');
		$('article#' + now).addClass('threed');
		},
		
	 after: function(curr, next, opts, forwardFlag){
		var now = ($(curr).index() + 1);
		$('article#' + now).removeClass('threed');
		}
}); 

$container.children().each(function(i) { 
    $('<li><a href="#" id="indicate'+(i+1)+'">' + i + '</a></li>') 
        .appendTo(bc) 
        .click(function() { 
            $container.cycle(i); 
            return false; 
        }).hover(
function(){
$(this).children().parent('li').css('background-color','#f45023')
},
  function(){
    $(this).children().parent('li').css('background-color','#ef8310')
    }
); 
});
$('#indicate1').css('background-color','#b7d373');
//END JQUERY CYCLE 3D CSS TRANSFORM

}else{
//alert('NO 3d');
//JQUERY CYCLE NO 3D CSS TRANSFORM
var bc = $('#indicator'); 
var $container = $('#imgrotator').cycle({
        fx: 'scrollDown', 
        pause: 'true', 
        sync: 'false',
        speed: 1500,
        timeout: 10000,
        easing: 'easeInOutSine',
        before: function(curr, next, opts, forwardFlag){
        		opts.animOut.opacity = 0;
		
		var next = ($(next).index() + 1);
		$('#indicate' + next ).css('background-color','#b7d373');
		//alert(next);
		var now = ($(curr).index() + 1);
		$('#indicate' + now).css('background-color','#ef8310');
		
		}
}); 

$container.children().each(function(i) { 
    $('<li><a href="#" id="indicate'+(i+1)+'">' + i + '</a></li>') 
        .appendTo(bc) 
        .click(function() { 
            $container.cycle(i); 
            return false; 
        }).hover(
function(){
$(this).children().parent('li').css('background-color','#f45023')
},
  function(){
    $(this).children().parent('li').css('background-color','#ef8310')
    }
); 
});
$('#indicate1').css('background-color','#b7d373');
//END JQUERY CYCLE NO 3D CSS TRANSFORM
}

}//end body id=index detect


//ACTION BUTTON CLICK

//END ACTION BUTTON CLICK




});







