/* MIT Engineering Homepage Effects (requires jQuery, jQuery UI Accordion, and jQuery UI effects) *//* by White Whale Web Services */var intro_backgrounds=[ // background images (with caption/credit) for intro quotes	{file:'leaf.jpg',caption:'Great engineering does not reinvent the symmetries and complexities of nature–it imitates them.',credit:'Photo by Flickr user <a href="http://www.flickr.com/photos/hernandezfisher" target="_blank">Carlos Hernandez</a>.'},	{file:'furnace.jpg',caption:'Electric phosphate smelting furnace used in the making of elemental phosphorus in a TVA chemical plant in the Muscle Shoals area, Alabama, June 1942.',credit:'Photo by Alfred T. Palmer, as part of The Library of Congress.'},	{file:'grinders.jpg',caption:'A close-up of a pair of milling grinders in the D-Lab.',credit:'Photo by Flickr user <a href="http://www.flickr.com/photos/connors934" target="_blank">connors934</a>'},	{file:'kinetic.jpg',caption:'One of the kinetic sculptures by <a href="en.wikipedia.org/wiki/Arthur_Ganson" target="_blank">Arthur Ganson</a>, an MIT artist-in-residence, as seen on display at the Gestural Engineering exhibit at the MIT Museum.',credit:'Photo by Flickr user <a href="http://www.flickr.com/photos/renzodionigi" target="_blank">renzodionigi</a>.'},	{file:'lathe.jpg',caption:'An antique (c.1893) Velocipede treadle-operated industrial lathe from the MIT Flea Market.',credit:'Photo taken by Flickr user <a href="http://www.flickr.com/photos/andyi" target="_blank">andyi</a>.'},	{file:'robot.jpg',caption:'<a href="http://en.wikipedia.org/wiki/Kismet_(robot)" target="_blank">Kismet</a> is a robot made in the late 1990s at MIT with auditory, visual and expressive systems intended to participate in human social interaction and to demonstrate simulated human emotion and appearance.',credit:'Photo by Flickr user <a href="http://www.flickr.com/photos/renzodionigi" target="_blank">renzodionigi</a>.'},	{file:'stata.jpg',caption:'The Ray and Maria Stata Center is a 720,000-square-foot academic complex designed by Frank Gehry to house MIT’s  Computer Science and Artificial Intelligence Laboratory, the Laboratory for Information and Decision Systems, and the Department of Linguistics and Philosophy, among others. The building opened on March 16, 2004. It sits on the site of the former Building 20, which housed the historic Radiation Laboratory.',credit:'Photo by Flickr user <a href="http://www.flickr.com/photos/Qvidja50" target="_blank">Alan Lishness</a>.'},	{file:'welder.jpg',caption:'Welder making boilers for a ship, Combustion Engineering Co., Chattanooga, Tennessee, June 1942.',credit:'Photo by Alfred T. Palmer, as part of The Library of Congress.'},	{file:'minsky.jpg',caption:'The "Minsky Arm" was developed by Marvin Minsky and Seymour Papert during their multi-year project to develop a computer system that could see and manipulate objects independent of human control. ',credit:'Photo by Flickr user <a href="http://www.flickr.com/photos/renzodionigi" target="_blank">renzodionigi</a>.'},	{file:'chalkboard.jpg',caption:'The remnants of an spring semester afternoon course in <a href="http://whereis.mit.edu/map-jpg?zoom=level1&selection=56&selectlayer=Buildings&selectfield=facility&centerx=710704&centery=496070&oldzoom=level1&map.x=155&map.y=267" target="_blank">Building 16</a>.',credit:''},	{file:'submarine.jpg',caption:'For nearly a century, MIT has been a leading center of marine vehicle research and design, and is widely recognized for its contributions in such areas as hydrodynamics, ship structural mechanics and dynamics, propeller design, and overall ship design. The Center for Ocean Engineering contributes to the development of autonomous underwater vehicles (AUVs), which have unprecedented capacity to survey the ocean, map the ocean floor, and retrieve objects and artifacts from the water.',credit:'From the MIT photo archives.'},	{file:'pumpkin.jpg',caption:'Every year MIT students in the glass blowing class produce hundreds of beautiful pumpkins and gourds that are sold on the MIT quad to raise money to support the lab. People line up hours in advance for the chance to buy the pumpkin of their dreams.',credit:'Photo by Flickr user <a href="http://www.flickr.com/photos/hollyladd/">Holly Ladd</a>'},	{file:'pressure.jpg',caption:'A detail from the network of underground tunnels at MIT. Those who don’t get lost in the labyrinth can get from Kendall Square all the way to Massachusetts Avenue without stepping outside.',credit:''}];$(document).ready(function() { // on DOM load	var questions_offset=0;		// Append the showinfo div to the #intro .content div	$('#intro .content').append('<div class="showinfo"><a href="#" title="Click for information about this photograph">info</a></div><div class="photo_info_container"><div class="photo_info"><p class="caption"></p><p class="credit"></p></div></div>');		// Define intro styles and caption/credit	intro_backgrounds.sort(function() { return 0.5 - Math.random();  }); // shuffle the backgrounds	var background = intro_backgrounds.pop(); // grab one to use for the dean's quote	$('#intro li:first-child').data('background',background).show().add('#intro h2').css('background-image','url(/images/homepage/backgrounds/intro/'+background.file+')'); // and set it	$('.photo_info_container').hide().find('.caption').html(background.caption).end().find('.credit').html(background.credit);	var quoteList = $('#intro ul');	// Get the homepage quotes	var quotes = new Array();	$.get('/includes/quotes.php',function(data) {		var curstyle = 0;		$(data).find('li').each(function() {			var background = intro_backgrounds[curstyle++%intro_backgrounds.length]			$(this).data('background',background);			quotes.push($(this).css('background-image','url(/images/homepage/backgrounds/intro/'+background.file+')').hide());			if(!($.browser.msie&&parseFloat($.browser.version)<7)) setTimeout(function() { $('<img src="/images/homepage/backgrounds/intro/'+background.file+'"/>'); },1000); // preload background images image		});		$.each(quotes,function(key,quote) {			quoteList.append(quote);		});		$('#intro li').find('a').click(function(){ return false; }); // cancel clicks on all intro quotes		// Intro quote navigation		$('#intro .content').append('<div class="panel_navigation"><span class="previous">&lt; <span>previous</span></span><span class="next"><span>next</span> &gt;</span></div>'); // append next/prev links		$('#intro .panel_navigation .next').click(function() {			var current = $('#intro li:visible'),				next;			if(current.is(':animated')) return false;			if(current.next().length) next = current.next(); // if there's a next one, show it				else next = current.siblings().eq(0); // otherwise, show first			var background = next.data('background');			$('.photo_info_container').hide().find('.caption').html(background.caption).end().find('.credit').html(background.credit);			$('.showinfo').find('.active').removeClass('active');			next.fadeIn(function() {				$('#intro h2').css('background-image','url(/images/homepage/backgrounds/intro/'+background.file+')');				current.hide();			});			$('#intro .panel_navigation .previous').fadeIn(400);		});		$('#intro .panel_navigation .previous').click(function() {			var current = $('#intro li:visible'),				prev;			if(current.is(':animated')) return false;			if(current.prev().length) prev = current.prev().fadeIn(); // if there's a previous one, show it			else prev = current.siblings().filter(':last-child').fadeIn(); // otherwise, show last			var background = prev.data('background');			$('.photo_info_container').hide().find('.caption').html(background.caption).end().find('.credit').html(background.credit);			$('.showinfo').find('.active').removeClass('active');			prev.show();			current.fadeOut(function() {				$('#intro h2').css('background-image','url(/images/homepage/backgrounds/intro/'+background.file+')');			});		});	});			$('#content').accordion({header:'h2',clearStyle: true}); // add accordion effect	if(location.hash) $('#content').accordion('activate',$('#content').children().index($(location.hash))); // if a specific tab was requested, show it	$('.panel h2').click(function(){		$('.photo_info_container').hide();	});		// News Ticker script	$('#news .second ul').clone().prependTo('#news').wrap('<div id="newsticker"/>').children().prepend('Latest News:');	$("#newsticker ul").prepend('<li>Latest News:'+$('#news .first h3').html()+'</li>');		// Scroll newsticker	tickerTimer = setInterval(scrollTicker,3750);				// Pause the News Ticker when it is hovered over	$('#newsticker').hover(function(){		clearTimeout(tickerTimer);		clearInterval(tickerTimer);	},function(){		tickerTimer = setTimeout(function() {			scrollTicker();			tickerTimer = setInterval(scrollTicker,3750);		},750);	});		// Opens LW-generated news links in a new window	$('#news .lw_widget_news li a').attr("target","_blank");		// Behavior for the info button on the intro quotes	$('.showinfo a').click(function(){		$('.photo_info_container').toggle();		$(this).toggleClass('active');		return false;	});		}); //closes document readyvar tickerTimer; // scrollTicker functionfunction scrollTicker() {	var ticker = $('#newsticker ul'); // keeps jquery from searching for this over and over	ticker.animate({top:'-=23px'},450,function(){		var offset = ticker.position().top * -1; // how far has the newsticker scrolled? (positive # of pixels)		if(offset>=(23*(ticker.find('li').length-1))) {			ticker.css('top',-23);		}		});}function shuffle(set) { // shuffle function to randomize photo backgrounds    for (var j,x,i=set.length;i;j=parseInt(Math.random()*i),x=set[--i],set[i]=set[j],set[j]=x);    return set;};