/*
*	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.
*
*  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.
*
*/
//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 = 5000; //milliseconds between flips

//flips through the pictures from first to last *Default*

function FadeForward( )
{
	if(ARPicLinks.length>0)
	{
		if(arPos<ARPicLinks.length-1) 
		{	arPos++; }
		else { arPos=0; }
		
		applyFade();
		document.images.PicFade.src=ARPicLinks[arPos];
		document.images.PicFade.alt=ARPicAlts[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=value;
		window.open(l,"detailview");
		return;
  }	
	if(linktype==2)	{
		l="mailto:"+value
		window.open(l,"detailview");
		return;
	}
}

//TuanNK comment this on 14/6/2007
//if(document.images.PicFade)
{
	//alert("Có chạy");
	window.setTimeout('FadeForward()',DelayTime);
}
//TuanNK comment this on 14/6/2007
/*
*/
