function logoToolTip(){
	// Hover effect for Header Logo home link
	//console.log('ah yeah');
	var logoLink = $('headerLogo');
	//get the image
	var logoImg = logoLink.getChildren('img');
	logoImg = logoImg[0];
	//console.log(logoImg);
	// a:link title
	var toolTipText = logoLink.title;
	
	// remove the title,alt for firefox debug. leaving it in generates extraneous events
	logoLink.removeProperty('title');
	logoImg.removeProperty('alt');
	
	
	//create the tooltip DIV
	var toolTip = new Element('div',{'class':'tooltip','id':'LogoToolTip','html':toolTipText});
	//invisible!
	toolTip.setStyles({'opacity':0,'top':'35px','left':'135px'});
	
	
	if(!(Browser.Platform.win && Browser.Engine.name == 'trident' && Browser.Engine.version<='5')){
		//if not IE 6,7,8
		//create the little arrow graphic
		var arrow = new Element('img',{'class':'tooltip-arrow','id':'LogoToolTipArrow','src':'assets/templates/atm/images/tooltip-header-arrow.gif'});
		//stick the arrow inside the tooltip
		toolTip.grab(arrow);
	}
	
	
	//stick the tooltip inside the link.
	$('head-wrap').grab(toolTip);
	
	//create morph obj
	headerTooltipMorph = new Fx.Morph('LogoToolTip',{'link':'cancel','duration': 'normal', 'transition': Fx.Transitions.Sine.easeInOut});
	var showTooltip = function(){
			var dest = 127;
			if(Browser.Platform.win && Browser.Engine.name == 'trident' && Browser.Engine.version<='5'){
				var dest = 120;
			}
			
			this.start({
					'left': dest, 
					'opacity': 1   
			});
	}
	var hideTooltip = function(){
			 this.start({
					'left': 135, 
					'opacity': 0   
			});
	}
	logoLink.addEvent('mouseover', showTooltip.bind(headerTooltipMorph));
	logoLink.addEvent('mouseout', hideTooltip	.bind(headerTooltipMorph));
	
	//add rollover to link. FF has trouble with link events if you don't remove the title and img alt!
	//logoLink.addEvents({	'mouseover':showTooltip,
	//									 		'mouseout':hideTooltip});
	//console.log(toolTip);
}


function positiveResults(){
	//Positive Results Slide Menu
	//params: id,width of expanded item,timeout,speed (1 is fastest),index of item you want initially opened
	slideMenu.build('resultsList',528,1,30,1);
	//Positive Results Numbers
	//adds number labels to the green tabs
	//get all tabs
	var resultsTabs = $('resultsList').getElements('h4');
	//add labels
	resultsTabs.each(function(theItem,theIndex){
		theItem.set('text',theIndex+1);
	});

}

function newsArticles(){
	// News Media Releases
	// Dynamically generate navigation links from articles
	
	//get all articles
	var newsArticles = $('article-viewport').getElements('div.article');
	
	for(var i=0;i<newsArticles.length;i++){
		//create nav for each article
		var myLI = new Element('li');
		var myLink = new Element('a',{
				'href':'#',
				'html':i+1,
				'id': 'media-navigator-'+i
		});
		//first link is active by default
		myLink.addClass(i==0?'active':'');
		//add clicky event
		myLink.addEvent('click', newsScroll);
		//put link inside LI
		myLI.grab(myLink);
		//put LI inside UL
		$('media').getElement('ul.navigator').grab(myLI);

	}
	
	$('article-viewport').getElement('div.articles').tween('left',0);
	
}

function newsScroll(event){
	event.stop();
	var a = $('article-viewport').getElement('div.articles');
	//console.log(a.getStyle('left'));
//	a.tween('left',Number(a.getStyle('left')) + 10);
	
	var dest = this.id;
	//console.log('this.id=',this.id);
	dest = Number(dest.substring(16));
	//268 is the width of article-viewport
	a.tween('left',dest * -268);
	$('media').getElement('a.active').removeClass('active');
	this.addClass('active');
	
}

function startGallery() {
		var myGallery = new gallery($('myGallery'), {
		timed: true,
		showArrows: false,
		showCarousel: false,
		showInfopane:false,
		fadeDuration:1000,
		embedLinks:false
		});
}


function applyAltTableRowStyle(tableClass){
	if($chk('table.' + tableClass)){
	
		var tables = $$('table.' + tableClass);
		tables.each(
			function(el){
				//console.log(el);
				var count = 0;
				el.getElements('tr').each(
					function(el2) {
						el2.addClass(count++ % 2 == 0 ? 'odd' : 'even');
						//console.log(el);
					});
				
				
			}
		);
	}
}



