// -*- fill-column: 2000; comment-column: 0; comment-start: "//"  -*-
// The above emacs richness prevents line wraps and enables comment creation.
//
// Thu Jan 10 14:17:31 CST 2008, tim:
// Michelle Hindman downloaded this code, and it came without
// any copyright, authorship, or anything descriptive.
// It was generated via: http://www.ricocheting.com/js/slide2.html
// For now, we assume it is in the public domain.
//
// Thu Jan 10 14:22:35 CST 2008, tim:
// * Replaced set/clearTimeout functions and logic to use setInterval.
// * Added countdown display on play button.
// * Added Next/PrevSlide functions.
// * Added logic to reset countdown on next/prev/play condition.
// * Added logic for a resume Play to load next slide.
//
// Thu Jan 17 10:56:40 CST 2008, tim: 
// Added routine (via generator noted in this file's header) to
// randomize array before display.
//

theimage = new Array();


hostpath = 'http://www.cas.unt.edu:8000/slideshow-images/';
// The dimensions of ALL the images should be the same or some of them may look stretched or reduced in Netscape 4.
// Format: theimage[...]=[image URL, link URL, name/description]
theimage[0]=[hostpath + '001.jpg', 'http://www.biol.unt.edu', "Faculty in the <a href='http://www.biol.unt.edu'>Department of Biological Sciences</a> are funded by and serve on numerous national science advisory panels including the National Science Foundation, the U.S. Environmental Protection Agency, USDA, and the National Institutes of Health."];
theimage[1]=[hostpath + '002.jpg', 'http://www.chem.unt.edu', "The <a href='http://www.chem.unt.edu'>Department of Chemistry</a> houses the U.S. Department of Education-supported Center for Advanced Scientific Computing and Modeling (CASCAM), one of the most comprehensive computational chemistry programs in the United States."];
theimage[2]=[hostpath + '003.jpg', 'http://www.econ.unt.edu/EconEducation/', "The <a href='http://www.econ.unt.edu/EconEducation/'>UNT Center for Economic Education</a> is one of only six such centers nationally to have received the Albert Beekhuis Award for Centers of Excellence in Economic Education from the National Council on Economic Education."];
theimage[3]=[hostpath + '004.jpg', 'http://www.engl.unt.edu', "Since the beginning of 2009, faculty in the <a href='http://www.engl.unt.edu'>Department of English</a> have published six important books of criticism or creative writing. The department also produces two nationally recognized journals, <i>Studies in the Novel</i> and <i>American Literary Review.</i>"];
theimage[4]=[hostpath + '005.jpg', 'http://www.forl.unt.edu', "The <a href='http://www.forl.unt.edu'>Department of Foreign Languages and Literatures</a> has one of the most technologically-advanced student-interactive foreign language learning centers in the country and sponsors the only graduate French and Spanish summer institutes in the Southwest."];
theimage[5]=[hostpath + '006.jpg', 'http://www.geog.unt.edu', "The <a href='http://www.geog.unt.edu'>Department of Geography</a> is recognized as a leader in applied geography and serves as a sponsoring academic institution for the annual Applied Geography Conference."];
theimage[6]=[hostpath + '007.jpg', 'http://www.hist.unt.edu', "The Military History and Texas History programs in UNT's <a href='http://www.hist.unt.edu'>Department of History</a> are among the leading programs in the nation. "];
theimage[7]=[hostpath + '008.jpg', 'http://www.ias.unt.edu', "The <a href='http://www.ias.unt.edu'>Institute of Applied Science</a> is recognized by the Association for Integrative Studies, along with similar institutes at a handful of other major universities, for excellence in the 'study and practice of interdisciplinarity.'"];
theimage[8]=[hostpath + '009.jpg', 'http://www.inst.unt.edu', "The <a href='http://www.inst.unt.edu'>International Studies</a> major is the largest and most comprehensive undergraduate program of its kind in Texas -- and one of the fastest growing majors on campus."];
theimage[9]=[hostpath + '010.jpg', 'http://www.math.unt.edu', "In 2007 the UNT <a href='http://www.math.unt.edu'>Department of Mathematics'</a> team placed 49th nationally out of 516 teams in the annual Putnam Undergraduate Mathematics Competition."];
theimage[10]=[hostpath + '011.jpg', 'http://www.phil.unt.edu', "The <a href='http://www.phil.unt.edu'>Department of Philosophy and Religion Studies</a>, home of the leading graduate program in environmental ethics and environmental philosophy, has created the world's first field station in environmental philosophy, science, and policy at Cape Horn, Chile."];
theimage[11]=[hostpath + '012.jpg', 'http://www.phys.unt.edu', "The <a href='http://www.phys.unt.edu'>Department of Physics</a>' Ion Beam Modification and Analysis Laboratory is internationally recognized as one of the best equipped in the world."];
theimage[12]=[hostpath + '013.jpg', 'http://www.psci.unt.edu', "The <a href='http://www.psci.unt.edu'>Department of Political Science</a> is consistently ranked in the top five departments in the country in terms of publication in the top five general political science journals. "];
theimage[13]=[hostpath + '014.jpg', 'http://www.psyc.unt.edu', "The <a href='http://www.psyc.unt.edu'>Department of Psychology</a> attracts students nationally for scientific and practitioner training in their well-equipped Psychology Clinic in which more than 60 students see more than 700 clients yearly."];
theimage[14]=[hostpath + '015.jpg', 'http://www.rtvf.unt.edu', "The <a href='http://www.rtvf.unt.edu'>Department of Radio, Television and Film</a> is one of the nation’s leading programs in film/digital production, broadcast education, documentary, media culture and industry studies. It is also the home of the Center for Spanish Language Media."];
theimage[15]=[hostpath + '016.jpg', 'http://www.unt.edu/afrotc/', "The <a href='http://www.unt.edu/afrotc/'>Division of Aerospace Studies</a> opened its doors in 1951 and has, to date, commissioned more than 500 Second Lieutenants. Two have achieved the rank of General in the United States Air Force."];
theimage[16]=[hostpath + '017.jpg', 'http://www.wmst.unt.edu', "The <a href='http://www.wmst.unt.edu'>Women’s Studies Program</a> is one of the oldest interdisciplinary programs at UNT and has enjoyed steadily increasing enrollment in its courses since 2001. It is the only such program in the Metroplex with a transnational feminism course."];
theimage[17]=[hostpath + '018.jpg', 'http://www.unt.edu/jewishstudies/', "UNT's <a href='http://www.unt.edu/jewishstudies/'>Jewish Studies Program</a> is the only one at a public university in the DFW area, offering 38 courses on Jews, Judaism, and Israel."];
theimage[18]=[hostpath + '019.jpg', 'http://www.danceandtheatre.unt.edu/', "Student and faculty accomplishments in the <a href='http://www.danceandtheatre.unt.edu/'>Department of Dance &amp; Theatre</a> receive critical acclaim. Recent awards include a Golden Pen Award from the U.S. Institute for Theatre Technology and a DFW Theater Critics Forum Outstanding Actress Award."];
theimage[19]=[hostpath + '020.jpg', 'http://www.comm.unt.edu/', "The Computer Mediated Communication Lab in the <a href='http://www.comm.unt.edu/'>Department of Communication Studies</a> is one of only a handful of such facilities in the United States dedicated to research about the impact of various electronic environments on aspects of human communication."];
theimage[20]=[hostpath + '022.jpg', 'http://www.sphs.unt.edu/', "UNT's <a href='http://www.sphs.unt.edu/'>Department of Speech and Hearing Sciences</a> offers one of only four accredited clinical doctorate programs in audiology in Texas. The department's clinic has the only program in the Denton area serving children and adults with cochlear implants."];

