<!--

var curpic=1;
var maxnum=5;
var nextnum;
var head="images/banner";
var tail=".jpg";
var r_speed=5;	
var r_pause=5000;
var i_obj;

function r_init()
{
	if(preloadFlag)
	{
		i_obj=document.getElementById("banner");
		setTimeout('rotate()',r_pause);
	}else{
		setTimeout('r_init()',1000);
	}
}

function rotate()
{
	var r_obj=document.getElementById("bannerimg");
		
	nextnum=(curpic>=maxnum ? 1 : (curpic+1));
	
	//change backgroung image	
	i_obj.className="banner"+nextnum;
	
	//gently fade it to show new background image
	rfade(r_obj.id,100,((-1)*r_speed),1);
	//gently fade text
	rfade("bannertext"+curpic,100,((-1)*r_speed),2);
	
}
	
function rfade(p_obj,p_alpha,p_speed,p_change)
{
	//this will cause the object to fade / appear.  p_alpha is the current opacity, the speed is the interval amount.  negative amount will cause it to fade, pos. will cause it to appear.
	//0 is nothing, 100 is full
	//if p_change=1, then proceed to change to the next image (only if it is increment is <0)
	//if p_change=2, then proceed to change to the next text (only if it is increment is <0)

	var robj=document.getElementById(p_obj);
	var r_speed=p_speed;
	var r_alpha=p_alpha+p_speed;

	//just in case
	if(r_alpha>=100)
	{
		r_alpha=100;
	}else if(r_alpha<=0){
		r_alpha=0;
	}

	//safari / mozilla
	robj.style.opacity=(r_alpha/100);
	//IE
	robj.style.filter = 'alpha(opacity=' + r_alpha + ')';


//alert(p_obj+" "+p_alpha);
	if(((r_alpha+r_speed)>=0) && ((r_alpha+r_speed)<=100))
	{	
		setTimeout('rfade("'+p_obj+'",'+r_alpha+','+p_speed+','+p_change+');',50);
	}else{	
		if(r_speed>0)
		{
			robj.style.visibility="visible";
		}else if(r_speed<0){
			robj.style.visibility="hidden";
			if(p_change==1)
			{
				changeimg();
			}else if(p_change==2){
				changetext(curpic,nextnum);
			}		
		}					
	}
}
	
function changeimg()
{
	var cobj=document.getElementById("bannerimg");
	
	cobj.src=head+nextnum+tail;
	cobj.style.visibility="visible";
	//safari / mozilla
	cobj.style.opacity=1.0;
	//IE
	cobj.style.filter = 'alpha(opacity=100)';
		
	//start cycle again
	curpic=nextnum;
	setTimeout('rotate()',r_pause);
}

function changetext(p_curpic,p_nextnum)
{
	//text
	cobj=document.getElementById("bannertext"+p_curpic);
	cobj.style.visibility="hidden";
	
	cobj=document.getElementById("bannertext"+p_nextnum);
	cobj.style.visibility="visible";
	//safari / mozilla
	cobj.style.opacity=0;
	//IE
	cobj.style.filter = 'alpha(opacity=0)';	
	
	rfade(cobj.id,0,(r_speed),0);
}
	
// -->