$(function () {
    /*	$(".thumbs img").tooltip({
    track: true,
    delay: 0,
    showURL: false,
    opacity: 1,
    fixPNG: true,
    showBody: " - ",
    top: -80,
    left: -70
    });*/

    // set up tooltips
    $(".thumbs img").tooltip({
        offset: [-4, -4]
    });

    var currentVideoThumb = $(".thumbs img:eq(0)").get(0);

    // image rollovers for video icons
    $(".thumbs img").hover(
		function () {
		    this.src = this.src.replace("_up", "_over");
		},
		 function () {
		     if (currentVideoThumb.src != this.src) {
		         this.src = this.src.replace("_over", "_up");
		     }
		 }
	);

    function selectVideo(num, sender) {
        var flashVideo = $('#flash_video').get(0);
        switch (num) {
            case 0:
                //flashVideo.loadVideo('/videos/Jo_Message_241x181.flv', 'true');
                //flashVideo.loadVideo('/videos/Primrose30_241x181.flv', 'true');
                flashVideo.loadVideoWithOverlay( '/videos/Danceoff_241x181.flv', 'true' );
                break;
            case 1:
                flashVideo.loadVideo('/videos/Jo_Message_241x181.flv', 'true');
                break;
            case 2:
                flashVideo.loadVideo('/videos/Primrose30_241x181.flv', 'true');
                break;
        }

        currentVideoThumb.src = currentVideoThumb.src.replace("_over", "_up");
        currentVideoThumb = sender;

    }

    // swap out video images
    $(".thumbs img:eq(0)").click(function () {
        //change this num back to 1 when family dance goes off
        selectVideo(0, this);
    });

    $(".thumbs img:eq(1)").click(function () {
        //change this num back to 2 when family dance goes off
        selectVideo(1, this);
    })

    $(".thumbs img:eq(2)").click(function () {
        selectVideo(2, this);
    })

    $("#ctl00_FindSchool_Home_locator_list ul.top").treeview({
        collapsed: true,
        unique: true
    });

    $("a.search_locator").click(function () {
        $("div#ctl00_FindSchool_Home_locator_list").toggle();
        if ($("img#arrow").attr("src") == "/images/arrow_right.jpg") {
            $("img#arrow").attr("src", "/images/arrow_down.jpg");

        }
        else {
            $("img#arrow").attr("src", "/images/arrow_right.jpg");

        }
    });

    

});
