jQuery(function( $ ){

   
    $('#MyProgress .Content .Slider').cycle({
        fx:     'scrollUp',
        speed:  300,
        timeout: 0,
        next:  '#MyProgress .MoreButton'
    }); 
    
    $('#OurVideos .Content .Slider').cycle({
        fx:     'scrollUp',
        speed:  300,
        timeout: 0,
        next:  '#OurVideos .MoreButton'
    }); 
    
   
      $('#Slideshow').cycle({
       fx:     'fade',
       speed:  3000,
       timeout: 1000,
       cssBefore: { zIndex: 1 },
       cssAfter: {  zIndex: 1 },
       pager: '#nav'
  
       });

$('#nav li a').hover( function() { $(this).addClass('thickbox'); }, function() {});
    
    
  jQuery.fn.fadeSliderToggle = function(settings) {
     	 settings = jQuery.extend({
    		speed:200,
    		easing: 'easeOutBack'
    	}, settings)
    	
    	caller = this
     	if($(caller).css("display") == "none"){
 
     		$(caller).animate({
     			opacity: 1,
     			height: 'toggle'
     		}, settings.speed, settings.easing);  		
     		
     		 $(caller).next().css("position","absolute");
     		 $(caller).next().css("left","10000px");
     		 $(caller).next().hide("fast");
     		$(caller).next().fadeTo(0,0);
     	
    	}else{
    		$(caller).animate({
     			opacity: 0,
     			height: 'toggle'
     		}, settings.speed, settings.easing);
     		 window.setTimeout(function(){
     		 $(caller).next().css("position","static");
     		$(caller).next().show("fast");
     		$(caller).next().fadeTo(0,1);
     		}, 220);
     	
    	}
    };
 
$('.FormBox input').focus(function () { $(this).css('background', '#FFFFFF'); });

$('#LoginButton').click( function() { $('.MemberLinks').hide(200);  $('.LoginBox').show(300);  });

$('.Story').click( function() { $('.Link').removeClass("Selected"); $('.Story').addClass("Selected"); $("#VideoBox .BoxContent .Content2").slideUp(200); window.setTimeout(function(){  $("#VideoBox .BoxContent .Content1").css("position","static"); $("#VideoBox .BoxContent .Content1").show(); $("#VideoBox .BoxContent .Content1").fadeTo(100,1); }, 230);  $("#StoryBox .BoxContent .Item DIV").fadeSliderToggle(); } );
$('.Video').click( function() { $('.Link').removeClass("Selected"); $('.Video').addClass("Selected"); $("#StoryBox .BoxContent .Content2").slideUp(200); window.setTimeout(function(){ $("#StoryBox .BoxContent .Content1").css("position","static"); $("#StoryBox .BoxContent .Content1").show(); $("#StoryBox .BoxContent .Content1").fadeTo(100,1); }, 230);  $("#VideoBox .BoxContent .Item DIV").fadeSliderToggle(); } );
$('.Appreciation').click( function() { $('.Link').removeClass("Selected"); $('.Appreciation').addClass("Selected"); $(".BoxContent .Content2").hide(); $(".BoxContent .Content1").css("position","static"); $(".BoxContent .Content1").show(); $(".BoxContent .Content1").fadeTo(100,1); } );
   
	$.easing.elasout = function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	};


    $.easing.easeInBack = function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
		};
		
	 $.easing.easeOutBack = function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},

	/*
	$('#MyProgress .Content').serialScroll({
		items:'div',
		next:'#MyProgress a.MoreButton',
		duration:200,
		force:true,
		axis:'y',
		easing:'linear',
		jump:true,
		step:2 // scroll 2 news each time
	});	
	
	$('#OurVideos .Content').serialScroll({
		items:'div',
		next:'#OurVideos a.MoreButton',
		duration:200,
		force:true,
		axis:'y',
		easing:'linear',
		step:4 // scroll 2 news each time
	});	

*/





	// Reset all scrollable panes to (0,0)
	$(window).scrollTo( );
	$.scrollTo(  );
	

	
	// TOC, shows how to scroll the whole window
	$('#Navigation .Link').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
	    $.scrollTo( this.hash, 1500);
		$(this.hash).find('span.message').text( this.title );
        return false;
	});
	

});


   function gotoURL(link){
       
       window.location = link;
       
       }

