/*
*	Author: Mike Dattilo
*
* Purpose: Allows multiple pictures to be flipped through on a page.  When click either pops up a 
*          link or email... see options below.
*
* Example:
*        <table border=0 cellpadding=2 cellspacing=0><tr><td align=center>
*          <a href="javascript:dolink( )"><img src="/images/construction.gif" name="PicFade" style="filter:revealTrans(duration=3,transition=23)" width=220 height=70 border=0></a></td></tr>
*        </table>
*
* Extension: To use this function for different pages, simply take the first three statements
*            that define the different arrays out of this file and place them on the pages you
*            want to display the fader on and include this file excluding the three array declarations.
*
*/

//location of pictures you want to show
var ARPicLinks=new Array("images/MainImage1.gif","images/MainImage2.gif","images/MainImage3.gif","images/MainImage4.gif");

//type of link you want to make pictures (1 for web, 2 for email)
var ARtpye=new Array(1,1,2,1);

//location for link to go... web page or email address... **DO NOT** include http:// or mailto:
var ARLinks=new Array(" "," "," "," ");

//does the fading
function applyFade(){
	if (document.all) {
		PicFade.style.filter="blendTrans(duration=2)";
		PicFade.style.filter="blendTrans(duration=CrossFadeDuration)";
		PicFade.filters.blendTrans.Apply();
	}
}

var arPos=0;          //where to start in array
var DelayTime = 7500; //milliseconds between flips

//flips through the pictures from first to last *Default*
function FadeForward( ){
	if(arPos<ARPicLinks.length-1) {	arPos++; }
	else { arPos=0; }
	
	applyFade();
	document.images.PicFade.src=ARPicLinks[arPos];
	if(document.all) { PicFade.filters.blendTrans.Play(); }
	window.setTimeout('FadeForward()',DelayTime);
}

//flips through the pictures from last to first -- change statement at bottom to use
function FadeBackward(){
	if(arPos>0) {	arPos--; }
	else  { arPos=ARPicLinks.length-1; }
	
	applyFade();
	document.images.PicFade.src=ARPicLinks[arPos];
	if(document.all) { PicFade.filters.blendTrans.Play(); }
	window.setTimeout('FadeBackward()',DelayTime);
}


//makes either a web link or email link for picture
function dolink( )
{	
	linktype=ARtpye[arPos];
	value=ARLinks[arPos];
	if(linktype==1)   {
		l="http://"+value
		window.open(l,"detailview");
		return;
  }	
	if(linktype==2)	{
		l="mailto:"+value
		window.open(l,"detailview");
		return;
	}
}

window.setTimeout('FadeForward()',DelayTime);
