// Promo Banner Rotater

//Set Promo text
var txt = new Array();
txt[1] = "Your handy guide to where and how to apply for scholarships, your first option for college financing.";
txt[2] = "Borrow what you need, but only what you need. It never makes sense to carry more debt than you have to. ";
txt[3] = "An easy way for students and parents to stay informed about current thinking on ways to finance an education.";

var hdr = new Array();
hdr[1] = "Scholarship Search";
hdr[2] = "Calculators &amp Tools";
hdr[3] = "In the News";

var link1 = new Array();
link1[1] = ["Where to search for scholarships and grants", "resources/scholarshipsearch.html"];
link1[2] = ["Check out The Loan Cost Calculator", "calculators/borrowerscalculator.html"];
link1[3] = ["Read the latest articles", "resources/news.html"];

var link2 = new Array();
link2[1] = ["Considering all your options", "resources/index.html"];
link2[2] = ["Download the Smart Borrowing Worksheet", "calculators/smartborrowingworksheet.html"];
link2[3] = ["Visit some dedicated sites for parents", "resources/parents.html"];

var link1_href = new Array();

// Set Timer Control Properties
var c = 1;
var maxCount = 3;
var cycleTime = 4;
var t;

// Functions
function timedCount()
{
	if(c > maxCount) { c = 1;} //if max count reached, reset count
	if(c < 1) { c = maxCount;}
	//Reference promo objects
	var promo_banner = document.getElementById('promo_banner');
	var promo_control = document.getElementById('promo_control');
	var promo_header = document.getElementById('promo_header');
	var promo_text = document.getElementById('promo_text');
	var promo_link1 = document.getElementById('promo_link1');
	var promo_link2 = document.getElementById('promo_link2');

	//Set properties of promo objects	
	promo_control.style.backgroundImage = "url(images/promo_ctrl_bkgd0"+c+".gif)";
	promo_banner.style.backgroundImage = "url(images/promo_bkgd0"+c+".jpg)";
	promo_header.innerHTML = hdr[c];
	promo_text.innerHTML = txt[c];
	promo_link1.innerHTML = link1[c][0];
	promo_link1.href = link1[c][1];
	promo_link2.innerHTML = link2[c][0];
	promo_link2.href = link2[c][1];
	
	//Advance count and call set time
	c = c+1;
	t=setTimeout("timedCount()", (cycleTime * 1000));
}

function nextPromo() {
	stopCount();
	timedCount();
}

function prevPromo() {
	stopCount();
	c = c-2;
	timedCount();
}

function changePromo(){
	//Reference promo objects
	var promo_banner = document.getElementById('promo_banner');
	var promo_control = document.getElementById('promo_control');
	var promo_text = document.getElementById('promo_text');
	var link1 = document.getElementById('promo_text');
	var link2 = document.getElementById('promo_text');

	//Set properties of promo objects	
	promo_control.style.backgroundImage = "url(images/promo_ctrl_bkgd0"+c+".gif)";
	promo_banner.style.backgroundImage = "url(images/promo_bkgd0"+c+".jpg)";
	promo_text.innerHTML = txt[c];
}



function stopCount()
{
	clearTimeout(t);
}
