BannerArray = new Array(
	new Array(
	'ad_1.jpg',
	'/americaschildren/famsoc6.asp#fam6',
	'Image of a woman\'s pregnant stomach and hands holding a birth control test.  The banner reads \'The adolescent birth rate in 2009: 20.1 per 1000.  This rate has decreased for two consecutive years\' '
	),
	
	new Array(
	'ad_2.jpg',
	'/americaschildren/special1.asp#special1a',
	'Image of a woman kissing her adopted daughter on the cheek.  The banner reads \'2.5% of U.S. children joined their families through adoption\' '
	),
	
	new Array(
	'ad_3.jpg',
	'/americaschildren/phenviro1.asp#phy1a',
	'Image of a pair of smokestacks exhausting smoke on a blue sky.  The banner reads \'2008: 69%, 2009:59%.  The percentage of children who lived in counties in which one or more air pollutants were above allowable levels of the Primary National Ambient Air Quality Standards\' '
	),
	
	new Array(
	'ad_4.jpg',
	'/americaschildren/beh2.asp#beh2',
	'Image of a pair of a youth holding a beer bottle.  The banner reads \'The proportion of 12th graders who reported having five or more alcoholic beverages in a row in the past 2 weeks dropped from 25% in 2009 to 23% in 2010\' '
	),
	
	new Array(
	'ad_5.jpg',
	'/americaschildren/health8.asp#health8',
	'Image of a lavendar metered-dose inhaler.  The banner reads \'10% of children were reported to currently have asthma in 2009\' '
	),
	
	new Array(
	'ad_6.jpg',
	'/americaschildren/famsoc7.asp#fam7',
	'Image of a pair of dirty old babys shoes in the corner of a room.  The banner reads \'In 2009, there were 21 substantiated child maltreatment reports per 1,000 children under age 1\' '
	),
	
	new Array(
	'ad_7.jpg',
	'/americaschildren/famsoc7.asp#fam7',
	'Image of a group of diverse teenagers.  The banner reads \'74.2 million: Number of children in the United States in 2010, or 24% of the population\' '
	),
	
	new Array(
	'ad_8.jpg',
	'/americaschildren/edu6.asp#ed6',
	'Image of a college campus, framed by a pair of flagpoles.  The banner reads \'70%: Number of high school completers in 2009 enrolled immediately in a 2-year or 4-year college\' '
	),
	
	new Array(
	'ad_9.jpg',
	'/americaschildren/edu4.asp#ed4',
	'Image of a diploma wrapped with a red ribbon.  The banner reads \'90%: Number of younge adults in 2009 ages 18-24 that have completed high school with a diploma or a GED certificate\' '
	),
	
	new Array(
	'ad_10.jpg',
	'/americaschildren/beh3.asp#beh3',
	'Image of a row of white pills on a green counter-top. The banner reads \'Illicit drug use in the past 30 days increased among 8th-grade students from 2009 to 2010.  8% in 2009, 10% in 2010\' '
	),
	
	new Array(
	'ad_11.jpg',
	'/americaschildren/famsoc4.asp#fam4',
	'Image of a father and dauther smiling at the beach. The banner reads \'The percentage of all children living in the United States with at least one foreign-born parent rose from: 15% in 1994, 23% in 2010\' '
	),
	
	new Array(
	'ad_12.jpg',
	'/americaschildren/famsoc4.asp#fam4',
	'Image of a grandmother holding her grandson and kissing him on the cheek. The banner reads \'Of the 3.0 million children not living with either parent in 2010: 54% lived with grandparents, 21% lived with other relatives, 24% lived with nonrelatives\' '
	),
	
	new Array(
	'ad_13.jpg',
	'/americaschildren/care1.asp#hc1',
	'Image of a doctor holding her young patient. The banner reads \'7.5 million:  The number of children without health insurance at any time during 2009\' '
	),
	
	new Array(
	'ad_14.jpg',
	'/americaschildren/phenviro5.asp#phy5',
	'Image of a crumbling brick wall. The banner reads \'In 2009, 45% of U.S. households with children had physically inadequate housing, crowded housing, or housing that costs more than 30% of household income, up from 43% in 2007\' '
	),
	
	new Array(
	'ad_15.jpg',
	'/americaschildren/phenviro8.asp#phy8b',
	'Image of a bright red emergency room sign. The banner reads \'39: Number of injury-related deaths per 100,000 teens ages 15-19, down from 44 per 100,000 in 2008\' '
	),
	
	new Array(
	'ad_16.jpg',
	'/americaschildren/famsoc1.asp#fam1a',
	'Image of a pair of silver wedding rings resting next to a silk bow. The banner reads \'66% of children aged 0-17 live with two married parents, down from 77% in 1980\' '
	),
	
	new Array(
	'ad_17.jpg',
	'/americaschildren/health7.asp#health7',
	'Image of a several chocolate roll pastries lying on an orange plate. The banner reads \'19%: Number of children in 2007-2008 ages 6-17 that were obese\' '
	),
	
	new Array(
	'ad_18.jpg',
	'/americaschildren/eco1.asp#econ1a',
	'Image of a child wearing socks with holes in them. The banner reads \'21% of all children ages 0-17 lived in poverty, up from the low of 16% in 2000 and 2001\' '
	),
	
	new Array(
	'ad_19.jpg',
	'/americaschildren/health1.asp#health1a',
	'Image of two hands on a dark blue background holding a newborn. The banner reads \'The percentage of infants born preterm declined for the third straight year in 2009, to 12.2%\' '
	),
	
	new Array(
	'ad_20.jpg',
	'/americaschildren/edu5.asp#ed5',
	'Image of a young man leaning up against a delapidated brick wall. The banner reads \'In the average week during the 2010 school year, 9% of youth ages 16-19 were neither enrolled in school nor working\' '
	),
	
	new Array(
	'ad_21.jpg',
	'/americaschildren/famsoc2.asp#fam2b',
	'Image of mother carrying her daughter on her back in front of some trees. The banner reads \'41%: Number of births in 2009 to unmarried women\' '
	),
	
	new Array(
	'ad_22.jpg',
	'/americaschildren/eco2.asp#econ2',
	'Image of a mother holding her young child in front of a laptop. The banner reads \'The percentage of children who had at least one warent working year round, full time was 72% in 2009, down from 75% in 2008\' '
	),
	
	
	new Array(
	'ad_23.jpg',
	'/americaschildren/edu2.asp#ed2a',
	'Image of a chalkboard with various mathematical formulas written on it.  The banner reads \'For all racial and ethnic groups, average 12th-grade mathematics scores were higher in 2009 than in 2005\' '
	)
	
	
	);

 

 