theimage[21]=['http://www.cas.unt.edu/slideshowphotos/023.jpg', 'http://www.forensic.unt.edu/', "UNT's <a href='http://www.forensic.unt.edu/'>Forensic Science Program</a> is the only nationally accredited program of its kind in Texas and the surrounding states. It is led by faculty with national reputations in the forensic field."];

theimage[22]=['http://www.cas.unt.edu/slideshowphotos/024.jpg', 'http://www.unt.edu/', "The <a href='http://lingtechcomm.unt.edu'>Department of Linguistics and Technical Communication</a> offers students internships at companies across the U.S. The department also offers a dual Master's degree with the Universidad Aut&oacute;noma del Estado de M&eacute;xico. Students from both universities study at UNT and at UAEM."];

///// Plugin variables

playspeed=12000;// The playspeed determines the delay for the "Play" button in ms
dotrans=1; // if value = 1 then there are transitions played in IE
transtype='blendTrans';// 'blendTrans' or 'revealtrans'
transattributes='1';// duration=seconds,transition=#<24
//#####
//key that holds where in the array currently are
i=0;
// Displays countdown, in seconds, to user before next slide displays.
sstimer=0;

//###########################################
//if random
function SetRandom() {
    tempimage = new Array();       
    for(p=0; p<theimage.length; p++){      
        for(p1=0; p1>-1; p1) {        
            tempNum = Math.floor(Math.random()*theimage.length)  
                if(!tempimage[tempNum]){
                    tempimage[tempNum]=theimage[p];
                    break;
                }
        }
    }
    for(p=0;p<theimage.length;p++)theimage[p]=tempimage[p];
}

