window.onload = initLinks;

var myPhoto = new Array(
"Gala2008/Gala-Codey,ThompsonWithMelanie&David.jpg",
"Gala2008/Gala-AmyAndSharon.jpg",
"Gala2008/Gala-OwensWelcomesSzegediAndWife.jpg",
"Gala2008/Gala-SingerMeghanDuffy.jpg",
"Gala2008/Gala-GlasserGroup.jpg",
"Gala2008/BloomwellsGreensUssery.jpg",
"Gala2008/SueNancy.jpg",
"Gala2008/MrMrsChin.jpg",
"Gala2008/GlasserOwens.jpg",
"Gala2008/MillerJackson.jpg",
"Gala2008/DevlinStratton.jpg",
"Gala2008/CassidyGeitz.jpg",
"Gala2008/SochaColish.jpg",
"Gala2008/Cochrans.jpg",
"Gala2008/Bloomwells.jpg",
"Gala2008/ChanceDoyleFrantz.jpg",
"Gala2008/GurundersLevines.jpg",
"Gala2008/ThompsonWise.jpg",
"Gala2008/CodeyThompson.jpg",
"Gala2008/BoardWithBrianThompson.jpg",
"Gala2008/CodeyAcceptingAward.jpg",
"Gala2008/VitielloBurlinson.jpg",
"Gala2008/ThompsonRotter.jpg",
"Gala2008/TurlingtonOwensLester.jpg",
"Gala2008/WiseSpeaking.jpg",
"Gala2008/ShawMorellaStockwell.jpg",
"Gala2008/TurlingtonWithColleagues.jpg");

var myText = new Array(
"Senate President Richard Codey (center) is congratulated by (left to right) Gala Master of Ceremonies WNBC-TV Reporter Brian Thompson, Gala Chairperson Melanie Lester of Bedminster and Executive Director David Owens of Westfield.",
"Board Members Amy Green and Sharon Stockwell of Westfield",
"CONTACT We Care Executive Director David Owens welcomes Gala honoree Dr. Armin Szegedi and his wife Su-Yun.",
"Performer Meghan Duffy entertained during the cocktail hour.",
"Mr. and Mrs. Gerald Glasser (center) with Joan Bryant on left and Connie Williams on right.",
"Gene and Joanne Bloomwell, Amy Green and Steve Gorelick, and Bill Ussery",
"CONTACT Training Director Susan Fasano and Volunteer Coordinator Nancy Levine",
"Mr. and Mrs. Allen Chin",
"Gerald Glasser and David Owens",
"CONTACT Volunteers Eleanor Miller and Mary-Lou Jackson",
"CONTACT volunteer Barb Devlin (right) and daughter Kim Stratton",
"Gail Cassidy and Rev. Canon Elizabeth Geitz",
"CONTACT volunteer Swava Socha and friend Maria Colish",
"Mr. and Mrs. Joshua Cochran",
"Long-time CONTACT volunteers Joanne and Gene Bloomwell",
"Betsy Chance and Barbara Doyle Frantz",
"Mr. and Mrs. Johar Gurinder and Mr. and Mrs. Robert Levine",
"Gala MC Brian Thompson of WNBC 4 TV and Keynote Speaker Terry Wise",
"Senator Richard Codey and WNBC TV Reporter Brian Thompson",
"Board photo with Brian Thompson",
"Senator Codey accepting award",
"Board Member Lisa Vitiello and CONTACT Listener and Gala Committee Member Eileen Burlinson",
"Brian Thompson and Ken Rotter",
"Gala Honoree Dee Dee Turlington receiving award from David Owens and Melanie Lester",
"Keynote Speaker Terry Wise",
"Linda Shaw, Donna Morella, and Sharon Stockwell",
"Reverend Dee Dee Turlington (standing) with colleagues The Rev. Dr. Gloria White, Pastor, Mt. Zion Baptist Church in Newark (left) and Rev. Estelle David, Chaplain, Edna Mahan Correctional Facility for Women in Clinton");

var thisPhoto = 0;

function initLinks() {
	document.getElementById("previous").onclick = processPrevious;
	document.getElementById("next").onclick = processNext;
}

function processPrevious() {
	changeOpac(0)
	if (thisPhoto == 0) {
		thisPhoto = myPhoto.length;
	}
	thisPhoto--;
	document.getElementById("myPicture").src = myPhoto[thisPhoto];
	//if (document.getElementById("myPicture").src.indexOf("v") != -1)
//	{
//		document.getElementById("myPicture").style.marginTop = 10 + "px";
//	}
//	else {
//		document.getElementById("myPicture").style.marginTop = 50 + "px";
//	}
	document.getElementById('pictureText').innerHTML = myText[thisPhoto];
	opacityShow()
	return false;
}

function processNext() {
	changeOpac(0)
	thisPhoto++;
	if (thisPhoto == myPhoto.length) {
		thisPhoto = 0;
	}
	document.getElementById("myPicture").src = myPhoto[thisPhoto];
//	if (document.getElementById("myPicture").src.indexOf("v") != -1)
//	{
//		document.getElementById("myPicture").style.marginTop = 10 + "px";
//	}
//	else {
//		document.getElementById("myPicture").style.marginTop = 50 + "px";
//	}
	document.getElementById('pictureText').innerHTML = myText[thisPhoto];
	opacityShow()
	return false;
}


function opacityFade() {
	timer = 900;
	for(i = 100; i >= 0; i--) {
		setTimeout("changeOpac(" + i + ")",(timer));
		timer=timer+2;
	}
}
function opacityShow() {
	timer = 900;
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ")",(timer));
	timer=timer+2;
	}
}

function changeOpac(opacity) {
	var object = document.getElementById('myPicture').style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}
