var HLIntervalId = 0;
var curHL=1

var HLURLs=["","iiom-update.php","iiom-update.php#phase2","television.php"]
var totalHL=4 //total # of Featured Ministries banners

function switchX(typ,elid,num)
{
	/*
	typ values:
	t=timer
	c=click
	
	elid:
	the elementID to prefix
	
	num:
	number of the image to show
	*/
	
	if(typ=='t')
	{
		curHL++
		if(curHL==(totalHL+1))
		{
			curHL=1
		}
		num=curHL
	}
	else if(typ=='c')
	{
		clearInterval(HLIntervalId)
		curHL=num
	}


	//switch to hilight the selected item
	for(var i=1;i<=eval('total'+elid);i++)
	{
		if(i==num)
		{
			document.getElementById(elid+'Sel'+i).innerHTML='<div style="position:relative;padding-top:6px;color:#fff;">&#149;</div>'
		}
		else
		{
			document.getElementById(elid+'Sel'+i).innerHTML='<div style="position:relative;padding-top:6px;color:#000000;">&#149;</div>'
		}
	}
	
	if(typ=='t')
	{
		document.getElementById(elid+'Imgfo').src=document.getElementById(elid+'Img').src
		Element.show('hphlwrapperfo')
		//new Element.hide('hphlwrapperfo')
		//var dur=.5
		document.getElementById(elid+'Img').src='images/ad'+curHL+'.jpg' 
		document.getElementById(elid+'Link').href=eval(elid+'URLs')[curHL-1]
		document.getElementById(elid+'Linkfo').href=eval(elid+'URLs')[curHL-1]
		//new Effect.Fade(elid+'Img')
		new Effect.Fade('hphlwrapperfo', { duration: 1.5 })
		new Effect.Appear('hphlwrapper', { duration: 1.5 })
		//new Effect.Appear('hphlwrapperfo', { duration: 1.0 })
	}
	else if(typ=='c')
	{
		document.getElementById(elid+'Img').src='images/ad'+num+'.jpg'
		document.getElementById(elid+'Link').href=eval(elid+'URLs')[num-1]
		document.getElementById(elid+'Imgfo').src='images/ad'+num+'.jpg'
		document.getElementById(elid+'Linkfo').href=eval(elid+'URLs')[num-1]
	}
}

function nb(dir)
{
	//used for the next/back buttons on the rotating HPHL
	if(dir=='b')
	{
		curHL--
		if(curHL<1)
		{
			curHL=totalHL
		}

	}
	else if(dir=='n')
	{
		curHL++
		if(curHL==(totalHL+1))
		{
			curHL=1
		}
	}
}