function p_o(o){return document.getElementById(o);}

function slideshow()
{
	
	for (var i=1; i<=dln; i++)
	{
		if(p_o('em_dl'+i).style.display=='block')
		{
			if (i==dln)
			{
				
				p_o('em_dl'+i).style.display='none';
				p_o('em_dl1').style.display='block';
				
				if (p_o('ctrlbr_next_text_1'))
				{
				p_o('ctrlbr_next_text_1').innerHTML='<div style="margin-left:8px"><b>Next:</b> <font size="1">'+p_o('sub_hd_2').innerHTML+'</font></div>';
				}
				else if (p_o('ctrlbr_next_text_1'))
				{
				p_o('ctrlbr_next_text_1').innerHTML='<div style="margin-left:8px"><b>Next:</b> <font size="1">'+p_o('sub_hd_2').innerHTML+'</font></div>';
				}
				return;
			}
			else
			{
			var active_dl=i+1;
			p_o('em_dl'+i).style.display='none';
			p_o('em_dl'+active_dl).style.display='block';
			
				if(i==dln-1)
				{
				
				if(p_o('ctrlbr_next_text_'+(active_dl)))
				{
				p_o('ctrlbr_next_text_'+(active_dl)).innerHTML='<div style="margin-left:8px"><b>Next:</b> <font size="1">'+p_o('sub_hd_1').innerHTML+'</font></div>';
				}
				else if (p_o('ctrlbr_next_text_'+(active_dl)))
				{
				p_o('ctrlbr_next_text_'+(active_dl)).innerHTML='<div style="margin-left:8px"><b>Next:</b> <font size="1">'+p_o('sub_hd_1').innerHTML+'</font></div>';
				}
				}
				else
				{
					
				if(p_o('ctrlbr_next_text_'+(active_dl)))
				{
				p_o('ctrlbr_next_text_'+(active_dl)).innerHTML='<div style="margin-left:8px"><b>Next:</b> <font size="1">'+p_o('sub_hd_'+(active_dl+1)).innerHTML+'</font></div>';
				} 
				else if(p_o('ctrlbr_next_text_'+(active_dl)))
				{
				p_o('ctrlbr_next_text_'+(active_dl)).innerHTML='<div style="margin-left:8px"><b>Next:</b> <font size="1">'+p_o('sub_hd_'+(active_dl+1)).innerHTML+'</font></div>';
				}
				}
			return;
			}
		}
	}
}

function em_dl_p()
{

for (var i=1; i<=dln; i++)
{
if (p_o('em_dl'+i).style.display=='block')
{
if (i==1)
{
p_o('em_dl'+i).style.display='none';
p_o('em_dl'+dln).style.display='block';

if (p_o('ctrlbr_next_text_1'))
{
	p_o('ctrlbr_next_text_1').innerHTML='<div style="margin-left:8px"><b>Next:</b> <font size="1">'+p_o('sub_hd_2').innerHTML+'</font></div>';
} 
else if (p_o('ctrlbr_next_text_1'))
{
p_o('ctrlbr_next_text_1').innerHTML='<div style="margin-left:8px"><b>Next:</b> <font size="1">'+p_o('sub_hd_2').innerHTML+'</font></div>';
}
return;
}
else
{
p_o('em_dl'+i).style.display='none';
p_o('em_dl'+(i-1)).style.display='block';

if (p_o('ctrlbr_next_text'+(i-1)))
{
p_o('ctrlbr_next_text'+(i-1)).innerHTML='<div style="margin-left:8px"><b>Next:</b> <font size="1">'+p_o('sub_hd_'+(i)).innerHTML+'</font></div>';
} 
else if (p_o('ctrlbr_next_text'+(i-1)))
{
p_o('ctrlbr_next_text'+(i-1)).innerHTML='<div style="margin-left:8px"><b>Next:</b> <font size="1">'+p_o('sub_hd_'+(i)).innerHTML+'</font></div>';
}
return;
}
}
}
}


function em_dl_next()
{
if (dln>1)
{
em_cl_int();
slideshow();
}
}

function em_dl_previous()
{
if (dln>1)
{
em_cl_int();
em_dl_p();
}
}

function em_dl_pause()
{
if (dln>1)
{
var anc=p_o('em_ctrlbar_btns').getElementsByTagName('img');
if (anc[1].src.indexOf('pause.gif')!=-1)
{
em_cl_int();
}
else
{
em_st_int();
}
}
}

function em_st_int()
{
b_int=setInterval('slideshow()',dl_speed);
var anc=p_o('em_ctrlbar_btns').getElementsByTagName('img');
anc[1].src=anc[1].src.replace(/pause_d.gif/i, 'pause.gif');
}

function em_cl_int()
{
b_int=clearInterval(b_int);
var anc=p_o('em_ctrlbar_btns').getElementsByTagName('img');
anc[1].src=anc[1].src.replace(/pause.gif/i, 'pause_d.gif');
}

