var index=1;var count=5;var speed=500;var time=8000;var aryVals=Array("zero","one","two","three","four","five");var isPlaying=true;function animate(){$(document).everyTime(time,function(i){animateNext();},(count*4));}
function initAlpha(){content=$("#"+aryVals[1]+"-txt").html();img=$("#"+aryVals[1]+"-img").html();$("#right-alpha").html(content);$("#left-image").css('background-image','url('+img+')');$("#"+aryVals[1]).addClass("active");}
function animateNext(){var newIndex=0;if(index<count){newIndex=index+1;}else{newIndex=1;}
content=$("#"+aryVals[(newIndex)]+"-txt").html();img=$("#"+aryVals[(newIndex)]+"-img").html();$("#right-alpha, #left-image").fadeOut(speed,function(){$("#right-alpha").html(content);$("#left-image").css('background-image','url('+img+')');if(newIndex==1){$("#"+aryVals[5]).removeClass("active");}else{$("#"+aryVals[newIndex-1]).removeClass("active");}
$("#"+aryVals[(newIndex)]).addClass("active");$("#right-alpha, #left-image").fadeIn(speed);});index=newIndex;}
function getNext(){$(document).stopTime();var newIndex=0;if(index<count){newIndex=index+1;}else{newIndex=1;}
content=$("#"+aryVals[(newIndex)]+"-txt").html();img=$("#"+aryVals[(newIndex)]+"-img").html();$("#right-alpha, #left-image").fadeOut(speed,function(){$("#right-alpha").html(content);$("#left-image").css('background-image','url('+img+')');if(newIndex==1){$("#"+aryVals[5]).removeClass("active");}else{$("#"+aryVals[newIndex-1]).removeClass("active");}
$("#"+aryVals[(newIndex)]).addClass("active");$("#right-alpha, #left-image").fadeIn(speed);$("#pause").addClass("active");isPlaying=false;});index=newIndex;}
function getPrev(){$(document).stopTime();var newIndex=0;if(index==1){newIndex=5;}else{newIndex=index-1;}
content=$("#"+aryVals[(newIndex)]+"-txt").html();img=$("#"+aryVals[(newIndex)]+"-img").html();$("#right-alpha, #left-image").fadeOut(speed,function(){$("#right-alpha").html(content);$("#left-image").css('background-image','url('+img+')');if(newIndex==5){$("#"+aryVals[1]).removeClass("active");}else{$("#"+aryVals[newIndex+1]).removeClass("active");}
$("#"+aryVals[(newIndex)]).addClass("active");$("#right-alpha, #left-image").fadeIn(speed);$("#pause").addClass("active");isPlaying=false;});index=newIndex;}
function getIndex(newIndex){$(document).stopTime();content=$("#"+aryVals[(newIndex)]+"-txt").html();img=$("#"+aryVals[(newIndex)]+"-img").html();$("#right-alpha, #left-image").fadeOut(speed,function(){$("#right-alpha").html(content);$("#left-image").css('background-image','url('+img+')');if(newIndex==1){$("#"+aryVals[5]).removeClass("active");}else{$("#"+aryVals[newIndex-1]).removeClass("active");}
$("#"+aryVals[(newIndex)]).addClass("active");$("#right-alpha, #left-image").fadeIn(speed);});index=newIndex;}
function togglePause(){if(isPlaying==true){$(document).stopTime();isPlaying=false;$("#pause").addClass("active");}else{$(document).everyTime(time,function(i){animateNext();},(count*4));isPlaying=true;$("#pause").removeClass("active");}}