/*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();
});		

$(document).ready(function() {
						   
	reinitialiseScrollPane = function()
		{
			$('.scroll-pane').jScrollPane();
		}
					   
	$('#whower_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 #whower_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 #whower_content",'',function(){
				$('#content-wrapper').fadeIn('normal');
				$('#load').fadeOut('normal');
				reinitialiseScrollPane();
				
			});
		} 
		
	//	else {
//			$("#content-wrapper").load("kidz.asp #kidz_content", '', function(){
//				reinitialiseScrollPane();
//
//			}); //default
//		}
	}
	
	$.historyInit(pageload);			   

	$('#whower_sidebar 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)});
		$('#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

	

});

