jQuery(document).ready(function($) {


	
	// //////////////////////////////////////////////
	// SETTING UP SCROLL FUNCITONALITY AND HASH-BASED FUNCTIONALITY
	// //////////////////////////////////////////////
	
	$('#access ul.menu').addClass('navi');
	$('#access ul.navi li a').addClass('main-item');
	$('#access ul.navi li ul a').removeClass('main-item');
	
		$("#flowpanes").scrollable({ circular: false, mousewheel: false, keyboard: false, speed: 1000 }).navigator({
			navi: "#menu-main-nav",
			naviItem: 'a.main-item',
			activeClass: 'current_nav_item',
			history: true
		});

	
		// using this for initial page load and hashchange function below after that.
		var currentHash = window.location.hash;
		switch (currentHash) {
		// USE SWITCH STATEMENT TO DETERMINE hash on page load
			case "#home":
				var sectionHeight = $('#homeContent').height();
				$('#homeContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#homeContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				$('#homeContent .content_wrap').fadeIn();
				if (sectionHeight > 515) {
					//$('#footer').css('top', sectionHeight - 515);
					$('#footer').animate({top:sectionHeight-515}, 500);
				} else {
					//$('#footer').css('top', 0);
					$('#footer').animate({top:0}, 500);
				}
				var wrapperHeight = $('#homeContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;
		
			case "#about":
				var sectionHeight = $('#aboutContent').height();
				$('#aboutContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#aboutContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				$('#aboutContent .content_wrap').fadeIn();
				$('#aboutContent .dynamic_subnav').fadeIn();
				//$('#aboutContent').siblings('.section').css('display', 'none');
				if (sectionHeight > 515) {
					$('#footer').animate({top:sectionHeight-515}, 500);
				} else {
					$('#footer').animate({top:0}, 500);
				}
				var wrapperHeight = $('#aboutContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;

			case "#programs":
				var sectionHeight = $('#programsContent').height();	
				$('#programsContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#programsContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				$('#programsContent .content_wrap').fadeIn();
				$('#programsContent .dynamic_subnav').fadeIn();
				if (sectionHeight > 515) {
					$('#footer').animate({top:sectionHeight-515}, 500);
				} else {
					$('#footer').animate({top:0}, 500);
				}
				var wrapperHeight = $('#programsContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;

			case "#meet":
				var sectionHeight = $('#meetContent').height();
				$('#meetContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#meetContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				$('#meetContent .content_wrap').fadeIn();
				if (sectionHeight > 515) {
					$('#footer').animate({top:sectionHeight-515}, 500);
				} else {
					$('#footer').animate({top:0}, 500);
				}
				var wrapperHeight = $('#meetContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;

			case "#help":
				var sectionHeight = $('#helpContent').height();	
				$('#helpContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#helpContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				$('#helpContent .content_wrap').fadeIn();
				$('#helpContent .dynamic_subnav').fadeIn();
				if (sectionHeight > 515) {
					$('#footer').animate({top:sectionHeight-515}, 500);
				} else {
					$('#footer').animate({top:0}, 500);
				}
				var wrapperHeight = $('#helpContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;

			case "#media":
				var sectionHeight = $('#mediaContent').height();
				$('#mediaContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#mediaContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				$('#mediaContent .content_wrap').fadeIn();	
				if (sectionHeight > 515) {
					$('#footer').animate({top:sectionHeight-515}, 500);
				} else {
					$('#footer').animate({top:0}, 500);
				}
				var wrapperHeight = $('#mediaContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;

			case "#contact":
				var sectionHeight = $('#contactContent').height();
				$('#contactContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#contactContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				$('#contactContent .content_wrap').fadeIn();	
				if (sectionHeight > 515) {
					$('#footer').animate({top:sectionHeight-515}, 500);
				} else {
					$('#footer').animate({top:0}, 500);
				}
				var wrapperHeight = $('#contactContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;
			
			default : //alert("BLAH DEFAULT");

			var sectionHeight = $('#homeContent').height();
			$('#homeContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
			$('#homeContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
			$('#homeContent .content_wrap').fadeIn();
			if (sectionHeight > 515) {
				//$('#footer').css('top', sectionHeight - 515);
				$('#footer').animate({top:sectionHeight-515}, 500);
			} else {
				//$('#footer').css('top', 0);
				$('#footer').animate({top:0}, 500);
			}
			var wrapperHeight = $('#homeContent').height() + $('#footer').height() + 255;
			$('#wrapper').css('height', wrapperHeight);					

		}

		


// Trigger the event (useful on page load).
//$(window).hashchange();



	$(window).hashchange( function(){
				
		var currentHash = location.hash;
		
		switch (currentHash) {
		// USE SWITCH STATEMENT TO DETERMINE PAGE
			case "#home":
				//window.location="http://localhost/wp-testing/#home";
				//alert('homepage!!!');
				$('#homeContent .content_wrap').fadeIn();
				var sectionHeight = $('#homeContent').height();	
				$('#homeContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#homeContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				if (sectionHeight > 515) {
					//$('#footer').css('top', sectionHeight - 515);
					$('#footer').animate({top:sectionHeight-515}, 1500).stop(true, true);
				} else {
					//$('#footer').css('top', 0);
					$('#footer').animate({top:0}, 1500).stop(true, true);
				}
				var wrapperHeight = $('#homeContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;
		
			case "#about":
				$('#aboutContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#aboutContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				$('#aboutContent .content_wrap').fadeIn();
				$('#aboutContent .dynamic_subnav').fadeIn();
				var sectionHeight = $('#aboutContent').height();
				if (sectionHeight > 515) {
					$('#footer').animate({top:sectionHeight-515}, 1500).stop(true, true);
				} else {
					$('#footer').animate({top:0}, 1500).stop(true, true);
				}

				var wrapperHeight = $('#aboutContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);
				

			break;

			case "#programs":
				$('#programsContent .content_wrap').fadeIn();
				$('#programsContent .dynamic_subnav').fadeIn();
				var sectionHeight = $('#programsContent').height();	
				$('#programsContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#programsContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				if (sectionHeight > 515) {
					$('#footer').animate({top:sectionHeight-515}, 1500).stop(true, true);
				} else {
					$('#footer').animate({top:0}, 1500).stop(true, true);
				}
				var wrapperHeight = $('#programsContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;

			case "#meet":
				$('#meetContent .content_wrap').fadeIn();
				var sectionHeight = $('#meetContent').height();	
				$('#meetContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#meetContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				if (sectionHeight > 515) {
					$('#footer').animate({top:sectionHeight-515}, 1500).stop(true, true);
				} else {
					$('#footer').animate({top:0}, 1500).stop(true, true);
				}
				var wrapperHeight = $('#meetContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;

			case "#help":
				$('#helpContent .content_wrap').fadeIn();
				$('#helpContent .dynamic_subnav').fadeIn();
				var sectionHeight = $('#helpContent').height();	
				$('#helpContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#helpContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				if (sectionHeight > 515) {
					$('#footer').animate({top:sectionHeight-515}, 1500).stop(true, true);
				} else {
					$('#footer').animate({top:0}, 1500).stop(true, true);
				}
				var wrapperHeight = $('#helpContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;

			case "#media":
				var sectionHeight = $('#mediaContent').height();
				$('#mediaContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#mediaContent .content_wrap').fadeIn();	
				if (sectionHeight > 515) {
					$('#footer').animate({top:sectionHeight-515}, 1500).stop(true, true);
				} else {
					$('#footer').animate({top:0}, 1500).stop(true, true);
				}
				var wrapperHeight = $('#mediaContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;

			case "#contact":
				$('#contactContent .content_wrap').fadeIn();
				var sectionHeight = $('#contactContent').height();
				$('#contactContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#contactContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				if (sectionHeight > 515) {
					$('#footer').animate({top:sectionHeight-515}, 1500).stop(true, true);
				} else {
					$('#footer').animate({top:0}, 1500).stop(true, true);
				}
				var wrapperHeight = $('#contactContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

			break;
			
			default : //alert("DEFAULT");

				$('#homeContent .content_wrap').fadeIn();
				var sectionHeight = $('#homeContent').height();	
				$('#homeContent').siblings('.section').children('.entry').children('.content_area').children('.content_wrap').fadeOut();
				$('#homeContent').siblings('.section').children('.entry').children('.dynamic_subnav').fadeOut();
				if (sectionHeight > 515) {
					//$('#footer').css('top', sectionHeight - 515);
					$('#footer').animate({top:sectionHeight-515}, 1500).stop(true, true);
				} else {
					//$('#footer').css('top', 0);
					$('#footer').animate({top:0}, 1500).stop(true, true);
				}
				var wrapperHeight = $('#homeContent').height() + $('#footer').height() + 255;
				$('#wrapper').css('height', wrapperHeight);

		}
	
	});
		

		// //////////////////////////////////////////////
		// END SCROLL SETUP/HASH   ////////////////////////
		// //////////////////////////////////////////////
	
	
	
	
	
	
	
	
	// get access to the jqueryTools API
		var api = $("#flowpanes").data("scrollable");

		// using scrollable API for nav items for smoother scrolling in IE7

		$('div#contact_btn a').click(function() {
			api.seekTo(6, 1500);

		});



		
		
		
		
		// //////////////////////////////////////////////
		// SUBMENUS ///////////////////////////////
		// //////////////////////////////////////////////

		// add hasSubMenu class to main nav items with a drop down

		// faux current item on sub nav

		$('.dynamic_subnav li a').click(function() {
			$(this).parent('li').siblings().removeClass('current_page_item');
			$(this).parent('li').children('ul').children('li').removeClass('current_page_item');
			$(this).parent('li').siblings().children('ul').children('li').removeClass('current_page_item');
			$(this).parent('li').addClass('current_page_item');
		});
		
		$('.dynamic_subnav li ul li a').click(function() {
			$(this).parent('li').siblings().removeClass('current_page_item');
			$(this).parent('li').parent('ul').parent('li').addClass('current_page_item');
			$(this).parent('li').parent('ul').parent('li').siblings('li').removeClass('current_page_item');
			$(this).parent('li').addClass('current_page_item');
		});
		

		
		$('#access a.main-item').click(function() {
			// $('.dynamic_subnav
			// li.current_page_item').removeClass('current_page_item');
			});

		// current page item class for dropdowns and subnavs

		$('.sub-menu li a').click(
				function() {
					var thisContent = $(this).html();
					var thisContentParent = $(this).parent('li').parent('ul')
							.parent('li').children('a.main-item').html();
					var subnavID = ('#' + thisContentParent + '_subnav');
					// alert(subnavID);

					$(subnavID + ' li a').each(function() {
						var thisSubnavContent = $(this).html();
						// alert(thisContent + "is from the dynamic sub click");
							// alert(thisSubnavContent);
							if ($(this).html() == thisContent) {
								$(this).parent('li').addClass(
										'current_page_item');
								$(this).parent('li').siblings('li')
										.removeClass('current_page_item');
							}
							return (thisSubnavContent != thisContent);
						});
				});
		
		
		
		

		// loading subnav content into the main content areas.

		$('#About_subnav li a').click(function() {

			var dataLocation = $(this).attr("href");
			var dataLink = dataLocation + " #primary_content";

			$('#about_content').empty();
			$('#about_content').load(dataLink, function() {

				// Change the footer position when content is loaded

					var subSectionHeight = $('#about_content').height();
					if (subSectionHeight > 515) {
							// $('#footer').css('top', sectionHeight - 515);
						$('#footer').animate( {
							top : subSectionHeight - 495
						}, 1500).stop(true, true);
					} else {
						$('#footer').animate( {
							top : 0
						}, 1500).stop(true, true);
					}

					var wrapperHeight = $('#aboutContent').height() + $('#footer').height() + 255;
					$('#wrapper').css('height', wrapperHeight);

					
			});

			return false;

		}); // stop load function

		$('#Programs_subnav li a').click(function() {

			var dataLocation = $(this).attr("href");
			var dataLink = dataLocation + " #primary_content";

			$('#program_content').empty();

			$('#program_content').load(dataLink, function() {

				// Change the footer position when content is loaded

					var subSectionHeight = $('#program_content').height();
					if (subSectionHeight > 515) {
						// $('#footer').css('top', sectionHeight - 515);
					$('#footer').animate( {
						top : subSectionHeight - 495
					}, 1500).stop(true, true);
					} else {
						$('#footer').animate( {
							top : 0
						}, 1500).stop(true, true);
					}

					var wrapperHeight = $('#programsContent').height() + $('#footer').height() + 255;
					$('#wrapper').css('height', wrapperHeight);


			});

			return false;

		}); // stop load function

		$('#Help_subnav li a').click(function() {

			var dataLocation = $(this).attr("href");
			var dataLink = dataLocation + " #primary_content";

			$('#help_content').empty();
			$('#help_content').load(dataLink, function() {

				// Change the footer position when content is loaded

					var subSectionHeight = $('#help_content').height();
					if (subSectionHeight > 515) {
						// alert(subSectionHeight);
					// $('#footer').css('top', sectionHeight - 515);
					$('#footer').animate( {
						top : subSectionHeight - 495
					}, 1500).stop(true, true);
					} else {
						// alert('not tall enough!');
						$('#footer').animate( {
							top : 0
						}, 1500).stop(true, true);
					}

					var wrapperHeight = $('#helpContent').height() + $('#footer').height() + 255;
					$('#wrapper').css('height', wrapperHeight);


			});

			return false;

		}); // stop load function

		
		
		
		
		
		
		
		// handle the scrolling and content loading for about subnav items in
		// the main nav dropdown

		$('li#menu-item-126 ul.sub-menu li a').click(function() {
			window.location.hash = 'about';

			var dataLocation = $(this).attr("href");
			var dataLink = dataLocation + " #primary_content";
			// alert(dataLink);
				// api.seekTo(1, 1500);

				$('#about_content').empty();
				$('#about_content').load(dataLink, function() {

					// Change the footer position when content is loaded

						var subSectionHeight = $('#about_content').height();
						if (subSectionHeight > 515) {
							// $('#footer').css('top', sectionHeight - 515);
						$('#footer').animate( {
							top : subSectionHeight - 495
						}, 1500).stop(true, true);
						} else {
							$('#footer').animate( {
								top : 0
							}, 1500).stop(true, true);
						}

						var wrapperHeight = $('#aboutContent').height() + $('#footer').height() + 255;
						$('#wrapper').css('height', wrapperHeight);

						
				});

				return false;

			});

		$('li#menu-item-131 ul.sub-menu li a').click(function() {
			window.location.hash = 'programs';

			var dataLocation = $(this).attr("href");
			var dataLink = dataLocation + " #primary_content";
			// alert(dataLink);
				// api.seekTo(2, 1500);

				$('#program_content').empty();
				$('#program_content').load(dataLink, function() {

					// Change the footer position when content is loaded

						var subSectionHeight = $('#program_content').height();
						if (subSectionHeight > 515) {
							// $('#footer').css('top', sectionHeight - 515);
						$('#footer').animate( {
							top : subSectionHeight - 495
						}, 1500).stop(true, true);
						} else {
							$('#footer').animate( {
								top : 0
							}, 1500).stop(true, true);
						}
						var wrapperHeight = $('#programsContent').height() + $('#footer').height() + 255;
						$('#wrapper').css('height', wrapperHeight);

				});

				return false;

			});

		$('li#menu-item-128 ul.sub-menu li a').click(function() {
			window.location.hash = 'help';

			var dataLocation = $(this).attr("href");
			var dataLink = dataLocation + " #primary_content";
			// alert(dataLink);
				// api.seekTo(4, 1500);

				$('#help_content').empty();
				$('#help_content').load(dataLink, function() {
					// alert(dataLink);
						// Change the footer position when content is loaded

						var subSectionHeight = $('#help_content').height();
						if (subSectionHeight > 515) {
							// $('#footer').css('top', sectionHeight - 515);
							$('#footer').animate( {
								top : subSectionHeight - 495
							}, 1500).stop(true, true);
						} else {
							$('#footer').animate( {
								top : 0
							}, 1500).stop(true, true);
						}
						var wrapperHeight = $('#helpContent').height() + $('#footer').height() + 255;
						$('#wrapper').css('height', wrapperHeight);


					});

				return false;

			});








// Inline sub nav
		
		
		$('#inline_subnav a').live('click', function() {
			
			var dataLocation = $(this).attr("href");
			var dataLink = dataLocation + " #primary_content";

			var parentDiv = $(this).parent().parent().parent().parent().parent().parent();
			
			
			alert(parentDiv);
			$(parentDiv).empty(); 
			
			

			$(parentDiv).load(dataLink, function() {

				// Change the footer position when content is loaded

					var subSectionHeight = $(parentDiv).height();
					if (subSectionHeight > 515) {
						// $('#footer').css('top', sectionHeight - 515);
					$('#footer').animate( {
						top : subSectionHeight - 495
					}, 1500).stop(true, true);
					} else {
						$('#footer').animate( {
							top : 0
						}, 1500).stop(true, true);
					}

					var wrapperHeight = subSectionHeight + $('#footer').height() + 255;
					$('#wrapper').css('height', wrapperHeight);


			});

			return false;

		}); // stop load function







		////////////////////////////////////////////////
		//END SUBMENUS    ///////////////////////////////
		////////////////////////////////////////////////

		
		
				
		// replacing the href for main nav links with the title attribute so we can scroll (assigned in the WP menus system)


			$('#access ul.navi li a.main-item').each( function() {
				var thisTitle = $(this).attr('title');
				$(this).attr('href', thisTitle);
			});

			
			
			// adding scroll functionality for top-level footer nav items.
				
				$('ul#menu-footer-nav li a').addClass('scroll-item');
				$('ul#menu-footer-nav li ul a').removeClass('scroll-item');
				
				$('ul#menu-footer-nav li a.scroll-item').each( function() {
					var thisTitle = $(this).attr('title');
					$(this).attr('href', thisTitle);
				});
				
				

				
				
				


			 	$('a#videos_link').click( function() {
					loadVideoGallery();
					return false;
			 	});

			 	$('a#photos_link').click( function() {
			 		loadPhotoGallery();
			 		return false;
			 	});

			 	
			 	
			 	
			 	
			 	
			 	
			    
			 // Load photo gallery


			 function loadPhotoGallery() {
			 	$('.photos-gallery').load('photos.html #primary_content', function() {

			 		$('.videos-gallery').fadeOut(500, function() {
			  			$('.photos-gallery').fadeIn(500);
			  		});

			 		$.getScript("wp-content/themes/oasis/scripts/site_scripts.js");
			 		$('a#photos_link').addClass('current_media');
			 		$('a#videos_link').removeClass('current_media');

			 		var photoCount = $(".photos-gallery .ngg-galleryoverview .ngg-gallery-thumbnail-box");

			 		  $cnt = photoCount.length;
			 		  $i = $cnt + 1;
			 		  while($i < 19){
			 			  $('.ngg-clear').before('<div class="photo-holder"><img src="wp-content/themes/oasis/images/thumb_over.png" alt="" /></div>');
			 			  //$('.photos-gallery .ngg-galleryoverview').append('<div class="photo-holder"><img src="wp-content/themes/oasis/images/thumb_over.png" alt="" /></div>');
			 			$i++;
			 		   }

			 		//alert('loaded!!!');
			 	});
			 }

			 	
// load video gallery


			 function loadVideoGallery() {
//			 	$('.videos-gallery').load('media/videos/ #primary_content', function() {

			 		$('.photos-gallery').fadeOut(500, function() {
			  			$('.videos-gallery').fadeIn(500);
			  		});

//			 		$.getScript("wp-content/themes/oasis/scripts/site_scripts.js");
			 		$('a#photos_link').removeClass('current_media');
			 		$('a#videos_link').addClass('current_media');

			 		var videoCount = $(".videos-gallery .ngg-galleryoverview .ngg-gallery-thumbnail-box");

			 		  $cnt = videoCount.length;
			 		  $i = $cnt + 1;
			 		 
			 		  while($i < 19){
			 			  //$('.ngg-navigation').before('<div class="photo-holder"><img src="wp-content/themes/oasis/images/thumb_over.png" alt="" /></div>');
			 			  $('.videos-gallery .ngg-galleryoverview').append('<div class="photo-holder ngg-gallery-thumbnail-box"><img src="wp-content/themes/oasis/images/thumb_over2.png" alt="" /></div>');
			 			$i++;
			 		   }

			 		//alert('loaded!!!');
//			 	});
			 }


			 
			 
			 $('li#menu-item-129 a').click(function() {
			 	loadPhotoGallery();
			 });

			 
			     
			 $('.ngg-navigation a').live('click', function() {
			 	var loadURL = $(this).attr('href');
			 	//alert(loadURL);
			 	
			 	$('.photos-gallery').load(loadURL + ' #primary_content', function() {
			 		
			 		$.getScript("wp-content/themes/oasis/scripts/site_scripts.js");
			 		$.getScript("wp-content/themes/oasis/scripts/home_page_scripts.js");

			 		var photoCount = $(".photos-gallery .ngg-galleryoverview .ngg-gallery-thumbnail-box");

			 		  $cnt = photoCount.length;
			 		  $i = $cnt + 1;
			 		 
			 		  while($i < 19){
			 			  $('.ngg-navigation').before('<div class="photo-holder"><img src="wp-content/themes/oasis/images/thumb_over.png" alt="" /></div>');

//			 			  $('.photos-gallery .ngg-galleryoverview').append('<div class="photo-holder"><img src="wp-content/themes/oasis/images/thumb_over.png" alt="" /></div>');
			 			$i++;
			 		   }

			 		  
			 		  
			 		//alert('loaded!!!');
			 	});
			 	return false;
			 });




				// have to do this b/c of IE and its usually buginess with Flash...
				function refreshMeetVideo() {
					$('.inline_video').each(function() {
						var meetHolderHTML = $(this).html();
						$(this).empty();
						$(this).html(meetHolderHTML);
					});	
				}

				

			 $(window).hashchange( function(){
			 	
			 		var flashHolder = $('object').parent();
			 		var flashHolderHTML = $('object').parent().html();
			 		
			 		refreshMeetVideo();
			 		
			 		$(flashHolder).empty();
			 		
			 		$(flashHolder).html(flashHolderHTML);
			 		//$('object').css('visibility', 'visible');
			 	
			 });




			 
			 
			 
			 $('.section #nav-below a').live('click', function() {
				 	var loadURL = $(this).attr('href');
				 	//alert(loadURL);
				 	$('#about_content').load(loadURL + ' #primary_content', function() {				 		
				 		//$.getScript("wp-content/themes/oasis/scripts/site_scripts.js");
				 		//$.getScript("wp-content/themes/oasis/scripts/home_page_scripts.js");
				 	});
				 	return false;
			 });


			 
// remove homepage current state on home button			 
		 
			 $('#access ul li.current_page_item').removeClass('current_page_item');


		
	}); // STOP JQUERY	

