var old_id=1; var oby=0.125; var oby_i=0.1; var stop=0; var ww=17; var rot=0;
var cy_t = 5;
function fad_in() {
	cur_O = parseFloat(cu_zone.style.opacity);
	new_O = cur_O+oby;
	cu_zone.style.opacity = new_O;
	cur_i_O = parseFloat(new_img.style.opacity);
	new_i_O = cur_i_O+(oby_i);
	new_img.style.opacity = new_i_O;
}

function hi_vi()
{
	for(i=1; i<=cy_t; i++)
	{
		document.getElementById("str5_"+i).style.display="none";
	}
	z_id.style.display = "block";
}

function eoc()
{
	clearInterval(sInt);
	this.stop=0;
	if(this.rot==1)
	{
		rInt = setInterval("str5_go(9)",5000); this.rot=0;
	}
}

function fade()
{
	ww++;
	if(ww<=8)
	{
		
		cur_O = parseFloat(cu_zone.style.opacity);
		new_O = cur_O-oby;
		cu_zone.style.opacity=new_O;
		cur_i_O = parseFloat(old_img.style.opacity);
		new_i_O = cur_i_O-oby_i;
		old_img.style.opacity = new_i_O;
		
	}
	if(ww==9)
	{
		hi_vi(); fad_in();
	}
	if(ww>9 && ww<17)
	{
		fad_in();
	}
	if(ww == 17)
	{
		eoc();
	}
}
function img_op_reset(id) 
{
			for(i=1; i<=cy_t; i++)
			{
				document.getElementById("str5_img_"+i).style.opacity=0.2;
			}
		document.getElementById("str5_img_"+id).style.opacity=1;
		cu_zone.style.opacity=1;
		this.stop=0;
}

function str5_go(id, go_url) 
{ 
	
	// cycle every 5 sec
	if(id==9)
	{id=old_id+1; if(id==cy_t+1){id=1;}}
	else
	{
		// clear the cycle
		clearInterval(rInt);
		this.rot=1;
	}
	if(this.stop===0)
	{
		this.stop=1;
		
		new_img = document.getElementById("str5_img_"+id);
		old_img = document.getElementById("str5_img_"+old_id); 
		if(new_img.style.opacity==1 && this.ww===17)
		{
			 document.location.href=go_url;
		}
		else
		{
			this.ww=0;
			z_id = document.getElementById("str5_"+id); 
			cu_zone = document.getElementById("str5_zone");
			sInt = setInterval(fade,30);
			old_id = id;
		}
	}
	else
	{
		clearInterval(sInt);
		img_op_reset(id);
		old_id = id;
		str5_go(id, go_url);
	}
}

function str5_cycle(t)
{
	this.cy_t = t;
	rInt = setInterval("str5_go(9)",5000);
}