/*
	Super simple subtitution of jQuery InnerFade which causes Safari 2.0.4 to crash
*/

Rotate = function(objid, interval, varname){

	this.hide = function(i){
		toRotate[i].style.display = 'none';
	}
	
	this.show = function(i){
		toRotate[i].style.display = 'block';
	}
	
	this.update_visibility = function(){
		next = active + 1;
		if (next == toRotate.length) next = 0;
		this.hide(active);
		this.show(next);
		active = next;
		setTimeout(varname + '.update_visibility()', interval);
	}
	
	
	var container = document.getElementById(objid) ;
	var children = container.childNodes;
	var interval = interval;
	var varname = varname;
	
	var toRotate = new Array();
	
	for (i = 0; children.length > i ; i++){

//		why this doesn't work in Safari I've no idea		
//		if (children[i] instanceof HTMLDivElement){
		if (children[i].tagName ==  'DIV'){			
			toRotate.push(children[i]);
		}
	}
	
	for (i = 1; toRotate.length > i ; i++){
		this.hide(i);
	}
	var active = 0;
    setTimeout(varname + '.update_visibility()', interval);	
}
