var toFcs=null;
function p_o(o){return document.getElementById(o);}
function showTab(did,cid,cback){
    if(did==null)return false;
    var div=p_o(did);
    var tab=p_o(cid);
    if(tab==null)return false;
    var tabs=div.childNodes;
    for(var i=0;i<tabs.length;i++){
        if(tabs[i].nodeType==1&&tabs[i]!=tab){
            tabs[i].className='dn';
        }
    }
    tab.className='di';
    if(cback!=null)eval(cback);
    fcs();
}

//DL em starts
function em_dl_f()
{
	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';
			p_o('count').innerHTML=1+'/'+dln;
				if (p_o('ctrlbr_next_text') && p_o('imghead_2'))
				{
				p_o('ctrlbr_next_text').innerHTML='<strong>Next '+ p_o('imghead_2').innerHTML+':</strong> ' +p_o('sub_hd_2').innerHTML;
				}else if (p_o('ctrlbr_next_text'))
				{
				p_o('ctrlbr_next_text').innerHTML='<strong>Next :</strong> ' +p_o('sub_hd_2').innerHTML;
				}
			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)
				{
					p_o('count').innerHTML=dln+'/'+dln;
				if(p_o('ctrlbr_next_text') && p_o('imghead_1'))
				{
				p_o('ctrlbr_next_text').innerHTML='<strong>Next '+ p_o('imghead_1').innerHTML+':</strong> ' +p_o('sub_hd_1').innerHTML;
				}else if (p_o('ctrlbr_next_text'))
				{
				p_o('ctrlbr_next_text').innerHTML='<strong>Next :</strong> ' +p_o('sub_hd_1').innerHTML;
				}
				}
				else
				{
					p_o('count').innerHTML=active_dl+'/'+dln;
					if(p_o('ctrlbr_next_text') && p_o('imghead_'+(active_dl+1)))
					{
				p_o('ctrlbr_next_text').innerHTML='<strong>Next '+ p_o('imghead_'+(active_dl+1)).innerHTML+':</strong> ' +p_o('sub_hd_'+(active_dl+1)).innerHTML;
				} else if(p_o('ctrlbr_next_text'))
				{
				p_o('ctrlbr_next_text').innerHTML='<strong>Next :</strong> ' +p_o('sub_hd_'+(active_dl+1)).innerHTML;
				}
				}
			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';
p_o('count').innerHTML=dln+'/'+dln;
if (p_o('ctrlbr_next_text') && p_o('imghead_1'))
{
	p_o('ctrlbr_next_text').innerHTML='<strong>Next '+ p_o('imghead_1').innerHTML+':</strong> ' +p_o('sub_hd_1').innerHTML;
} else if (p_o('ctrlbr_next_text'))
{
p_o('ctrlbr_next_text').innerHTML='<strong>Next :</strong> ' +p_o('sub_hd_1').innerHTML;
}
return;
}
else
{
p_o('em_dl'+i).style.display='none';
p_o('em_dl'+(i-1)).style.display='block';
p_o('count').innerHTML=i-1+'/'+dln;
if (p_o('ctrlbr_next_text') && p_o('imghead_'+i))
{
p_o('ctrlbr_next_text').innerHTML='<strong>Next '+p_o('imghead_'+i).innerHTML+':</strong> ' +p_o('sub_hd_'+i).innerHTML;
} else if (p_o('ctrlbr_next_text'))
{
p_o('ctrlbr_next_text').innerHTML='<strong>Next :</strong> ' +p_o('sub_hd_'+i).innerHTML;
}
return;
}
}
}
}


function em_dl_next()
{
if (dln>1)
{
em_cl_int();
em_dl_f();
}
}

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('em_dl_f()',dl_speed);
var anc=p_o('em_ctrlbar_btns').getElementsByTagName('img');
anc[1].src=anc[1].src.replace(/pause_d.gif/, '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/, 'pause_d.gif');
}
//DL em ends