$(document).ready(function() {
    if ($("div#ticker").length) {
        CreateTicker();
    }

$("div#community-list ul ul").hide();
if($("body[class*='for-coaches']").length)
{
	$("div#community-list ul ul").hide();
	$("div#community-list ul ul:eq(0)").show();
}	
	
if($("body[class*='for-parents']").length)
{
	$("div#community-list ul ul").hide();
	$("div#community-list ul ul:eq(1)").show();
}

if($("body[class*='sponsors']").length)
{
	$("div#community-list ul ul").hide();
	$("div#community-list ul ul:eq(2)").show();
}

if($("body[class*='feedback']").length)
{
	$("div#community-list ul ul").hide();
	$("div#community-list ul ul:eq(3)").show();
}

if($("body[class*='jobs']").length)
{
	$("div#community-list ul ul").hide();
	$("div#community-list ul ul:eq(4)").show();
}

});


function InitAdScroller()
{
$(".auto .jCarouselLite").jCarouselLite({
    auto: 800,
    speed: 1000,
visible: 4
});
	
}

var dontAnimate = false;

function HandleCommunitySideBar() {
    $("div#community-list ul ul").hide();
    dontAnimate = true;
    //$("div#community-list a img").click(function() { return false; });

    $("div#community-list ul li.level-1").hover(function() {
        if (!dontAnimate) {
            $(this).find("ul").slideDown('fast');
            dontAnimate = true;
        }
    }, function() {
    $(this).find("ul").slideUp('fast', function() { dontAnimate = false});

    });
}
/*
function HandleCommunitySideBar() {
    $("div#community-list ul ul").hide();
    $("div#community-list a img").click(function() {

    if ($(this).parent().next("ul").is(":visible")) {
        $(this).parent().next("ul").slideToggle();
			return false;
        }
        else {
            $("div#community-list ul ul:visible").slideToggle();
            $(this).parent().next("ul").slideToggle();
            return false;
        }
    });
}
*/

function CreateTicker() {
    var flashvars = {};
    flashvars.xmlPath = path;
    var params = {};
    params.wmode = "transparent";
    params.menu = "false";
    params.allowScriptAccess = "always";
    var attributes = {};
    swfobject.embedSWF("/media/130/teamxsport-ticker.swf", "ticker-content", "644", "42", "9.0.0", "false", flashvars, params, attributes);
    swfobject.createCSS("ticker-content", "outline:none");
}
