var testimonialArr = new Array();
testimonialArr[0] = ["Metis is a cut above other PR firms and is easily the most valuable marketing communications team with which I have had the pleasure of working. As a small company with limited resources, Aprius needed Metis to become an extension of our marketing team. They always went above and beyond the call of duty to produce rich PR and marketing campaigns. Metis navigated us through the rapidly evolving landscape of social media, provided invaluable insight into the use of new media channels and tools, and executed a highly successful strategy. The depth of their network and the very nature of the relationships that they have cultivated with industry commentators always reflected positively on us and resulted in excellent, balanced coverage. I wouldn&#39;t hesitate to recommend Metis to any company.", "Craig Thompson, Former Vice President of Marketing <a href='http://www.aprius.com/' target='_blank'  class='dark-bubble-quote-link'>Aprius</a>"];								
testimonialArr[1] = ["Our work with Metis Communications spans over six years. That partnership helped to drive some of the storage industry&#39;s greatest awareness of a fast growing, highly successful company in the market. When Dell acquired EqualLogic in February of 2008, they were amazed at the amount of industry buzz we had created in our PR efforts. I owe a lot of this to the solid relationships the Metis team built with the press and analysts that covered this segment of the market. A truly outstanding effort&hellip;","John Joseph, Vice President of Marketing <a href='http://www.equallogic.com/' target='_blank'  class='dark-bubble-quote-link'>Dell EqualLogic</a>"];		
testimonialArr[2] = ["Metis Communications understands our technology, industry and customers. We needed an agency that could drive our entry into a new market and help build credibility and visibility at a rapid pace – and with Metis we got just that. They have done a superb job of positioning Embotics in the marketplace and connecting us to our primary influencers. We are delighted with both the service we have received and more importantly, the results obtained.","Jay Litkey, President and CEO <a href='http://www.embotics.com/' target='_blank'  class='dark-bubble-quote-link'>Embotics</a>"];	
testimonialArr[3] = ["Metis makes the PR portion of my job simple. They have the right expertise and knowledge that gets us the optimal coverage in our industry, and they are always proactive in identifying areas where we can create more awareness. Life with Metis is good.","Kirsten Foon, Senior Director of Marketing <a href='http://www.embotics.com/' target='_blank'  class='dark-bubble-quote-link'>Embotics</a>"];		
testimonialArr[4] = ["Metis Communications serves as a true partner to Eze Castle Integration and has been integral in increasing our company's visibility within key media outlets in the financial services industry. We consistently count on Metis to proactively drive our public relations initiatives and act as an extension of our marketing team.","Mary Beth West, Director of Marketing <a href='http://www.eci.com/' target='_blank'  class='dark-bubble-quote-link'>Eze Castle Integration</a>"];
testimonialArr[5] = ["Metis Communications is one of the few public relations agencies that will drive and grow your PR program as if it were its own. Metis takes seriously the partnership with its clients, organically becoming a part of your company's extended team, guiding you through ever-increasing levels of market awareness and brand building. With each success, there is a constant eye to the next step, the next challenge – and always with a sense of having fun with it even when working very hard. In every aspect of its practice – from PR to AR, from trade press to business press, from strategy to tactics – Metis demonstrates extraordinary depth of strategic understanding and fearlessness in execution.","Roman Kichorowsky, Senior Director, Public Relations <a href='http://www.falconstor.com/' target='_blank'  class='dark-bubble-quote-link'>FalconStor Software</a>"];		
testimonialArr[6] = ["Metis will always be the first one on my list when it's time to engage with a PR firm. I worked with Metis while I was at two startup virtualization companies: Embotics and VM6 Software. For both companies, Metis' strong data center experience and industry knowledge provided immediate results. Metis has always been able to open doors and maintain relationships with top-tier traditional and online coverage leading to increased visibility, new lead generation and ultimately more sales. They are completely committed to establishing awareness for companies and technologies, even in extremely crowded markets.","Eric Courville, Chief Operating Officer <a href='http://www.futurestateit.com/' target='_blank'  class='dark-bubble-quote-link'>FutureStateIT</a>"];		
testimonialArr[7] = ["Metis Communications worked with Ioxus to establish the company as a thought leader in the ultracapacitor market, launch new products, create an online presence, generate marketing information, and place bylines and industry thought pieces. With Metis' help, Ioxus' website launched a worldwide presence, including social media, leading to more than 25,000 hits to date and reaching millions of readers per month between industry news, Twitter followers, and blog readers.","Chad Hall, Vice President of Sales <a href='http://www.ioxus.com/' target='_blank' class='dark-bubble-quote-link'>Ioxus</a>"];
			
