
//Latest News logic

function GetId(Id){
return document.getElementById(Id);
}



function ActHomeStry()
{
show_case();
	for (var i=1; i<=Scount; i++)
	{	
		if (GetId('em_dl'+i).style.display=='block')
		{		
			if (i==Scount)
			{			
			GetId('em_dl'+i).style.display='none';
			GetId('em_dl1').style.display='block';				
			GetId('count').innerHTML=1+'/'+Scount;
			
				if (GetId('NextStory'))
				{
				GetId('NextStory').innerHTML='<strong>Next: </strong><a href='+GetId('HeadText_2').href+'>'+GetId('HeadText_2').innerHTML+'</a>';				
				
				}
			return;
			}
			else
			{
			var ac_d=i+1;
			GetId('em_dl'+i).style.display='none';
			GetId('em_dl'+ac_d).style.display='block';
				if(i==Scount-1)
				{
					GetId('count').innerHTML=Scount+'/'+Scount;
					

					if ((GetId('HeadText_1')==null))
			            {
					   if (GetId('NextStory'))
						{
						GetId('NextStory').innerHTML='<strong>Next: </strong> <a href='+GetId('HeadText_2').href+'>' +GetId('HeadText_2').innerHTML+'</a>';
						}
                     
			          }

				  else if(GetId('NextStory'))
						{
						
     					GetId('NextStory').innerHTML='<strong>Next: </strong> <a href='+GetId('HeadText_1').href+'>' +GetId('HeadText_1').innerHTML+'</a>';					
						}
					
				}
				else
				{
					GetId('count').innerHTML=ac_d+'/'+Scount;
					
				   if(GetId('NextStory'))
						{
						GetId('NextStory').innerHTML='<strong>Next: </strong><a href='+GetId('HeadText_'+(ac_d+1)).href+'>' +GetId('HeadText_'+(ac_d+1)).innerHTML+'</a>';							
						}
				}
			return;
			}
		}
	}
}




function showc_ind()
{
	for (var i=1; i<=Scount; i++)
	{
	if (GetId('em_dl'+i).style.display=='block')
		{
		if (i==1)
			{
			GetId('em_dl'+i).style.display='none';
			GetId('em_dl'+Scount).style.display='block';
			GetId('count').innerHTML=Scount+'/'+Scount;
		     if (GetId('NextStory'))
				{
				GetId('NextStory').innerHTML='<strong>Next: </strong><a href='+GetId('HeadText_1').href+'>'+GetId('HeadText_1').innerHTML+'</a>';
					
				}
				
				rand1=i;				
				show_case();
				return;
			}
			else
			{
			rand1=i;			
			show_case();			
			GetId('em_dl'+i).style.display='none';
			GetId('em_dl'+(i-1)).style.display='block';
			GetId('count').innerHTML=i-1+'/'+Scount;
		     if (GetId('NextStory'))
				{
				GetId('NextStory').innerHTML='<strong>Next: </strong> <a href='+GetId('HeadText_'+i).href+'>' +GetId('HeadText_'+i).innerHTML+'</a>';				
				}
				return;
			}
		}
	}
}


function ind_next()
{
	if (Scount>1)
	{
	rand1++;
	btn_ind();
	ActHomeStry();
	}
}

function ind_previous()
{
	if (Scount>1)
	{		
	btn_ind();
	showc_ind();
    
	}
}

function ind_Pause()
{
	if (Scount>1)
	{
	var anc=GetId('ind_ctr_button').getElementsByTagName('img');
	if (anc[1].src.indexOf('3341216')!=-1)
		{
		btn_ind();
		}
		else
		{
		showsp_ind();
		}
	}
}

function showsp_ind()
{
b_int=setInterval('ActHomeStry()',sp_speed);
var anc=GetId('ind_ctr_button').getElementsByTagName('img');
anc[1].src=anc[1].src.replace(/3352993/, '3341216');
}

function btn_ind()
{
b_int=clearInterval(b_int);
var anc=GetId('ind_ctr_button').getElementsByTagName('img');
anc[1].src=anc[1].src.replace(/3341216/,'3352993');
}