//if random order
SetRandom()

//###########################################
window.onload=function(){

	//preload images into browser
	preloadSlide();

	//set transitions
	GetTrans();

	//set the first slide
	SetSlide(0);

	//autoplay
	PlaySlide();
}

//###########################################
function SetSlide(num) {
	//too big
	i=num%theimage.length;
	//too small
	if(i<0)i=theimage.length-1;

	//switch the image
	if(document.all&&!window.opera&&dotrans==1)eval('document.images.imgslide.filters.'+transtype+'.Apply()')
	document.images.imgslide.src=theimage[i][0];
	if(document.all&&!window.opera&&dotrans==1)eval('document.images.imgslide.filters.'+transtype+'.Play()')

	//if they want name of current slide
	document.getElementById('slidebox').innerHTML=theimage[i][2];

	//if they want current slide number and total
	document.getElementById('slidecount').innerHTML= "Slide "+(i+1)+" of "+theimage.length;
}



//###########################################
function PlaySlide() {

        // if paused and we want to play ....
	if (!window.playing) {
                // If we are resuming from a pause, then it is a
                //   to feature to go to next slide (already viewed
                //   this one)
                if (sstimer > 0) {
                  SetSlide(i+1);
                }
                ResetSSTimer();
                PlayingSlide();
                playing=setInterval("PlayingSlide()",1000);
	}
        // else if playing and we want to pause ...
	else {
		playing=clearTimeout(playing);
		if(document.slideshow.play){
			document.slideshow.play.value="   Play   ";
		}
	}
	// if you have to change the image for the "playing" slide
	if(document.images.imgPlay){
		setTimeout('document.images.imgPlay.src="'+imgStop+'"',1);
		imgStop=document.images.imgPlay.src
	}
}


//###########################################
function ResetSSTimer() {
         sstimer = Math.round(playspeed/1000 + 1);
}

//###########################################
function PlayingSlide() {
         document.slideshow.play.value="   Pause (" + (sstimer - 1) + ")         ";
         if (sstimer > 1) {
                  sstimer--;
         } else {
                  ResetSSTimer();
                  SetSlide(i+1);
         }
}

//###########################################
function NextSlide() {
         ResetSSTimer();
         SetSlide(i+1);
}

//###########################################
function PrevSlide() {
         ResetSSTimer();
         SetSlide(i-1);
}

//###########################################w
//desc: picks the transition to apply to the images
function GetTrans() {
	//si=document.slideshow.trans.selectedIndex;

        if((document.slideshow.trans && document.slideshow.trans.selectedIndex == 0) || (!document.slideshow.trans && dotrans==0)){
		dotrans=0;
	}
	else if ((document.slideshow.trans && document.slideshow.trans.selectedIndex == 1) || (!document.slideshow.trans && transtype == 'blendTrans')){
		dotrans=1;
		transtype='blendTrans';
		document.imgslide.style.filter = "blendTrans(duration=1,transition=1)";
	}else{
		dotrans=1;
		transtype='revealtrans';
		if(document.slideshow.trans) transattributes=document.slideshow.trans[document.slideshow.trans.selectedIndex].value;
		document.imgslide.style.filter = "revealTrans(duration=1,transition=" +transattributes+ ")";
	}

}
//###########################################
function preloadSlide() {
	for(k=0;k<theimage.length;k++) {
		theimage[k][0]=new Image().src=theimage[k][0];
	}
}