var g;
var h;
var HPBannerTime = 1000 * 5; //seconds
var ImageNum;
var timerID;
var FIRST_TIME = true;

function AddHPBanner(ii,x)
{
//	alert(FIRST_TIME);

    if (!x) var x = 0;
    
    h = x;
    
	if (x != 0)
	{
	    h = x;
		switch(x)
		{
			case 1:
				ImageNum = ii;
				clearTimeout(timerID);
				document.getElementById('controller').src='images/play.gif';
				document.getElementById('controller').title='start banners';			
				break;
			case 2:
				ii = ImageNum;
				document.getElementById('controller').src='images/stop.gif';
				document.getElementById('controller').title='stop banners';			
				break;
			case 3:
			    ii = g + 1;		
				var t = (ii)+1;
				clearTimeout(timerID);
				timerID = setTimeout("AddHPBanner(" + t + ")",HPBannerTime);
			    break;
			case 4:
			    ii = g - 1;	
				var t = (ii)+1;
				clearTimeout(timerID);
				timerID = setTimeout("AddHPBanner(" + t + ")",HPBannerTime);
			    break;
            default:
                break;			    
		}
    }
	
	 if (x!=1)
	 {
		if (ii==null && FIRST_TIME)
		{
			var d = new Date();
		    var ii = d.getSeconds();
			g = Mod(ii, BannerArray.length)
			document.write('<A href="' + BannerArray[g][1] + '" id="HomepageBannerLINK">');
			document.write('<IMG src="/images/' + BannerArray[g][0] + '" alt="' + BannerArray[g][2] + '" id="HomepageBannerIMG" width="282" height="120" border="0">');
			document.write('</A>');
			FIRST_TIME = false;
		}
		else
		{
		    if (ii==null)
		    {
			    var d = new Date();
		        var ii = d.getSeconds();
		    }
			g = Mod(ii, BannerArray.length)
			document.getElementById('HomepageBannerIMG').src='/images/' + BannerArray[g][0];
			document.getElementById('HomepageBannerLINK').href=BannerArray[g][1];
			document.getElementById('HomepageBannerIMG').alt=BannerArray[g][2];
		}
		
		var t = (ii)+1;
		
		if (x <= 2 ) 
		{
            clearTimeout(timerID);	            
	        timerID = setTimeout("AddHPBanner(" + t + ")",HPBannerTime);
        }	        
	}
}	
	
function Mod(X, Y)
{
	return X - Math.floor(X/Y)*Y
}


function start_stop()
{
    if (h == 0) 
    {   
        AddHPBanner(g, 1);
    } else
    {
        AddHPBanner(g, 2);
        h = 0;
    }        
     
}