var getHTML_topDiv;
//var getHTML_botDiv;
var newInd;
var bubbleOpen = false;
	
	
$(document).ready(function(){
	
if( $('#leadership').length > 0 || $('#leader-selected').length > 0){
loadLeadership();	
}
	
	//handles testimonial bubble (clicking this link while a quote is open will fade-out the current quote and fade-in a new:random quote)
	$('.toggle-bubble').click(function(){
		var _currQuote = pickRand(testimonialArr);
				randTestimonial(bubbleOpen,_currQuote);
				return false;
		});
	//closes testimonial bubble
	$('.close-bubble').click(function(){
				$('div#dark-bubble').stop(true,true).fadeOut('slow');
				return false;
		});
	//1-UP FOR LEFT COLUMN ITEMS
	$("a.text-bubble").mouseenter(function(){
		$(this).next('span.oneUp').oneUp( {speed:1000, distance:20});
		return false;
		});
		
});//ends doc.ready



//loadLeadership() - handles leader specific calls
function loadLeadership(){
	getHTML_topDiv = $('#leadership').html();
	//getHTML_botDiv = $('#leader-selected').html();
	$('#leadership div.leader div.leader-photo').hover(fadeLeaders, lightLeaders);
	$('#leadership-small div.leader-small div.leader-photo').hover(fadeLeaders, lightLeaders);
	
	
	$('a[href=#backButton]').click(function(){
			$('#leadership-small').stop(true,true).animate({'opacity':'0'},'fast').css('display','none');
			$('#leader-selected').css({'display':'none','opacity':'0'});
			$('#leadership').html(getHTML_topDiv).css('z-index','1000').stop(true,true).fadeIn('slow');
			$('#leadership div.leader div.leader-photo').hover(fadeLeaders, lightLeaders);
    		return false;
		});
	};
	
function lightLeaders(){
	$(this).parent().siblings().stop(true,true).animate({opacity:1}, 'slow');
	return false;
	}
function fadeLeaders(){
	$(this).parent().siblings().stop(true,true).animate({opacity:0.4}, 'slow');
	return false;
	}	
