 jQuery(function() {

jQuery('#mycarousel').jcarousel({
                scroll: 1,
                animation: 'slow',
        wrap: 'both',
                visible: 4
       // initCallback: mycarousel_initCallback
    }); 

var tab = "#overview";
jQuery("#calclink").click(function(){
		if(tab== "#calclink"){
		} else{
			jQuery("#tabbed").css("background-image","url(/dev/wp-content/themes/spinnaker/custom/images/tabbg-alt.gif)");

		jQuery('#calc').fadeIn('fast');	
		jQuery('#overview').hide();						  
		tab = "#calclink";						   
		}
		});	

jQuery("#overviewlink").click(function(){
		if(tab== "#overviewlink"){
		} else{
		jQuery('#calc').hide();	
		jQuery('#overview').fadeIn('fast');	
		jQuery("#tabbed").css("background-image","url(/dev/wp-content/themes/spinnaker/custom/images/tabbg.jpg)");
		tab = "#overview";						   
		}
		});	

jQuery("#showschools").click(function(){
	
		jQuery('#tabs-1').slideToggle();	
					   

		});	

jQuery("#email").click(function(){
	
		//jQuery('#tabs-1').slideToggle();	
					   

		});	


jQuery("a.fancybox").live('click', function(event){	
		//alert('clicked');
		jQuery(this).fancybox({ 
			'overlayShow':	true,	
			'overlayOpacity': 0.9, 
			'overlayColor': '#000',				  			  				  
			'titleShow' : true,
			'titlePosition' :'over',
			'centerOnScroll': false,
			'scrolling':false,
			'hideOnContentClick': false
					
			});
		event.stopPropagation();
		

		jQuery(this).click();
		//imgcycle();
	return false;
	});


	

jQuery( document ).ready( function(jQuery) {
	var navTimers = [];
	jQuery( "#logo2" ).hover(
		function () {
			var id = jQuery.data( this );
			var jQuerythis = jQuery( this );
			navTimers[id] = setTimeout( function() {
				//jQuerythis.children( '.tooltip' ).fadeIn( 300 );
				jQuery( '.tooltip' ).fadeIn( 300 );
				navTimers[id] = "";
			}, 300 );
		},
		function () {
			var id = jQuery.data( this );
			if ( navTimers[id] != "" ) {
				clearTimeout( navTimers[id] );
			} else {
				//jQuery( this ).children( ".tooltip" ).fadeOut( 200 );
				jQuery( '.tooltip' ).fadeOut( 300 );		
				}
		}
	);
});

	});  
 
 function showPic (whichpic) {

 if (document.getElementById) {

  document.getElementById('gallery-main')
  .src = whichpic.href;
  document.getElementById('gallery-main-href')
  .href = whichpic.name;

  return false;
 } else {
  return true;
 }
}

	function galleryCycle(){
		jQuery('#gallery-main-img').cycle({
		fx:     'fade', 
		timeout: 5000, 
		pause:   1,
		pager:  '#mycarousel',
		pagerAnchorBuilder: function(idx, slide) {
			return '#mycarousel li:eq(' + idx + ') a';
		}	
		//after:   onAfter,
		//prev:  '.jcarousel-prev-horizontal',
		//next:  '.jcarousel-next-horizontal'
	});
	}
	
	
		function loadGalleryContent(post){
		jQuery('#gallery-main-img').load('/dev/gallery/?postage='+post, function(){	
	
																 
				jQuery('#gallery-main-img').fadeIn(300,function(){
					galleryCycle();	
				});	
	
				});
	}	