var fcontent=new Array();
begintag='';
fcontent[0]='<img src="images/ford_fiesta.png" class="scroll_pic" width="425" height="254">';
fcontent[1]='<img src="images/ford_mondeo.png" class="scroll_pic" width="425" height="254">';
fcontent[2]='<img src="images/ford_focus.png" class="scroll_pic" width="425" height="254">';
closetag='';

function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}


/***********************************************
* 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
***********************************************/

var delay = 3000; //set delay between message change (in miliseconds)
var maxsteps=10; // number of steps to take to change from start color to endcolor
var stepdelay=50; // time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor= new Array(0xfa,0xfa,0xfa); // start color (red, green, blue)
var endcolor=new Array(0,0,0); // end color (red, green, blue)


var fwidth='200px'; //set scroller width
var fheight='2000px'; //set scroller height

var fadelinks=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////


var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=0;
var index=0;


/*Rafael Raposo edited function*/
//function to change content
function changecontent(){
  if (index>=fcontent.length) index=0

	obj = document.getElementById("fscroller")
	opacity = 0;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = 0;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = 0;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = 0;

	
  if (DOM2){
    document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
    if (fadelinks) colorfade(0, 15);
  }
  else if (ie4)
    document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
  index++
}


var fadecounter;
function colorfade(step) {
  if(step<=maxsteps) {	
	opacity = 100/maxsteps*step;
	setOpacity(document.getElementById("fscroller"), opacity)
    step++;
    fadecounter=setTimeout("colorfade("+step+")",stepdelay);
  }else{
    clearTimeout(fadecounter);
    setTimeout("changecontent()", delay);
  }   
}

function nul(){
//null
}


if (window.addEventListener) window.addEventListener("load", changecontent, false)
else if (window.attachEvent) window.attachEvent("onload", changecontent)
else if (document.getElementById) window.onload=changecontent
