// JavaScript Document/*-------------------------------------------------------- *  BEGIN FeatureViewer class *-------------------------------------------------------*/ var FeatureViewer = Class.create();FeatureViewer.prototype.extend({	initialize: function() {		//get and cache dom references		this.containerNode = document.getElementById("FVContainer");		this.contentNode = document.getElementById("FVContent");		this.navNode = document.getElementById("FVNav");		//this.readBtn = document.getElementById("FVReadBtn");		this.arrNavs = this.navNode.getElementsByTagName("a");				//build shadow node		this.shadowNode = this.contentNode.cloneNode(1);		this.shadowNode.id = "FVContentShadow";		this.containerNode.appendChild(this.shadowNode);		this.arrContent = this.contentNode.childNodes;		this.arrContentShadow = this.shadowNode.childNodes;		//set input arrays		//this.arrImages = new Array();		this.arrLinks = new Array();				//cache these values so we don't have to calculate later		this.contentLength = 0;		this.selectedItem = 0;		//set timer durations				this.rotateDuration = 10000;		this.idleDuration = 10000;		this.navCloseDuration = 10000;			},		start: function() {		this.contentLength = this.arrLinks.length;		//preload images		//for (var i=0;i<this.contentLength;i++) {			//this.preload(this.arrImages[i]);		//}				this.swapItem(1);		this.startIdle();	},		swapItem: function(item) {		 	if (!item) {	 		//this is an automated swap	 		if (this.selectedItem == this.contentLength) {	 			item = 1;	 		} else {	 			item = this.selectedItem+1;	 		}	 	} else {	 		this.stopAllTimers();	 	}	 		 	this.selectedItem = item;	 	var index = item-1;	 		 	this.renderContent(index);	 	this.highlightNav(index);	 		},		stopAllTimers: function() {		this.stopDelayedNavClose();		this.stopIdle();		this.stopRotation();	},		startIdle: function() {		this.stopDelayedNavClose();		this.stopIdle();		this.stopRotation();		this.idleInterval = setInterval("fv.startRotation()",this.idleDuration);	},		stopIdle: function() {		clearInterval(this.idleInterval);	},		startRotation: function() {		this.stopIdle();		this.startDelayedNavClose();		this.rotateInterval = setInterval("fv.swapItem()",this.rotateDuration);	},		stopRotation: function() {		clearInterval(this.rotateInterval);	},		startDelayedNavClose: function () {		this.stopDelayedNavClose();		this.navCloseInterval = setInterval("fv.closeNav()",this.navCloseDuration);	},		stopDelayedNavClose: function() {		clearInterval(this.navCloseInterval);	},	openNav: function() {		fv.navNode.style.width = "188px";		//clear existing event if it exists		if ( fv.navNode.detachEvent ) {			fv.navNode.detachEvent( "onmouseover", fv.openNav );		} else {			fv.navNode.removeEventListener( "mouseover", fv.openNav, false );		}		//set an event to close nav onmouseout		if ( fv.navNode.attachEvent ) {			fv.navNode.attachEvent( "onmouseout", fv.closeNav );		} else {			fv.navNode.addEventListener( "mouseout", fv.closeNav, false );		}		//addEvent(fooNode,"mouseout",fv.closeNav);		//fv.startDelayedNavClose();	},	closeNav: function() {		fv.stopDelayedNavClose();		fv.navNode.style.width = "33px";		//clear existing event		if ( fv.navNode.detachEvent ) {			fv.navNode.detachEvent( "onmouseout", fv.closeNav );		} else {			fv.navNode.removeEventListener( "mouseout", fv.closeNav, false );		}		//set an event to open nav onmouseover		if ( fv.navNode.attachEvent ) {			fv.navNode.attachEvent( "onmouseover", fv.openNav );		} else {			fv.navNode.addEventListener( "mouseover", fv.openNav, false );		}		//this.resizeNav(160,18,10);	},		resizeNav: function(start,end,interval) {		this.navNode.style.width = start + "px";		var newStart = start - 20;		if (newStart > end) {			setTimeout("fv.resizeNav("+newStart+","+end+")",interval);		}	},		contentLink: function() {		document.location.href = fv.arrLinks[fv.selectedItem-1];	},	renderContent: function(index) {				//clear content	 	for (var i=0;i<this.contentLength;i++) {	 		this.arrContent[i].style.display = "none";	 		this.arrContentShadow[i].style.display = "none";	 	}		//show content	 	this.arrContent[index].style.display = "block";	 	this.arrContentShadow[index].style.display = "block";	 	//this.containerNode.style.backgroundImage = "url("+this.arrImages[index]+")";	 	//to be safe, remove old link event		if ( fv.contentNode.detachEvent ) {			fv.contentNode.detachEvent( "onclick", fv.contentLink );		} else {			fv.contentNode.removeEventListener( "click", fv.contentLink, false );		}	 	//add content hotspot		if ( fv.contentNode.attachEvent ) {			fv.contentNode.attachEvent( "onclick", fv.contentLink );		} else {			fv.contentNode.addEventListener( "click", fv.contentLink, false );		}	 	//this.readBtn.setAttribute("href",this.arrLinks[index]);	},		highlightNav: function(index) {	 	for (var i=0;i<this.arrContent.length;i++) {	 		//this.arrNavs[i].className = "";			hilite('fbut'+(i+1),'fbut'+(i+1));	 	}	 	//this.arrNavs[index].className = "FVNavOn";		hilite('fbut'+(index+1),'fbut'+(index+1)+'on');	},		preload: function(url) {		var img = new Image;		img.src = url;		//this.arrImages.push(url);	}});/*-------------------------------------------------------- *  END FeatureViewer class *-------------------------------------------------------*/
