var displayPeopleArray;

$(function(){
	
	
	$('.tabbed').each(function(){
		$('.tabs li').hover(function(){
				$(this).addClass('hover');
			},
			function(){
				$(this).removeClass('hover');
		});
		$('.tabs li').click(function(){
			$('.tabs li').removeClass('active');
			$(this).addClass('active');
			$('.tabContent li').css('display','none');
			$($('.tabContent li').get($('.tabs li').index(this))).css('display','block');
		});
		
		$($('.tabs li').get(0)).addClass('active');
		$($('.tabContent li').get(0)).css('display','block');
	});
	
	
	
	$('#buttonLogin a').click(function(){
		$('#subLogin').slideToggle();
		
		if($('#buttonLogin').hasClass('active')){
			$('#buttonLogin').removeClass('active');
		}
		else{
			$('#buttonLogin').addClass('active');
		}
	});
	
	$('.homePage #buttonLogin').addClass('active');
	
	
	$('table.calculator input.reformat').change(function(){
		stripChars($(this));
		$('#start_value').val($(this).val());
		$(this).val(addCommas($(this).val()));
		stripChars($('#start_value'));
	});
	$('table.calculator input.stripChars').change(function(){
		stripChars($(this));
	});
	$('table.calculator input.stripCharsDecimal').change(function(){
		stripChars_decimal($(this));
	});
	$('#CISDP').change(function(){
		$('#CDP').val(100 - $('#CISDP').val());
	});
	$('#CDP').change(function(){
		$('#CISDP').val(100 - $('#CDP').val());
	});
	
	
	
	
	
	
	
	$('a').focus(function(){
		$(this).blur();
	});
	$('input.check').focus(function(){
		$(this).blur();
	});
	
	
	
	if(displayPeopleArray != null){
		var personIndex = Math.floor(Math.random() * displayPeopleArray.length);
		$('#personContainer').html(peopleArray[displayPeopleArray[personIndex]]);
	}
	
	
	
	
	
	
});


function ShowTimeline(timelineName){
	$('.timelineContainer').css('display','none');
	$('#' + timelineName).css('display','block');
}


function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}


function stripChars(strObject){
  var s = strObject.val();
  var bag="1234567890";
  var i ;
  var returnString = "" ;

  // Search through string's characters one by one.
  // If character is in bag, append to returnString.

  for (i = 0; i < s.length; i++)
  {   
      // Check that current character isn't whitespace.
      var c = s.charAt(i) ;
      if (bag.indexOf(c) != -1) returnString += c ;
  }

	strObject.val(returnString);
}


function stripChars_decimal(strObject){
	var s = strObject.val();
	var bag="1234567890.";
	var i ;
	var returnString = "" ;
	
	// Search through string's characters one by one.
	// If character is in bag, append to returnString.
	
	for (i = 0; i < s.length; i++)
	{   
	    // Check that current character isn't whitespace.
	    var c = s.charAt(i) ;
	    if (bag.indexOf(c) != -1) returnString += c ;
	}
	
	strObject.val(returnString);
	if(strObject.val() > 100)
		strObject.val(strObject.val() % 100);
}