function parseLeader(trigger, index){			
		var imgSrc;
		var newImg;
		var dosName;
		var dosTitle;
		var dosBio;
		var _targetID;
		var _selElem = trigger;
		var _currInd = index;
		var _target = _selElem.hasClass('leader-small');
		
		//IE SUCKS* - no support for :nth-child(), ugh.
		switch (_currInd){
			case 1:
				_targetID = 'MelanieLord';
				break;
			case 2:
				_targetID = 'CourtneyHurst';
				break;
			case 3:
				_targetID = 'MelissaCohen';
				break;
			case 4:
				_targetID = 'CathyCaldeira';
				break;
			case 5:
				_targetID = 'KatieSullivan';
				break;
			}
	
			
		switch (_target){
			case false:
							//set vars for clicked element
							imgSrc = _selElem.find('.leader-photo img').attr('src');
							newImg = imgSrc.split('.png').join('-selected.png');
							dosName = _selElem.find('div.leader-name').html();
							dosTitle = _selElem.find('div.leader-title').html();
							dosBio = _selElem.find('div.leader-bio').html();
							//set actions for clicked element
							$('#leadership-small').css('display','block').stop(true,true).animate({'opacity':1},'fast');
							//IE SUCKS*
							$('#leadership-small #'+_targetID+'SM').stop(true,true).animate({'opacity':0},'fast').css('display','none');
							$('#leadership-small #'+_targetID+'SM').siblings().css('display','block').stop(true,true).animate({'opacity':1},'fast');
							//$('#leadership-small div.leader-small:nth-of-type('+_currInd+')').stop(true,true).animate({'opacity':0},'fast').css('display','none');
							//$('#leadership-small div.leader-small:nth-of-type('+_currInd+')').siblings().css('display','block').stop(true,true).animate({'opacity':1},'fast');
							_selElem.parent().stop(true,true).fadeOut('fast').empty();
							$('#backToLeaders').stop(true,true).animate({opacity:1}, 'slow');
				break;
			case true:
							//set vars for clicked element
							$('#leadership').html(getHTML_topDiv);
							imgSrc = _selElem.find('.leader-photo img').attr('src');
							newImg = imgSrc.split('-small.png').join('-selected.png');
							//IE SUCKS*
							dosName = $('#leadership  #'+_targetID).find('div.leader-name').html();
							dosTitle = $('#leadership  #'+_targetID).find('div.leader-title').html();
							dosBio = $('#leadership  #'+_targetID).find('div.leader-bio').html();
							
							//dosName = $('#leadership .leader:nth-of-type('+newInd+')').find('div.leader-name').html();
							//dosTitle = $('#leadership .leader:nth-of-type('+newInd+')').find('div.leader-title').html();
							//dosBio = $('#leadership .leader:nth-of-type('+newInd+')').find('div.leader-bio').html();
							//set actions for clicked element
							$('#leadership-small').css('display','block').stop(true,true).animate({'opacity':1},'fast');
							_selElem.stop(true,true).fadeOut('fast').css('display','none');
							_selElem.siblings().stop(true,true).fadeIn('fast');
							$('#leader-selected').stop(true,true).animate({opacity:0}, 'slow').css('display','none');
				break;
			};
		return featureLeader(newImg,dosName,dosTitle,dosBio);
	};

	function featureLeader(photo,name,title,bio){
		$('#leader-selected div#dossier-photo').empty().append('<img src=./'+photo+'>');
		$('#leader-selected #dossier dl#dossier-layout dt#dossier-selected-name').empty().append(name);
		$('#leader-selected #dossier dl#dossier-layout dd#dossier-selected-bio').empty().append('<span class="main-text">'+title+'<br/>'+bio+'</span>').stop(true,true).fadeIn();
		$('#leader-selected #dossier').css('display','block');
		$('#leader-selected').css('display','block').stop(true,true).animate({opacity:1}, 'slow');
		
		return false;
		};

//GETS RANDOM CHILD OF ANY ARRAY OBJECT - USAGE - pickRand(obj)
function pickRand(obj){
	var r = $(obj);
	var randSel = Math.floor(Math.random() * r.length);
	return randSel;
	}
//GETS RANDOM TESTIMONIAL FOR BLURBS ON EACH PAGE
function randTestimonial(bool, _currQuote){
		var bubBool = bool;
		var content = testimonialArr[_currQuote][0];
		var author = testimonialArr[_currQuote][1];
		
		switch (bubBool){
			case true:
							bubbleOpen = true;
							$('.dark-bubble-quote','div#dark-bubble').html(content);
							$('.dark-bubble-quote-auth','div#dark-bubble').html(author);
							$('div#dark-bubble').fadeIn('slow');
				break;
			case false:
							$('div#dark-bubble').fadeOut('slow', function(){
									bubbleOpen = false;
									$('.dark-bubble-quote','div#dark-bubble').html(testimonialArr[_currQuote][0]);
									$('.dark-bubble-quote-auth','div#dark-bubble').html(testimonialArr[_currQuote][1]);
									$('div#dark-bubble').fadeIn('slow');
								});
				break;
			};
			return false;
};


