﻿function Feature( imgSrc, imgAlt, imgCoords, subjectText, subjectLink, captionX, captionY ){
	this.imgSrc = imgSrc;
	this.imgAlt = imgAlt;
	this.imgCoords = imgCoords;
	this.subjectText = subjectText;
	this.subjectLink = subjectLink;
	this.captionX = captionX;
	this.captionY = captionY;
	Feature[ this.name ] = this;
	Feature.all[ Feature.all.length ] = this;
}
Feature.all = new Array();

function writeHomeFeature(){
	//get a random feature
		var r = ( Math.floor ((Math.random() * Feature.all.length)) );
		var feature = Feature.all[r];
	//move the caption
		var captionObj = document.getElementById( "homeFeatureCaption" );
		captionObj.style.top = feature.captionY+"px";
		captionObj.style.left = feature.captionX+"px";
	//write some content to the caption
		captionObj.innerHTML = feature.subjectText;
	//write the image
		var html = '<map name="featureImgMap"><area alt="" shape="circle" coords="' + feature.imgCoords + '" ';
		if( feature.subjectLink ){
			html += 'href="' + feature.subjectLink + '" '
		}
		html += ' onmouseover="showCaption(true)" onmouseout="showCaption(false)"></map><img name="featureImg" src="/images/' + feature.imgSrc + '" width="770" height="316" alt="" border="0" usemap="#featureImgMap" />';
		document.write( html );
}


var interval = 50;
function getCaptionObj(){ //this must be a fcn: homeFeatureCaption doesn't yet exist when this file is called
	return document.getElementById( "homeFeatureCaption" );
}

function showCaption( showIt ){
	captionObj = getCaptionObj();
	
	if( showIt ){ //show
		if( is.ie && is.win ){ //filters for IE
			for( var i=0; i<8; i++ ){ setTimeout( 'captionObj.filters.alpha.opacity="' +i+ '0"', i*interval ); }
		}
		else{ //opacity for everyone else
			for( var i=0; i<8; i++ ){ setTimeout( 'captionObj.style.opacity="' + (i/10) + '0"', i*interval ); }
		}
	}
	else{ //hide
		var k = 0;
		if( is.ie && is.win ){ //filters for IE	
			for( var j=7; j>=0; j-- ){ setTimeout( 'captionObj.filters.alpha.opacity="' +j+ '0"', k*interval ); k++; }
		}
		else{ //opacity for everyone else
			for( var j=7; j>=0; j-- ){ setTimeout( 'captionObj.style.opacity="' + (j/10) + '0"', k*interval ); k++; }
		}
	}
}
/*
usage: varname = new Feature(
	imgSrc,
	imgAlt,
	imgCoords,
	subjectText,
	subjectLink,
	captionX,
	captionY
)
*/
new Feature(
	'home_feature_joel.jpg',
	'wisdom + conviction',
	'328,123,123',
	'Joel Romines, Managing Principal',
	'/team/jRomines.asp',
	90,
	90
);
//new Feature(
//	'home_feature_ellen.jpg',
//	'trust + experience',
//	'373,94,120',
//	'Ellen Heald, Principal and Chief Financial Officer',
//	'/team/eHeald.asp',
//	104,
//	34
//);
new Feature(
	'home_feature_barbara.jpg',
	'drive + discernment',
	'239,161,120',
	'Barbara Piette, Managing Principal',
	'/team/bPiette.asp',
	318,
	93
);
//new Feature(
//	'home_feature_rich.jpg',
//	'insight + innovation',
//	'438,120,110',
//	'Rich Castleberry, Principal and Director of Research',
//	'/team/rCastleberry.asp',
//	159,
//	75
//);

//new Feature(
//	'home_feature_eileen.jpg',
//	'commitment + connection',
//	'524,133,120',
//	'Eileen Donohue, Principal and Investor Liaison',
//	'/team/EileenDonohue.asp',
//	250,
//	33
//);
new Feature(
	'home_feature_george.jpg',
	'focus + expertise',
	'500,130,130',
	'George Arnold, Managing Principal',
	'/team/gArnold.asp',
	208,
	62
);

/* controls dropdown nav */
startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("navHolder");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

/* team page rollovers */
function showTeam(who){
	msgDiv=document.getElementById('teamMsgDiv')
	msg=''
	if(who){
		msg=who.getAttribute('alt');
		msgDiv.style.visibility='visible';
	}
	else{
		msg='';
		msgDiv.style.visibility='hidden';
	}
	msgDiv.innerHTML=msg;
}

