﻿function Is(){
	var appName = navigator.appName;
	var version = navigator.appVersion;
	
	this.ns = ( appName == "Netscape" );
	this.ns4 = this.ns && version.indexOf("4.")!=-1;
	this.ns5 = this.ns && version.indexOf("5.")==0;
	this.ns6 = ( this.ns5 || (this.ns && version.indexOf("6.")!=-1) );

	this.ie = ( appName == "Microsoft Internet Explorer" );
	this.ie4 = this.ie && version.indexOf("MSIE 4.")!=-1;
	this.ie5 = this.ie && version.indexOf("MSIE 5.")!=-1;
	this.ie6 = this.ie && version.indexOf("MSIE 6.")!=-1;
	
	var userAgent = navigator.userAgent.toLowerCase()
	this.mac = ( userAgent.indexOf( "mac" ) != -1 )
	this.win = ( userAgent.indexOf( "windows" ) != -1 )
	this.linux = ( userAgent.indexOf( "linux" ) != -1 )
}
Is.prototype.toString = function(){
	var s = ''
	for( var i in this ){
		s += i + ': ' + this[i] + '\n'
	}
	return s;
}
var is = new Is();

//resize fix for netscape 4
function resize(){
		if ( scrW != window.innerWidth || scrH != window.innerHeight )
			location.reload()
}
if ( is.ns4 ){
	var scrW = window.innerWidth;
	var scrH = window.innerHeight;
	onresize=resize;
}

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
);
