$(function($){				

//var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));  == original list including ipad
var mobile = (/iphone|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())); 

	if ($("body.home").size() > 0 && !mobile){
		$('BODY').bgStretcher({
			images: [ 'img/home-slides/wide-aerial.jpg', 'img/home-slides/vibrant-sea-land.jpg', 'img/home-slides/explosion.jpg', 'img/home-slides/beachscape.jpg', 'img/home-slides/cave.jpg'], 
			slideShowSpeed: 1000,
			nextSlideDelay: 6000,
			imageWidth: 960, 
			imageHeight: 601
		});
	}

	if (($("body.faq").size() > 0 || 
		$("body.about").size() > 0 || 
		$("body.movie").size() > 0 || 
		$("body.allocation").size() > 0) && 
		!mobile){
		$('#container').bgStretcher({
			images: [ '/img/bg-statics.jpg' ], 
			imageWidth: 960, 
			imageHeight: 676
		});
	}


// initialize scrollable together with the navigator plugin on gallery page
	if ($("body.gallery").size() > 0){
		$("#browsable").scrollable().navigator();	
		$('div.items a img').click(function() { $('#gallery-main-image img').attr('src', $(this).attr('src').replace('thumbs/','')); return false; });
	}
	
//member dropdown
	if ($('.nav-members').size() >0){
		$('.nav-members').click( function() {
			$('.dropdown').slideToggle('fast');
			return false;
		});			  
	}

//course page
	if ($('.course').size() > 0){
		
		//wireup routing map lightbox
		$('#map').click(function(){
			$('#routing-map').lightbox_me();
			return false;
		});
		$('.close').trigger('close');
		
		$('#hole0').show();
		//grab the href, use that to identify the block to show
		//hide shown blocks, fade in selected block, set selected sidebar link style
		$('.nav-holes a').click( function() {
										
		    $('body').append('<div id="waiter"></div>');
							
			var hole = $(this).attr('href');		
			$('#main').load('holes.aspx ' + hole).fadeIn();
						
			$('.nav-holes a.active').removeClass('active');
			$(this).addClass('active');
			//$('#remove-later').remove();
			//$(this).after('<span id="remove-later"> &nbsp;&nbsp; &lt;</span>');
			
			$('#waiter').remove();
			
			return false;
		});
			
	}


});