var peopleArray = new Array();
peopleArray['alan_head'] = 'Alan Head,<br/>Vice President,<br/>Manager of Research and Performance Reporting<br/><span>214.922.3260 | <a href="ahead@capis.com">ahead@capis.com</a></span><img src="/images/people/alan_head.jpg"/>';
peopleArray['anne_barlow'] = 'Anne Barlow,<br/>Vice President,<br/>Director of Corporate Access<br/><span>214.978.4754 | <a href="mailto:abarlow@capis.com">abarlow@capis.com</a></span><img src="/images/people/anne_barlow.jpg"/>';
peopleArray['bill_steen'] = 'Bill Steen,<br/>First Vice President,<br/>Institutional Sales<br/><span>214.922.3223 | <a href="mailto:bsteen@capis.com">bsteen@capis.com</a></span><img src="/images/people/bill_steen.jpg"/>';
peopleArray['brian_emanuelson'] = 'Brian Emanuelson,<br/>Vice President,<br/>Research Sales<br/><span>214.978.4733 | <a href="mailto:bemanuelson@capis.com">bemanuelson@capis.com</a></span><img src="/images/people/brian_emanuelson.jpg"/>';
peopleArray['bryan_gibbs'] = 'Bryan Gibbs,<br/>First Vice President,<br/>Transition Management<br/><span>214.978.4748 | <a href="mailto:bgibbs@capis.com">bgibbs@capis.com</a></span><img src="/images/people/bryan_gibbs.jpg"/>';
peopleArray['caran_chaney'] = 'Caran Chaney,<br/>Vice President,<br/>Client Service Representative Manager<br/><span>214.978.4721| <a href="mailto:cchaney@capis.com">cchaney@capis.com</a></span><img src="/images/people/caran_chaney.jpg"/>';
peopleArray['carey_tatum'] = 'Carey Tatum,<br/>Program Trading<br/><span>866.603.1784 | <a href="mailto:ctatum@capis.com">ctatum@capis.com</a></span><img src="/images/people/carey_tatum.jpg"/>';
peopleArray['chad_muller'] = 'Chad Muller,<br/>First Vice President,<br/>Equity Trading<br/><span>800.527.5756 | <a href="mailto:cmuller@capis.com">cmuller@capis.com</a></span><img src="/images/people/chad_muller.jpg"/>';
peopleArray['chris_adams'] = 'Chris Adams,<br/>Vice President,<br/>Fixed Income<br/><span>800.247.8888 | <a href="mailto:cadams@capis.com">cadams@capis.com</a></span><img src="/images/people/chris_adams.jpg"/>';
peopleArray['chris_buck'] = 'Chris Buck,<br/>Senior Vice President,<br/>Director of Global Sales<br/><span>214.922.3208 | <a href="mailto:cbuck@capis.com">cbuck@capis.com</a></span><img src="/images/people/chris_buck.jpg"/>';
peopleArray['chris_cole'] = 'Chris Cole,<br/>First Vice President,<br/>Institutional Sales <br/><span>214.978.4708 | <a href="mailto:ccole@capis.com">ccole@capis.com</a></span><img src="/images/people/chris_cole.jpg"/>';
peopleArray['chris_cook'] = 'Chris Cook,<br/>Vice President,<br/>Institutional Sales <br/><span>214.978.4736 | <a href="mailto:ccook@capis.com">ccook@capis.com</a></span><img src="/images/people/chris_cook.jpg"/>';
peopleArray['chris_halverson'] = 'Chris Halverson,<br/>Senior Vice President,<br/>Institutional Sales <br/><span>214.978.4774 | <a href="mailto:chalverson@capis.com">chalverson@capis.com</a></span><img src="/images/people/chris_halverson.jpg"/>';
peopleArray['chris_hurley'] = 'Chris Hurley,<br/>Senior Vice President,<br/>Institutional Sales <br/><span>214.978.4777 | <a href="mailto:churley@capis.com">churley@capis.com</a></span><img src="/images/people/chris_hurley.jpg"/>';
peopleArray['christi_moreno'] = 'Christi Moreno,<br/>Client Service Representative<br/><span>214.978.4743| <a href="mailto:cmoreno@capis.com">cmoreno@capis.com</a></span><img src="/images/people/christi_moreno.jpg"/>';
peopleArray['clayton_duff'] = 'Clayton Duff,<br/>International Trading<br/><span>866.349.6216 | <a href="mailto:cduff@capis.com">cduff@capis.com</a></span><img src="/images/people/clayton_duff.jpg"/>';
peopleArray['corey_ware'] = 'Corey Ware,<br/>First Vice President,<br/>Equity Trading<br/><span>800.527.5756 | <a href="mailto:cware@capis.com">cware@capis.com</a></span><img src="/images/people/corey_ware.jpg"/>';
peopleArray['damon_belding'] = 'Damon Belding,<br/>First Vice President,<br/>Equity Trading<br/><span>800.527.5756 | <a href="mailto:dbelding@capis.com">dbelding@capis.com</a></span><img src="/images/people/damon_belding.jpg"/>';
peopleArray['daniel_dekat'] = 'Daniel Dekat,<br/>Institutional Sales<br/><span>214.922.3254 | <a href="mailto:ddekat@capis.com">ddekat@capis.com</a></span><img src="/images/people/daniel_dekat.jpg"/>';
peopleArray['david_choate'] = 'David Choate,<br/>Senior Vice President,<br/>Institutional Sales <br/><span>214.978.4732 | <a href="mailto:dchoate@capis.com">dchoate@capis.com</a></span><img src="/images/people/david_choate.jpg"/>';
peopleArray['david_lee'] = 'David Lee,<br/>Senior Trader,<br/>Fixed Income<br/><span>800.247.8888 | <a href="mailto:dlee@capis.com">dlee@capis.com</a></span><img src="/images/people/david_lee.jpg"/>';
peopleArray['doug_mcphail'] = 'Doug McPhail,<br/>Electronic Trading<br/><span>214.978.4771 | <a href="mailto:dmcphail@capis.com">dmcphail@capis.com</a></span><img src="/images/people/doug_mcphail.jpg"/>';
peopleArray['ed_odowd'] = 'Ed O\'Dowd,<br/>Senior Vice President,<br/>Institutional Sales <br/><span>214.978.4725 | <a href="mailto:eodowd@capis.com">eodowd@capis.com</a></span><img src="/images/people/ed_odowd.jpg"/>';
peopleArray['eric_holt'] = 'Eric Holt,<br/>Director of Compliance<br/><span>214.978.4761 | <a href="mailto:eholt@capis.com">eholt@capis.com</a></span><img src="/images/people/eric_holt.jpg"/>';
peopleArray['eric_lovett'] = 'Eric Lovett,<br/>Vice President,<br/>Research Sales<br/><span>214.978.4738 | <a href="mailto:elovett@capis.com">elovett@capis.com</a></span><img src="/images/people/eric_lovett.jpg"/>';
peopleArray['francine_cook'] = 'Francine Cook,<br/>Vice President,<br/>Operations Manager<br/><span>214.978.4793 | <a href="mailto:fcook@capis.com">fcook@capis.com</a></span><img src="/images/people/francine_cook.jpg"/>';
peopleArray['gene_hill'] = 'Gene Hill,<br/>First Vice President,<br/>Equity Trading<br/><span>800.527.5756 | <a href="mailto:ghill@capis.com">ghill@capis.com</a></span><img src="/images/people/gene_hill.jpg"/>';
peopleArray['glenn_nowlin'] = 'Glenn Nowlin,<br/>First Vice President,<br/>International Trading Manager<br/><span>866.349.6216| <a href="mailto:gnowlin@capis.com">gnowlin@capis.com</a></span><img src="/images/people/glenn_nowlin.jpg"/>';
peopleArray['heather_anderson'] = 'Heather Anderson,<br/>Client Service Representative<br/><span>214.978.3277| <a href="mailto:handerson@capis.com">handerson@capis.com</a></span><img src="/images/people/heather_anderson.jpg"/>';
peopleArray['ian_kindler'] = 'Ian Kindler, CFA,<br/>Director of Options Trading<br/><span>800.527.5756| <a href="mailto:ikindler@capis.com">ikindler@capis.com</a></span><img src="/images/people/ian_kindler.jpg"/>';
peopleArray['jannette_vasquez'] = 'Jannette Vasquez,<br/>Client Service Representative<br/><span>214.978.4720| <a href="mailto:jvasquez@capis.com">jvasquez@capis.com</a></span><img src="/images/people/jannette_vasquez.jpg"/>';
peopleArray['jason_gatewood'] = 'Jason Gatewood,<br/>First Vice President,<br/>Program Trading<br/><span>866.603.1784 | <a href="mailto:jgatewood@capis.com">jgatewood@capis.com</a></span><img src="/images/people/jason_gatewood.jpg"/>';
peopleArray['jeannie_musick'] = 'Jeannie Musick,<br/>Client Service Representative<br/><span>214.978.4770| <a href="mailto:jmusick@capis.com">jmusick@capis.com</a></span><img src="/images/people/jeannie_musick.jpg"/>';
peopleArray['jim_mooney'] = 'Jim Mooney,<br/>First Vice President,<br/>Institutional Sales <br/><span>214.978.4723 | <a href="mailto:jmooney@capis.com">jmooney@capis.com</a></span><img src="/images/people/jim_mooney.jpg"/>';
peopleArray['joanna_horton'] = 'Joanna Horton,<br/>Senior Vice President,<br/>Director of Global Trading<br/><span>800.527.5756 | <a href="mailto:jhorton@capis.com">jhorton@capis.com</a></span><img src="/images/people/joanna_horton.jpg"/>';
peopleArray['john_naudo'] = 'John Naudo,<br/>Senior Vice President,<br/>Director of International Trading<br/><span>866.349.6216 | <a href="mailto:jnaudo@capis.com">jnaudo@capis.com</a></span><img src="/images/people/john_naudo.jpg"/>';
peopleArray['jon_lantz'] = 'Jon Lantz,<br/>Institutional Sales <br/><span>214.978.4778 | <a href="mailto:jlantz@capis.com">jlantz@capis.com</a></span><img src="/images/people/jon_lantz.jpg"/>';
peopleArray['keith_faulkner'] = 'Keith Faulkner,<br/>Compliance Manager<br/><span>214.978.4751| <a href="mailto:kfaulkne@capis.com">kfaulkne@capis.com</a></span><img src="/images/people/keith_faulkner.jpg"/>';
peopleArray['kelly_eskildsen'] = 'Kelly Eskildsen,<br/>Vice President,<br/>Equity Trading<br/><span>800.527.5756 | <a href="mailto:keskildsen@capis.com">keskildsen@capis.com</a></span><img src="/images/people/kelly_eskildsen.jpg"/>';
peopleArray['kevin_phelan'] = 'Kevin Phelan,<br/>Equity Trading<br/><span>214.978.4713 | <a href="mailto:kphelan@capis.com">kphelan@capis.com</a></span><img src="/images/people/kevin_phelan.jpg"/>';
peopleArray['kim_cave'] = 'Kim Cave,<br/>Executive Assistant<br/><span>214.978.4739| <a href="mailto:kcave@capis.com">kcave@capis.com</a></span><img src="/images/people/kim_cave.jpg"/>';
peopleArray['mario_shane'] = 'Mario Shane,<br/>Senior Vice President,<br/>Director of Research Sales<br/><span>214.978.4772 | <a href="mailto:mshane@capis.com">mshane@capis.com</a></span><img src="/images/people/mario_shane.jpg"/>';
peopleArray['mark_callahan'] = 'Mark Callahan,<br/>Vice President,<br/>Transition Management<br/><span>214.978.4748 | <a href="mailto:mcallahan@capis.com">mcallahan@capis.com</a></span><img src="/images/people/mark_callahan.jpg"/>';
peopleArray['marty_kearny'] = 'Marty Kearny,<br/>Client Service Representative<br/><span>214.978.4754| <a href="mailto:mkearney@capis.com">mkearney@capis.com</a></span><img src="/images/people/marty_kearny.jpg"/>';
peopleArray['matthew_kiselica'] = 'Matthew Kiselica,<br/>International Trading<br/><span>866.349.6216| <a href="mailto:mkiselica@capis.com">mkiscelia@capis.com</a></span><img src="/images/people/matthew_kiselica.jpg"/>';
peopleArray['michael_sargent'] = 'Michael Sargent,<br/>Vice President,<br/>Research Sales<br/><span>8214.978.4734| <a href="mailto:msargent@capis.com">msargent@capis.com</a></span><img src="/images/people/michael_sargent.jpg"/>';
peopleArray['mike_dunlap'] = 'Mike Dunlap,<br/>Trading Support<br/><span>800.527.5756| <a href="mailto:mdunlap@capis.com">mdunlap@capis.com</a></span><img src="/images/people/mike_dunlap.jpg"/>';
peopleArray['monique_tollen'] = 'Monique Tollen,<br/>Assistant Vice President,<br/>Assistant Operations Manager<br/><span>214.978.4705 | <a href="mailto:mtollen@capis.com">mtollen@capis.com</a></span><img src="/images/people/monique_tollen.jpg"/>';
peopleArray['neil_decker'] = 'Neil Decker,<br/>Senior Vice President,<br/>Director of Fixed Income Trading<br/><span>800.247.8888 | <a href="mailto:ndecker@capis.com">ndecker@capis.com</a></span><img src="/images/people/neil_decker.jpg"/>';
peopleArray['scott_gillespie'] = 'Scott Gillespie,<br/>Vice President,<br/>Research Sales<br/><span>214.978.4785 | <a href="mailto:sgillespie@capis.com">sgillespie@capis.com</a></span><img src="/images/people/scott_gillespie.jpg"/>';
peopleArray['stacy_hedgecoke'] = 'Stacy Hedgecoke,<br/>Trading Assistant<br/><span>800.527.5756| <a href="mailto:shedgecoke@capis.com">shedgecoke@capis.com</a></span><img src="/images/people/stacy_hedgecoke.jpg"/>';
peopleArray['stephanie_molina'] = 'Stephanie Molina,<br/>Trading Assistant<br/><span>800.527.5756| <a href="mailto:smolina@capis.com">smolina@capis.com</a></span><img src="/images/people/stephanie_molina.jpg"/>';
peopleArray['stephanie_moore'] = 'Stephanie Moore,<br/>Supervisor of Equity Clearing<br/><span>214.978.4722| <a href="mailto:smoore@capis.com">smoore@capis.com</a></span><img src="/images/people/stephanie_moore.jpg"/>';
peopleArray['wendy_dailey'] = 'Wendy Dailey,<br/>Senior Vice President, Director of Business Development<br/><span>214.978.4767 | <a href="mailto:wdailey@capis.com">wdailey@capis.com</a></span><img src="/images/people/wendy_dailey.jpg"/>';
peopleArray['al_tadeo'] = 'Al Tadeo,<br/>Assistant Vice President,<br>Fixed Income Trader<br/><span>800.247.8888 | <a href="mailto:atedeo@capis.com">atadeo@capis.com</a></span><img src="/images/people/al_tadeo.jpg"/>';
peopleArray['patrick brown'] = 'Patrick Brown,<br/>First Vice President,<br/>Institutional Sales <br/><span>214.922.3239 | <a href="mailto:pbrown@capis.com">pbrown@capis.com</a></span><img src="/images/people/patrick_brown.jpg"/>';
peopleArray['mike_peters'] = 'Mike Peters,<br/>First Vice President,<br/>Equity Trading<br/><span>800.527.5756 | <a href="mailto:mpeters@capis.com">mpeters@capis.com</a></span><img src="/images/people/mike_peters.jpg"/>';
peopleArray['andy_buitron'] = 'Andy Buitron,<br/>Product Manager,<br/>Performance Reporting<br/><span>214.922.3258 | <a href="mailto:abuitron@capis.com">abuitron@capis.com</a></span><img src="/images/people/andy_buitron.jpg"/>';