var ScrollObjectMade = false;
var ScrollObjectMade2 = false;
function high(which2){
	theobject=which2
	highlighting=setInterval("highlightit(theobject)",50)
}
function low(which2){
	clearInterval(highlighting)
	if (which2.style.MozOpacity)
	which2.style.MozOpacity=0.7
	else if (which2.filters)
	which2.filters.alpha.opacity=70
}

function highlightit(cur2){
	if (cur2.style.MozOpacity<1)
	cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
	else if (cur2.filters&&cur2.filters.alpha.opacity<100)
	cur2.filters.alpha.opacity+=10
	else if (window.highlighting)
	clearInterval(highlighting)
}

function switchimg(imagesource,imagealt) {
  if (document.images) {
    document.images.raceimage.src = imagesource;
    document.images.raceimage.alt = imagealt;
  }
  return true;
}

// Time to rotate some graphics, but first we must initialize them. 

function goPrev (prevSet) {
	var i;
	var imagLen=images.length;
	prevSet = parseInt(prevSet);
	for (i=1; i<=4; i++) {
		if (prevSet>=imagLen) {
			//alert("prevSet is greater than imagLen, resetting: " + prevSet + " vs. " + imagLen + " on iteration " + i);
			prevSet=1;
		}
		if (prevSet<1) {
			//alert("prevSet is less than 1, resetting: " + prevSet + " vs. " + fileno + " on iteration " + i);
			prevSet=fileno;
		}
		switch(i) {
			case 1:
				document.fp01_img.src=images[prevSet].src;
				//alert("first image : " + filesum);
				pop1=links[prevSet].value;
				break;
			case 2:
				document.fp02_img.src=images[prevSet].src;
				pop2=links[prevSet].value;
				break;
			case 3:
				document.fp03_img.src=images[prevSet].src;
				pop3=links[prevSet].value;
				break;
			case 4:
				document.fp04_img.src=images[prevSet].src;
				pop4=links[prevSet].value;
				break;
			default:
				//alert("got default, iteration " + i);
				break;
		}
		prevSet = prevSet-1;
	}
	nextSetPage=parseInt(prevSet)+5;
	prevSetPage=parseInt(prevSet);
//	alert("nextsetpage = " +nextSetPage + ", prevsetpage = " + prevSetPage + ", nextSet = " + prevSet);
}
function goNext (nextSet) {
	var i;
	var imagLen=images.length;
	nextSet = parseInt(nextSet);
	for (i=1; i<=4; i++) {
		if (nextSet>=imagLen) {
			//alert("nextSet is greater than imagLen, resetting: " + nextSet + " vs. " + imagLen + " on iteration " + i);
			nextSet=1;
		}
		if (nextSet<1) {
			nextSet=fileno;
		}
		switch(i) {
			case 1:
				document.fp04_img.src=images[nextSet].src;
				pop4=links[nextSet].value;
				//alert("first image : " + filesum);
				break;
			case 2:
				document.fp03_img.src=images[nextSet].src;
				pop3=links[nextSet].value;
				break;
			case 3:
				document.fp02_img.src=images[nextSet].src;
				pop2=links[nextSet].value;
				break;
			case 4:
				document.fp01_img.src=images[nextSet].src;
				pop1=links[nextSet].value;
				break;
			default:
				//alert("got default, iteration " + i);
				break;
		}
		nextSet = nextSet+1;
	}
	nextSetPage=nextSet;
	prevSetPage=nextSet-5;
//	alert("nextsetpage = " +nextSetPage + ", prevsetpage = " + prevSetPage + ", nextSet = " + nextSet);
}

function callBody(){	
	if(scroll) {
		scrollerS.scroll();
	} else {
		setTimeout( "callBody();", 500 );
	}
}
/***********************************************
* Fading Scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
/*Rafael Raposo edited function*/
//function to change content
function changecontent(){
  if (index>=scroller1.length)
    index=1
  if (DOM2){
    document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
    document.getElementById("fscroller").innerHTML=begintag+scroller1[index]+closetag
    if (fadelinks)
      linkcolorchange(1);
	  colorfade(1, 15);
  }
  else if (ie4)
    document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
  index++
}

// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function linkcolorchange(step){
  var obj=document.getElementById("fscroller").getElementsByTagName("A");
  if (obj.length>0){
    for (i=0;i<obj.length;i++)
      obj[i].style.color=getstepcolor(step);
  }
}

/*Rafael Raposo edited function*/
function colorfade(step) {
  if(step<=maxsteps) {	
    document.getElementById("fscroller").style.color=getstepcolor(step);
    if (fadelinks)
      linkcolorchange(step);
    step++;
    fadecounter=setTimeout("colorfade("+step+")",stepdelay);
  }else{
    clearTimeout(fadecounter);
    document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
    setTimeout("changecontent()", delay);
	
  }   
}

/*Rafael Raposo's new function*/
function getstepcolor(step) {
  var diff
  var newcolor=new Array(3);
  for(var i=0;i<3;i++) {
    diff = (startcolor[i]-endcolor[i]);
    if(diff > 0) {
      newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
    } else {
      newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
    }
  }
  return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}