// Initialize Content
var heading1 = "Options Arts Students Rock the House";
var heading2 = "Featured Program - Commercial Truck at Colerain HS";
var heading3 = "Learning from the Comfort of Your Own Home";
var heading4 = "Ross Rams Class of '09 Girls in the Record Book";

var location1 = "http://www.butlertech.org/district_pages/news_options.asp";
var location2 = "http://www.butlertech.org//teen/commercial_truck/";
var location3 = "http://www.butlertechonline.org";
var location4 = "http://www.butlertech.org/district_pages/news_puff.asp";

var caption1 = "Options Arts Students Rock the House";
var caption2 = "Featured Program – Commercial Truck, Colerain High School";
var caption3 = "Butler Tech Online – Education That Clicks!";
var caption4 = "Ross Rams Class of '09 Girls in the Record Book";

var body1 = "Students from Butler Tech's <a href='/teen/OA-Arts/'>Options Academy - The Arts</a> were featured during the opening of the district's All Staff meeting. They opened with Herbie Hancock's \"Watermelon Man\" and the Beatles' \"Something.\" ";
var body2 = "Butler Tech's <a href='/teen/commercial_truck/'>Commercial Truck</a> program at Colerain High School offers an in-depth education in the rapidly growing field of diesel truck maintenance and repair.";
var body3 = "<a href='http://www.butlertechonline.org'>Butler Tech Online</a> offers programs anywhere you have an internet connection. It lets students work at their own pace to get the education they need and the variety they want while still meeting state standards";
var body4 = "The class of 2009 girls at Ross won the Ross/Butler Tech DECA Powder Puff games for the second time in a row. Last year, as juniors, they won as well which was a \"huge upset\". <a href='/district_pages/news_puff.asp'>  [MORE] </a>";

// Location variable
var loc = '1';

// Initialize timer
var timer = 0;

// Preload images
main02 = new Image (300, 400);
main02.src = 'DHTML/main_02.jpg';
main03 = new Image (300, 400);
main03.src = 'DHTML/main_03.jpg';
main04 = new Image (300, 400);
main04.src = 'DHTML/main_04.jpg';
play = new Image (11, 17);
play.src = 'DHTML/buttons/play_default.png';
backover = new Image(11, 17);
backover.src = 'DHTML/buttons/back_over.png';
frontover = new Image(11, 17);
frontover.src = 'DHTML/buttons/front_over.png';
playover = new Image(11, 17);
playover.src = 'DHTML/buttons/play_over.png';
pauseover = new Image(11, 17);
pauseover.src = 'DHTML/buttons/pause_over.png';

// Populate area with item 1 data
function begin () {
	document.getElementById('heading').innerHTML = heading1;
	document.getElementById('body_text').innerHTML = body1;
	document.getElementById('heading_link').href = location1;
	document.getElementById('image_link').href = location1;
	timer = setTimeout('fade1();', 7000);
}

// Start fader
function fade1() {
	loc = '1';
	new Effect.Fade('main', {duration: 2.0});
	timer = setTimeout('switch1();', 2000);
}

function switch1() {
	document.getElementById('main').src = 'DHTML/main_02.jpg';
	timer = setTimeout('new Effect.Appear(\'main\', {duration: 2.0});', 100);
	document.getElementById('box_01').style.border = '1px solid #CCCCCC';
	document.getElementById('box_02').style.border = '2px solid #244168';
	document.getElementById('box_03').style.border = '1px solid #CCCCCC';
	document.getElementById('box_04').style.border = '1px solid #CCCCCC';
	document.getElementById('heading').innerHTML = heading2;
	document.getElementById('heading_link').href = location2;
	document.getElementById('image_link').href = location2;
	document.getElementById('body_text').innerHTML = body2;
	timer = setTimeout('fade2();', 7000);
}

function fade2() {
	loc = '2';
	new Effect.Fade('main', {duration: 2.0});
	timer = setTimeout('switch2();', 2000);
}

