// function to swap text in the interactive graph area of the era analysis

function swapText(arg){
  var i=0;
  if(i==0){
    document.getElementById('graphpic-01').style.display = 'block';
    i=1;
  }
  document.getElementById('graphpic-01').innerHTML = arg;
}

function swapTextOff(arg){
  document.getElementById('graphpic-01').style.display = 'none';
  document.getElementById('graphpic-01').innerHTML = '';
}

// jquery cycler slider show
$(document).ready(function() {
    $("#nav-local ul li:first").addClass("nav-local-first");
    $('.slideshow-about').cycle({ fx: 'fade', random: 1 });
    $('#ss-main').cycle({ fx: 'fade' });
    $('#slideshow-exp').cycle({ 
	    fx:     'fade', 
	    speed:  'fast', 
	    timeout: 0, 
	    next:   '#next2', 
	    prev:   '#prev2' 
    });
    $('#slideshow-era').cycle({
    	    fx: 'fade',
	    speed: 5000,
	    random: 1
    });
    // toggle expand/contract era analysis on history pages
    $('#era-analysis-toggle h1').toggle(
    	function(){
	    $(this).addClass('toggle-over');
	    $('#era-analysis-iframe').attr('src','http://www.businessinnovationfactory.com/sxl/assets/dev/era-analysis/index.php');
	    $('#era-analysis-iframe').attr('height','2510');
	}, function() {
	    $(this).removeClass('toggle-over');
	    $('#era-analysis-iframe').attr('src','http://www.businessinnovationfactory.com/sxl/assets/dev/era-analysis/index02.php');
	    $('#era-analysis-iframe').attr('height','240');
	}		    
    );
    // add classes to ordered list for take aways (the list length is variable)
    $('#era-main-sidebar ol').each(function() {
	var $children = $(this).children('li');
	var totalChildren = $children.length;
	var start = 1;
	$children.each(function() {
		$(this).addClass('l0'+start);
		start++;
	});
    });
});
