<!--//

/***********rotation**************/

//files must be within the images dir and called rotate1.jpg (function initializepic(1))  
//and rotatesub1.jpg (function initializepic(2)) (set used for subpages)
//or you can customize this via the var below


	var arrMax=new Array();
	arrMax["main"]=5;
	arrMax["about"]=5;
	arrMax["funding"]=5;
	arrMax["news"]=5;
	
	var maxnum;
	var curpic;	
	var nextnum;
	var head="images/rotate/";
	var tail=".jpg";
	var r_speed=5;	//the lower, the slower
	var r_pause=5000;
	//var i_obj;
	//id of the img to be rotated
	var r_objid1="rotate";
	var r_objid2="rotate2";
	var threshold=0;
	//hold the prefix for sub images
	//var subhead="";	
		
	//p_where= name of sub folder within the rotate dir.
	//p_level: 0=main, 1=sub (../), 2=subsub (../../) ec.
	function initializepic(p_where, p_level)
	{
		var thecode;
		var i;
		
		maxnum=arrMax[p_where];
		//curpic=Math.floor(Math.random()*(maxnum))+1;	
		curpic=1;
		nextnum=(curpic>=maxnum ? 1 : (curpic+1));
		
		if(p_level>0)
		{
			for(i=1; i<=p_level; i++)
			{
				//image diretcory location
				head="../"+head;
			}
		}
		
		if(p_where!="")
		{
			//sub
			head=head+p_where+"/banner";
		}

		thecode='<img id="rotate2" src="'+head;
		thecode=thecode+nextnum;
		thecode=thecode+tail+'" alt="RDC. A Catalyst for Growth." name="rotate2" border="0"';
		thecode=thecode+'>';
				
		document.writeln(thecode);
		r_init();
	}
	
	function returnnextnum()
	{
		return nextnum;
	}
	
	function r_init()
	{
		var iobj=document.getElementById(r_objid2);
		var myArray = new Array(maxnum);
		
		//preload
		if(maxnum>=3)		{			
			
			for(var i=3;i<=maxnum;i++)
			{
				myArray[i]=new Image();
				myArray[i].src = head+i+tail;
			}		
		}
				
		iobj.src=head+nextnum+tail;
		
		setTimeout('rotate()',r_pause);
	}
	
	//rotate_show
	function rotate()
	{
		var i_obj=document.getElementById(r_objid1);
		var r_obj=document.getElementById(r_objid2);
			
		//gently show it
		rfade(r_obj.id,0,((1)*r_speed),1);
		
		//gently fade it
		rfade(i_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+');',60);
		}else{	
			changeimg();	
		}
	}
		
	function changeimg()
	{
		var cobj1=document.getElementById(r_objid1);
		var cobj2=document.getElementById(r_objid2);
		
		threshold=(threshold==0 ? 1 : 0);
		
		if(threshold==1)
		{
			curpic=nextnum;
			nextnum=(nextnum>=maxnum ? 1 : (curpic+1));			
			
			cobj1.src=head+nextnum+tail;
			//cobj1.className="rotate_show";
			r_objid1=cobj2.id;
			
			//cobj2.className="rotate_hidden";
			r_objid2=cobj1.id;
			
			//start cycle again		
			setTimeout('rotate()',r_pause);
		}
	}
	
	
	/***********end rotation**************/

//-->
