var topnavNames = ["home", "sweeps", "readup", "games", "taf"];
var topnavImagesOff = new Array(topnavNames.length);
var topnavImagesOn = new Array(topnavNames.length);
var topnavPath = "/images/backtoschool/";
var topnavPrefix = "topnav";
var topnavType = ".gif";
var topnavCurrent = 0;

if (document.images){
	for (var i = 0; i < topnavNames.length; i++){
		topnavImagesOff[i] = new Image();
		topnavImagesOff[i].src = topnavPath + topnavPrefix + topnavNames[i] + "_off" + topnavType;
		topnavImagesOn[i] = new Image();
		topnavImagesOn[i].src = topnavPath + topnavPrefix + topnavNames[i] + "_on" + topnavType;
	}
}

function topnavLight(navNum){
	if (document.images){
		document.images["topnav" + navNum].src = topnavImagesOn[navNum - 1].src;
	}
}

function topnavDim(navNum){
	if (document.images){
		if ((navNum != topnavCurrent) && (navNum != 0)){
			document.images["topnav" + navNum].src = topnavImagesOn[navNum - 1].src;
		}
	}
}

function topnavSet(navNum){
	var tmpNavNum = topnavCurrent;
	topnavCurrent = navNum;
	topnavDim(tmpNavNum);
	topnavLight(navNum);
}

var promos = new Array();

function initPromos(){
	var promo;
	promo = new Object()
	promo.alt = "Helping Kids Face a New School Year: Parents can make the difference. Read up &gt;";
	promo.img = "school_days";
	promo.type = "article";
	promo.url = "/backtoschool/articles/School_Days.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "Homework Help That Really Helps: Think guidance, not dependence. Read up &gt;";
	promo.img = "helping_kids";
	promo.type = "article";
	promo.url = "/backtoschool/articles/Helping_Kids.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "A Great Tool for School: It isn't new or high-tech. In fact, you probably used it yourself. Read up &gt;";
	promo.img = "academic_success";
	promo.type = "article";
	promo.url = "/backtoschool/articles/Academic_Success.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "New School-Year Organizing: It all begins at home. Read up &gt;";
	promo.img = "organization";
	promo.type = "article";
	promo.url = "/backtoschool/articles/Organization.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "Healthy Foods Kids Will Eat (Really!): Show kids that healthy isn't boring. Read up &gt;";
	promo.img = "whole_grains";
	promo.type = "article";
	promo.url = "/backtoschool/articles/Whole_Grains.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "Think Outside the Lunch Box: New ideas to refresh lunchtime. Read up &gt;";
	promo.img = "outside_lunchbox";
	promo.type = "article";
	promo.url = "/backtoschool/articles/Outside_Lunchbox.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "Strategies to Build Brainpower: You can help boost your child's cognitive development. Read up &gt;";
	promo.img = "building_brainpower";
	promo.type = "article";
	promo.url = "/backtoschool/articles/Building_Brainpower.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "Why Some Kids Do Better in School: After-school activities could be the answer. Read up &gt;";
	promo.img = "afterschool_rules";
	promo.type = "article";
	promo.url = "/backtoschool/articles/Afterschool_Rules.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "Getting Kids to Open Up: How to get beyond those one-word answers. Read up &gt;";
	promo.img = "one_word_answer";
	promo.type = "article";
	promo.url = "/backtoschool/articles/One_Word_Answer.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "When Kids Face School Pressures: Support begins at home. Read up &gt;";
	promo.img = "no_appointment";
	promo.type = "article";
	promo.url = "/backtoschool/articles/No_Appointment_Needed.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "Kids in the Kitchen: You're making more than meals; you're making memories. Read up &gt;";
	promo.img = "help_kitchen";
	promo.type = "article";
	promo.url = "/backtoschool/articles/Help_Kitchen.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "Raising Good Sports: When you teach kids good sportsmanship, it spills into their lives. Read up &gt;";
	promo.img = "good_sports";
	promo.type = "article";
	promo.url = "/backtoschool/articles/Good_Sports.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "Play Classroom Chaos: Take a break with this fun game from Mead&reg; Play now&gt;";
	promo.img = "classroom_chaos";
	promo.type = "games";
	promo.url = "/backtoschool/playgames.aspx";
	promos.push(promo);

	promo = new Object()
	promo.alt = "Play Maze-o-Madness: Take a break with this fun game from Mead&reg; Play now&gt;";
	promo.img = "maze_o_madness";
	promo.type = "games";
	promo.url = "/backtoschool/playgames.aspx";
	promos.push(promo);
}

function getPromosByType(type){
	var tmpPromos = new Array();
	for (var i = 0; i < promos.length; i++){
		if (promos[i].type == type){
			tmpPromos.push(promos[i]);
		}
	}
	return tmpPromos;
}

function writePromo(type){
	var promoPool = getPromosByType(type);
	var randomIndex = Math.floor(Math.random() * promoPool.length);
	var p = promoPool[randomIndex];
	document.write('<a href="' + p.url + '"><img src="/images/backtoschool/banner_' + p.type + '_' + p.img + '.jpg" width="275" height="77" border="0" alt="' + p.alt + '" /></a>');
}

function writeArticlePromo(){
	writePromo("article");
}

function writeGamePromo(){
	writePromo("games");
}

var printPages = ["/articles/", "/btsrules.aspx"];
var includePrintStyleSheet = false;
for (var i = 0; i < printPages.length; i++){
	if (location.href.toLowerCase().indexOf(printPages[i]) != -1){
		includePrintStyleSheet = true;
	}
}
if (includePrintStyleSheet){
	document.write('<link rel="stylesheet" type="text/css" href="/backtoschool/css/print.css" media="print" />');
}