function switch2() {
	document.getElementById('main').src = 'DHTML/main_03.jpg';
	timer = setTimeout('new Effect.Appear(\'main\', {duration: 2.0});', 100);
	document.getElementById('box_01').style.border = '1px solid #CCCCCC';
	document.getElementById('box_02').style.border = '1px solid #CCCCCC';
	document.getElementById('box_03').style.border = '2px solid #244168';
	document.getElementById('box_04').style.border = '1px solid #CCCCCC';
	document.getElementById('heading').innerHTML = heading3;
	document.getElementById('heading_link').href = location3;
	document.getElementById('image_link').href = location3;
	document.getElementById('body_text').innerHTML = body3;
	timer = setTimeout('fade3();', 7000);
}

function fade3() {
	loc = '3';
	new Effect.Fade('main', {duration: 2.0});
	timer = setTimeout('switch3();', 2000);
}

function switch3() {
	document.getElementById('main').src = 'DHTML/main_04.jpg';
	timer = setTimeout('new Effect.Appear(\'main\', {duration: 2.0});', 100);
	document.getElementById('box_01').style.border = '1px solid #CCCCCC';
	document.getElementById('box_02').style.border = '1px solid #CCCCCC';
	document.getElementById('box_03').style.border = '1px solid #CCCCCC';
	document.getElementById('box_04').style.border = '2px solid #244168';
	document.getElementById('heading').innerHTML = heading4;
	document.getElementById('heading_link').href = location4;
	document.getElementById('image_link').href = location4;
	document.getElementById('body_text').innerHTML = body4;
	timer = setTimeout('fade4();', 7000);
}

function fade4() {
	loc = '4';
	new Effect.Fade('main', {duration: 2.0});
	timer = setTimeout('switch4();', 2000);
}

function switch4() {
	document.getElementById('main').src = 'DHTML/main_01.jpg';
	timer = setTimeout('new Effect.Appear(\'main\', {duration: 2.0});', 100);
	document.getElementById('box_01').style.border = '2px solid #244168';
	document.getElementById('box_02').style.border = '1px solid #CCCCCC';
	document.getElementById('box_03').style.border = '1px solid #CCCCCC';
	document.getElementById('box_04').style.border = '1px solid #CCCCCC';
	document.getElementById('heading').innerHTML = heading1;
	document.getElementById('heading_link').href = location1;
	document.getElementById('body_text').innerHTML = body1;
	timer = setTimeout('fade1();', 7000);
}

function playToPause() {
	document.getElementById('pause').style.display = 'none';
	document.getElementById('play').style.display = '';
}

function pauseToPlay() {
	document.getElementById('play').style.display = 'none';
	document.getElementById('pause').style.display = '';
}

function manual1 () {
	clearTimeout(timer);
	loc = '1';
	new Effect.Fade('main', {duration: 2.0});
	setTimeout('document.getElementById(\'main\').src = \'DHTML/main_01.jpg\';', 2000);
	setTimeout('new Effect.Appear(\'main\', {duration: 2.0});', 2000);
	document.getElementById('box_01').style.border = '2px solid #244168';
	document.getElementById('box_02').style.border = '1px solid #CCCCCC';
	document.getElementById('box_03').style.border = '1px solid #CCCCCC';
	document.getElementById('box_04').style.border = '1px solid #CCCCCC';
	document.getElementById('heading').innerHTML = heading1;
	document.getElementById('heading_link').href = location1;
	document.getElementById('image_link').href = location1;
	document.getElementById('body_text').innerHTML = body1;
	playToPause();
}

function manual2 () {
	clearTimeout(timer);
	loc = '2';
	new Effect.Fade('main', {duration: 2.0});
	setTimeout('document.getElementById(\'main\').src = \'DHTML/main_02.jpg\';', 2000);
	setTimeout('new Effect.Appear(\'main\', {duration: 2.0});', 2000);
	document.getElementById('box_01').style.border = '1px solid #CCCCCC';
	document.getElementById('box_02').style.border = '2px solid #244168';
	document.getElementById('box_03').style.border = '1px solid #CCCCCC';
	document.getElementById('box_04').style.border = '1px solid #CCCCCC';
	document.getElementById('heading').innerHTML = heading2;
	document.getElementById('heading_link').href = location2;
	document.getElementById('image_link').href = location2;
	document.getElementById('body_text').innerHTML = body2;
	playToPause();
}

