// the following variables and arrays' content should be replaced by info from the database
var total_slides = 6; // IMPORTANT! Replace the 6 with the slide total from database
var slides = new Array(total_slides);
for (s = 0; s < total_slides; s++) {
slides[s] = new Array();
}
// loop through database to get image file names, links, titles and descriptions
// limit query to 6 records
// do not leave any array keys unset -- for instance, if there is a slides[0]['file'], but no slides[0]['title'], set the title to ""
// you don't need to show all six as I do below.  Showing one array with a loop that uses a variable as the array id is okay -- as long as you stick to 0-5.

slides[0]['file'] = "EECS1_cyclos_banner2.jpg";
slides[0]['link'] = "http://www.eecs.umich.edu/eecs/about/articles/2012/Cyclos_tech.html";
slides[0]['title'] = "Technology from EECS Startup in New AMD Processor Family";
slides[0]['contents'] = "Energy recycling technology from Cyclos Semiconductor, co-founded by CSE Chair Marios Papaefthymiou, will enable AMD's next-gen processor.";

slides[1]['file'] = "EECS1_fessler-ctscan.jpg";
slides[1]['link'] = "http://www.eecs.umich.edu/eecs/about/articles/2012/fessler-ctscans.html";
slides[1]['title'] = "From theory to safer cancer detection";
slides[1]['contents'] = "Prof. Jeff Fessler developed a new way of processing data that makes it possible to use less radiation on patient’s receiving CT scans. The technique is now in use at the U-M Hospital.";

slides[2]['file'] = "EECS5_bbbb.jpg";
slides[2]['link'] = "http://www.ns.umich.edu/new/releases/20225-15-million-gift-gives-major-boost-to-fellowships-at-michigan-engineering";
slides[2]['title'] = "CSE Building to be Named in Honor of Beyster Gift";
slides[2]['contents'] = "In recognition of a $15 million gift to Michigan Engineering, the CSE Building will be named the Bob and Betty Beyster Building.";

slides[3]['file'] = "EECS4_guo-camouflage566x345-web.jpg";
slides[3]['link'] = "http://www.eecs.umich.edu/eecs/about/articles/2011/guo-camouflage.html";
slides[3]['title'] = "Light absorbing coating for camouflage";
slides[3]['contents'] = "Prof. Jay Guo and his team have manipulated thin sheets of carbon nanotubes so that they can effectively mask any 3D object that they cover.";

slides[4]['file'] = "EECS1_mcmeeking.jpg";
slides[4]['link'] = "http://www.eecs.umich.edu/eecs/about/articles/2012/McMeeking_Intel_Innovator.html";
slides[4]['title'] = "CS Undergrad wins $100K for Startup through Intel Innovators";
slides[4]['contents'] = "Chris McMeeking has won $100,000 of funding for his startup, ASK Interfaces, through Intel Innovators, the new Facebook-based business plan competition.";

slides[5]['file'] = "EECS5_cyborg-header.jpg";
slides[5]['link'] = "http://www.eecs.umich.edu/eecs/about/articles/2011/cyborgbug.html";
slides[5]['title'] = "Insect cyborgs to search and monitor hazardous environs";
slides[5]['contents'] = "Research conducted by Prof. Najafi and Erkan Aktakka may lead to the use of insects to monitor hazardous situations before sending in humans.";


// end slide variable set-up

// here I loop through the array and stuff variables with the slide names, text, etc
// you may need to change names below to match what's in the database
var sn = 0;                 // slide display number
var slide_count = 0;        // total number of slides
var thumb_strip = "";       // this will be used to print the slide numbers
var slide_str = "";         // this will be used to print the slides
var slide_text = "";        // this will be used to print the captions
slide_count = slides.length;// get number of slides in array
if (slide_count > 0) {      // check to make sure there are slides in array
if (slide_count > 6) slide_count = 6; // if slide count is > 6, set it to 6
for (r = 0; r < slide_count; r++) { // loop through slide array
slide = slides[r];
if (slide['file'] && slide['file'] != "") {    // make sure we have a file name
slide_file = slide['file'];
slide_title = slide['title'];
slide_content = slide['contents'];
slide_link = slide['link'];
sn++;
thumb_strip = thumb_strip + "<li id='th-" + r + "' class='slide_number' onClick='gotoSlide(" + r + ", " + slide_count + ");'>" + sn + "</li>";
slide_str = slide_str + "<div class='slide hide' id='sh-" + r + "' onMouseover='stopSlide();' onMouseout='resumeSlide();'><a href='" + slide_link + "' class='slide_link'><img src='/eecs/images/" + slide_file + "' border='0'></a></div>";
slide_text = slide_text + "<div id='st-" + r + "' class='slide_text hide' onMouseover='stopSlide();' onMouseout='resumeSlide();'><h2>" + slide_title + "</h2><p>" + slide_content + "</p><a href='" + slide_link + "' class='small'>[More Info...]</a></div>";
}
}
}
// you shouldn't need to change anything beyond this point for the slide show

// slide show script
var firstTime = 1;
var theSlide = "";
var nextSlide = 0;
var SlideShowSpeed = 9000; // hold length
var t;
var moveIt = true;
var sct = slide_count;

function stopSlide() {
clearTimeout(t, 4000);
moveIt = false;
}

function resumeSlide() {
moveIt = true;
t = setTimeout('hsChangeSlide('+nextSlide+', '+sct+')', 4000);
}

function gotoSlide(id, sct) {
if (theSlide != id) {
clearTimeout(t);
jQuery("#sh-"+id).fadeTo("fast", 1.0);
jQuery("#th-"+id).addClass("on");
jQuery("#st-"+id).fadeTo("fast", 1.0);
jQuery("#sh-"+theSlide).fadeTo(1000, 0);
jQuery("#sh-"+theSlide).hide();		// hide current slide
jQuery("#th-"+theSlide).removeClass("on");	        // remove yellow from current thumb
jQuery("#st-"+theSlide).fadeTo(1000, 0);	        // hide current text
jQuery("#st-"+theSlide).hide();	        // hide current text
theSlide = id;											// set the slide to this id
nextSlide = id + 1;
if (nextSlide >= sct) nextSlide = 0;
if (moveIt == true) t = setTimeout('hsChangeSlide('+nextSlide+', '+sct+')', SlideShowSpeed);
}
}

function hsChangeSlide(id, sct) {
jQuery("#sh-"+id).fadeTo("slow", 1.0);
jQuery("#th-"+id).addClass("on");
jQuery("#st-"+id).fadeTo("slow", 1.0);
jQuery("#sh-"+theSlide).fadeTo(6000, 0);
jQuery("#sh-"+theSlide).hide();		// hide current slide
jQuery("#th-"+theSlide).removeClass("on");	        // remove yellow from current thumb
jQuery("#st-"+theSlide).fadeTo(6000, 0);	        // hide current text
jQuery("#st-"+theSlide).hide();	        // hide current text
theSlide = id;											// set the slide to this id
nextSlide = id + 1;
if (nextSlide >= sct) nextSlide = 0;
if (moveIt == true) t = setTimeout('hsChangeSlide('+nextSlide+', '+sct+')', SlideShowSpeed);
}
// end slide show script


