function addEvent( obj, type, fn )
{
	if (obj.addEventListener)
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent)
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

function rotate(obj, l) {
	var speed = 10000;
	
	for(var i=0; i<l; i++) {
		setTimeout("showslide('" + obj + i + "');", speed * i);
	}
	if(l > 1) {
		setTimeout(function() { hideslide(obj, l); rotate(obj, l) }, speed * ( l * 1.2 ) );
	}
}

function hideslide(obj, l) {
	for(var i=0; i<l; i++) {
		document.getElementById(obj + i).className = 'trans0';
		
	}
}

function showslide(slide) {
	if (document.getElementById(slide)) {
		var b = document.getElementById(slide)
		setTimeout(function() { b.className='trans1' }, 500);
		setTimeout(function() { b.className='trans2' }, 600);
		setTimeout(function() { b.className='trans3' }, 700);
		setTimeout(function() { b.className='trans4' }, 800);
		setTimeout(function() { b.className='trans5' }, 900);
		setTimeout(function() { b.className='trans6' }, 950);
	}
}

function adjust_height(obj, l) {
	var height = 0;
	var now;
	for(var i=0; i<l; i++) {
		now = document.getElementById(obj + i).offsetHeight;
		height = now > height ? now : height;
	}
	
	document.getElementById(obj).style.height = height + "px";
	
	for(var i=0; i<l; i++) {
		document.getElementById(obj + i).style.height = height + "px";
		if(l > 1) {
			document.getElementById(obj + i).className = "trans0";
		}
	}
}