function manual3 () {
	clearTimeout(timer);
	loc = '3';
	new Effect.Fade('main', {duration: 2.0});
	setTimeout('document.getElementById(\'main\').src = \'DHTML/main_03.jpg\';', 2000);
	setTimeout('new Effect.Appear(\'main\', {duration: 2.0});', 2000);
	document.getElementById('box_01').style.border = '1px solid #CCCCCC';
	document.getElementById('box_02').style.border = '1px solid #CCCCCC';
	document.getElementById('box_03').style.border = '2px solid #244168';
	document.getElementById('box_04').style.border = '1px solid #CCCCCC';
	document.getElementById('heading').innerHTML = heading3;
	document.getElementById('heading_link').href = location3;
	document.getElementById('image_link').href = location3;
	document.getElementById('body_text').innerHTML = body3;
	playToPause();
}

function manual4 () {
	clearTimeout(timer);
	loc = '4';
	new Effect.Fade('main', {duration: 2.0});
	setTimeout('document.getElementById(\'main\').src = \'DHTML/main_04.jpg\';', 2000);
	setTimeout('new Effect.Appear(\'main\', {duration: 2.0});', 2000);
	document.getElementById('box_01').style.border = '1px solid #CCCCCC';
	document.getElementById('box_02').style.border = '1px solid #CCCCCC';
	document.getElementById('box_03').style.border = '1px solid #CCCCCC';
	document.getElementById('box_04').style.border = '2px solid #244168';
	document.getElementById('heading').innerHTML = heading4;
	document.getElementById('heading_link').href = location4;
	document.getElementById('image_link').href = location4;
	document.getElementById('body_text').innerHTML = body4;
	playToPause();
}

function checkSwitch() {
	if (document.getElementById('main').style.display == 'none') {
		move_next();
	}
}

function pause_switch() {
	clearTimeout(timer);
	setTimeout("checkSwitch()", 2000);
	playToPause();
}

function move_next () {
if (loc == '1') {
		manual2();
	}
	else if (loc == '2') {
		manual3();
	}
	else if (loc == '3') {
		manual4();
	}
	else if (loc == '4') {
		manual1();
	}
	else {
		manual1();
	}
}

function move_prev () {
if (loc == '1') {
		manual4();
	}
	else if (loc == '2') {
		manual1();
	}
	else if (loc == '3') {
		manual2();
	}
	else if (loc == '4') {
		manual3();
	}
	else {
		manual1();
	}
}

function resume_play () {
if (loc == '1') {
		pauseToPlay();
		fade1();
	}
	else if (loc == '2') {
		pauseToPlay();
		fade2();
	}
	else if (loc == '3') {
		pauseToPlay();
		fade3();
	}
	else if (loc == '4') {
		pauseToPlay();
		fade4();
	}
	else {
		pauseToPlay();
		fade1();
	}
}

// Mouseover Effects
function backOver () {
	document.getElementById('back').src = 'DHTML/buttons/back_over.png';
}

function backOut () {
	document.getElementById('back').src = 'DHTML/buttons/back_default.png';
}

function forwardOver () {
	document.getElementById('forward').src = 'DHTML/buttons/forward_over.png';
}

function forwardOut () {
	document.getElementById('forward').src = 'DHTML/buttons/forward_default.png';
}

function playOver () {
	document.getElementById('play').src = 'DHTML/buttons/play_over.png';
}

function playOut () {
	document.getElementById('play').src = 'DHTML/buttons/play_default.png';
}

function pauseOver () {
	document.getElementById('pause').src = 'DHTML/buttons/pause_over.png';
}

function pauseOut () {
	document.getElementById('pause').src = 'DHTML/buttons/pause_default.png';
}

function checkFile(num) {
	if (document.getElementById('image_' + num).value != '') {
		document.getElementById('check_' + num).value = true;
	}
	else
		document.getElementById('check_' + num).value = false;
										
}