<!-- hide from non JavaScript Browsers

//This supposedly preloads the background images
Image1= new Image(1600,601)
Image1.src = "http://www.goshen.edu/g/css/images/backgrounds/bg-olive-green.gif"

Image2 = new Image(1600,601)
Image2.src = "http://www.goshen.edu/g/css/images/backgrounds/bg-olive-blue.gif"

Image3 = new Image(1600,601)
Image3.src = "http://www.goshen.edu/g/css/images/backgrounds/bg-olive-yellow.gif"

Image4 = new Image(1600,601)
Image4.src = "http://www.goshen.edu/g/css/images/backgrounds/bg-olive-orange.gif"

// End Hiding -->


/* Script taken from leemessenger.co.uk - Please do not remove this line
Script edited by Michael Neumann & Isaiah Goertz (09.30.10) */

	//var $startingScheme = Math.floor(Math.random()*6); //This makes the slideshow start somewhere randomly
	var $startingScheme = 2; //This lets you decide where the slide show starts

	var $currentSheet = $startingScheme;
	
	// $bg_images and $title_images should always be the same length
	var $bg_images = new Array ();
	$bg_images[0] = "global-green.css";	
	$bg_images[1] = "global-yellow.css";
	$bg_images[2] = "global-green.css";
	$bg_images[3] = "global-orange.css";
	$bg_images[4] = "global-yellow.css";
	$bg_images[5] = "global-blue.css";
	$bg_images[6] = "global-orange.css";
				
	var $title_images = new Array ();
	$title_images[0] = "/g/includes/gc-slides/slides/with-environment.gif";
	$title_images[1] = "/g/includes/gc-slides/slides/by-studying-abroad.gif";
	$title_images[2] = "/g/includes/gc-slides/slides/with-conversation.gif";
	$title_images[3] = "/g/includes/gc-slides/slides/with-your-future.gif";
	$title_images[4] = "/g/includes/gc-slides/slides/with-advent.gif";
	$title_images[5] = "/g/includes/gc-slides/slides/with-athletics.gif";
	$title_images[6] = "/g/includes/gc-slides/slides/through-patience.gif";
	
	function ChangeCSSBgImg(getFlag) {
	
		if (!document.getElementById) return false;
		
			var ImgPath = "http://www.goshen.edu/g/css/"
			
			if (!document.body) return false;
			
				var $header = document.getElementById('css1');
				var $background = $header.style.href;
				var $title_image = document.getElementById('text-image').firstChild;
				
				if( !getFlag ){
					$currentSheet --;
					if ( $currentSheet < 0 ){
						$currentSheet = ($bg_images.length - 1);
					}
					ImgURL =  ImgPath + $bg_images[$currentSheet];
					TitleURL = $title_images[$currentSheet];
				}else{
				
					$currentSheet ++;
					if ( $currentSheet >= $bg_images.length ){
						$currentSheet = 0;
					}
					
					ImgURL =  ImgPath + $bg_images[$currentSheet];
					TitleURL = $title_images[$currentSheet];
				}
				
				if ($background != ImgURL) {
					$header.href = ImgURL;
				}
				
				if ($title_image.src != TitleURL) {
					$title_image.src = TitleURL;
					$title_image.alt = $title_image.src.match(/\/([^/]*)\.(gif|jpg|png)/i)[1].replace(/[\-_]/g,' ');
					$title_image.title = 'make peace ' + $title_image.alt;
				}
				
			}
			
			/* Custom onload function */
			
			function addLoadEvent(func) {
				var oldonload = window.onload;
					if (typeof window.onload != 'function') {
					window.onload = func;
					} else {
					window.onload = function() {
				oldonload();
			func();
			}
		}
	}
	
	 $(document).ready(function(){
    
		$('#p_stu').click(function () {
		  $('#menu_block1').toggle("slow");
		});    
	 });

	/* trigger onload */ 
	
	$(function() {
		$('#feature').cycle({ 
			fx:     'fade',
			speed:	'fast',
			timeout: 8000,
			nowrap: 0,
			next:   '#next2', 
			prev:   '#prev2',
			startingSlide: $startingScheme, 
			before: function(curr, next, opts, flag) {
			ChangeCSSBgImg(flag);
			} 
			
		});

		$('#feature > #pause').toggle(
			function() {
				$(this).addClass('paused').removeClass('pause');
				$('#feature').cycle('pause');
			},	
			function() {
				$(this).addClass('pause').removeClass('paused');
				$('#feature').cycle('resume');
			}	
		);
		
		$('#feature').mouseover(
			function(){
				if ($('#pause').hasClass('paused') == false) {
					$('#feature').cycle('pause');
				}
			}
		).mouseout(
			function() {
				if($('#pause').hasClass('paused') == false) {
					$('#feature').cycle('resume');
				}
			}
		);
		
	});

