// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
//
// NOTE THAT WE ARE USING jQUERY HERE! (not script.aculo.us, which is horrible)
$(document).ready(function() {
	highlight_menu();
	var rotate_true = $("#rotator_true").attr("id");
	if(rotate_true == "rotator_true") {
		rotate_camps();	
	}
	coaches_expand();
});
function highlight_menu() {
	var target_menu = $("#highlight_target").attr("class");
	$("#main_menu li."+target_menu+" a").addClass("highlighted");
}
function rotate_camps() {
	$('#camps_banner').cycle({ 
    fx:    'scrollUp', 
	timeout:       7000,  // milliseconds between slide transitions (0 to disable auto advance) 
    continuous:    0,     // true to start next transition immediately after current one completes 
    speed:         1200,  // speed of the transition (any valid fx speed value) 
    speedIn:       0,  // speed of the 'in' transition 
    speedOut:      0,  // speed of the 'out' transition 
    next:          null,  // id of element to use as click trigger for next slide 
    prev:          null,  // id of element to use as click trigger for previous slide 
    prevNextClick: null,  // callback fn for prev/next clicks:  function(isNext, zeroBasedSlideIndex, slideElement) 
    pager:         null,  // id of element to use as pager container 
    pagerClick:    null,  // callback fn for pager clicks:  function(zeroBasedSlideIndex, slideElement) 
    pagerEvent:   'click', // event which drives the pager navigation 
    pagerAnchorBuilder: null, // callback fn for building anchor links 
    before:        null,  // transition callback (scope set to element to be shown) 
    after:         null,  // transition callback (scope set to element that was shown) 
    end:           null,  // callback invoked when the slideshow terminates (use with autostop or nowrap options) 
    easing:        null,  // easing method for both in and out transitions 
    easeIn:        null,  // easing for "in" transition 
    easeOut:       null,  // easing for "out" transition 
    shuffle:       null,  // coords for shuffle animation, ex: { top:15, left: 200 } 
    animIn:        null,  // properties that define how the slide animates in 
    animOut:       null,  // properties that define how the slide animates out 
    cssBefore:     null,  // properties that define the initial state of the slide before transitioning in 
    cssAfter:      null,  // properties that defined the state of the slide after transitioning out 
    fxFn:          null,  // function used to control the transition 
    height:       '140', // container height 
    startingSlide: 0,     // zero-based index of the first slide to be displayed 
    sync:          1,     // true if in/out transitions should occur simultaneously 
    random:        0,     // true for random, false for sequence (not applicable to shuffle fx) 
    fit:           0,     // force slides to fit container 
    pause:         1,   // true to enable "pause on hover"
	delay:         1000     // additional delay (in ms) for first transition (hint: can be negative) 
 });
}
function coaches_expand() {
	$("a.read_more").click(function(){
		clicked_item = $(this).attr("id");										 
		target_ul = clicked_item + "_target";
		current_text = $(this).text();
		current_status = $("#"+target_ul).css("display");
		if(current_status == "none") {
			current_text = current_text.replace(/\+/, "-");
			current_text = current_text.replace(/More/, "Less");
			$("#"+target_ul).fadeIn("normal");
		} else {
			current_text = current_text.replace(/-/, "+");
			current_text = current_text.replace(/Less/, "More");
			$("#"+target_ul).hide();
		}
		$(this).text(current_text);
		return false;	
	});
}

