/*Original Design by Nettuts.com
**
** Modified by Patrick Eisenmann for support for lightbox.
** peisenmann@gmail.com
**
** To get it to work, your call to this file (as well as jquery.js and jquery.history.js) should be:
** <script type="text/javascript" src="js.js">var $ = jQuery.noConflict();</script>
** Change src="js.js" to whichever file you are calling.
**
**
** Modified by Andre Bluehs for support for .php.
**	contagious@gatech.edu
*/
$(function()
{
	$('.scroll-pane').jScrollPane();
    $('a.media').media( {width: 280, height: 175, autoplay: true} );
        $('a.flashguy').media( {width: 560, height: 460, autoplay: true, params:{wmode: 'transparent'}} );
	

});		


 $(function() {
	$("map > area").tooltip({
	positionLeft: true,
	showURL: false,
	showBody: " :: ",
	track: true
  });
});
 
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


$(document).ready(function() {
						   
	reinitialiseScrollPane = function()
		{
			
        // this one liner handles all the media on this page
        $('a.media').media( {width: 280, height: 175, autoplay: true} );
        $('a.flashguy').media( {width: 560, height: 460, autoplay: true, params:{wmode: 'transparent'}} );
			
			$('.scroll-pane').jScrollPane();
			
		//	swfobject.embedSWF("flash/im_new.swf", "flashman", "560", "460", "9.0.0", "flash/expressInstall.swf", {}, {wmode:"transparent"},{});
		//    swfobject.embedSWF("flash/player.swf", "media1", "280", "175", "9.0.0", "flash/expressInstall.swf", {controlbar:"none",autostart:"true",file:scoop_media}, {},{});
		//	swfobject.embedSWF("flash/player.swf", "media2", "280", "175", "9.0.0", "flash/expressInstall.swf", {controlbar:"none",autostart:"true",file:finding_media}, {},{});


	


			$("map > area").tooltip({
			positionLeft: true,
			showURL: false,
			showBody: " :: ",
			track: true
		 	});
			

		
		}
					   
	$('#info_center_content').wrap('<div id="content-wrapper"></div>');
						   
	function pageload(hash) {
		if(hash.substr(hash.length-3, hash.length) == "asp") {
			$("#content-wrapper").load(hash.substr(0,hash.length-3) + ".asp #info_center_content",'',function(){
				$('#content-wrapper').fadeIn('normal');
				$('#load').fadeOut('normal');
				reinitialiseScrollPane();

			});
	}


		
/*		To add support for more file types, uncomment below, and change ...HERE...
**		to whatever you want to support. Also change ...NUMBER... to the length of
**		the name of the file type. i.e. php = 3, html = 4.
** 
**		else if(hash.substr(hash.length-...NUMBER..., hash.length) == "...HERE...") {
**			$("#content-wrapper").load(hash.substr(0,hash.length-...NUMBER...) + "...HERE... #content",'',function(){
**				$('#content-wrapper').show('normal');
**				$('#load').fadeOut('normal');												   
**			});
**	}
*/


		else if(hash) {
			$("#content-wrapper").load(hash + ".html #info_center_content",'',function(){
				$('#content-wrapper').fadeIn('normal');
				$('#load').fadeOut('normal');
				reinitialiseScrollPane();
				
			});
		} 
		
	//	else {
//			$("#content-wrapper").load("the_scoop.asp #info_center_content", '', function(){
//				reinitialiseScrollPane();
//
//			}); //default
//		}
	}
	
	$.historyInit(pageload);			   

// Defines the area that forces an internal load vs reloading the page 

	$('#home_sign_nav a,#info_nav a').click(function(){
								  
		var hash = $(this).attr('href');
		hash = hash.replace(/^.*#/, '');
		
		if (hash.substr(hash.length-3, hash.length) == "asp") {
			hash = hash.substr(0, hash.length-4) + "asp";
		}
/*		To add support for more file types uncomment below and change ...HERE...
**		to whatever you wish to support. also change ...NUMBER... to the length of 
** 		the name of the file type. i.e. php = 3, html = 4.
**
**		else if (hash.substr(hash.length-...NUMBER..., hash.length) == "...HERE...") {
**			hash = hash.substr(0, hash.length-...NUMBER...+1) + "...HERE...";
**		}
*/	
		
		else {
			hash = hash.substr(0,hash.length-5);
		}

		//$('#content-wrapper').fadeOut('fast',function(){$.historyLoad(hash)});
		$('#content-wrapper').fadeOut('fast',function(){$.historyLoad(hash)});
		$('#load').remove();
		$('#sub_header').prepend('<span id="load">LOADING...</span>');
		$('#load').fadeIn('fast');
		return false;
		
	});
	
	// Plate Shaker 
	var in_hover = 0;
	
	$('.plate').hover(
		function(){
			if (!in_hover) {
			in_hover = 1;
			  $(this).effect("shake", { times: 1, distance : 5, direction: 'right' }, 100);
			}
			},//over
		function(){
			if (in_hover) {
			in_hover = 0;
		}

	}); //out

	

});

