﻿// JavaScript Document
$("document").ready(function() {
    $("#notifications").live("click", function(event) {
        window.location = "http://marionchristiansoftball.com/notifications/add.aspx"
    })
    if($("#gameResults").html().indexOf('No results to display') < 0)
    {        
       setTimeout(function(){$("#gameResults").ticker(100,true,true)},5000)
    }
    var enableClick = true
    $(".standingsDay").find("div:first").hide();
    $(".standingsDay>div:first").show()
    $(".standingsDay>span>img:first").attr({
        src:"images/arrowDown.png",
        alt:"arrow down"
    })
    $(".standingsDay").live("click", function(event) {
        if(enableClick)
        {
            enableClick = false
            var showDiv = true
            if($(this).children("div:first").is(":visible"))
            {
                showDiv = false         
            }
            $(".standingsDay>div:visible:first").parent().children().find("img").attr({
                    src:"images/arrowRight.png",
                    alt:"arrow right"
            })
            $(".standingsDay>div:visible:first").hide("blind")
            if(showDiv)
            {
                $(this).find("img").attr({
                    src:"images/arrowDown.png",
                    alt:"arrow down"            
                })
                $(this).children("div:first").show("blind")
            }
            var t=setTimeout(function(){enableClick = true},500);
        }
    })
    
    var enableClick2 = true
    $(".upcomingTitle").find("div:first").hide();
    $(".upcomingTitle>div:first").show()
    $(".upcomingTitle>span>img:first").attr({
        src:"images/arrowDown.png",
        alt:"arrow down"
    })
    $(".upcomingTitle").live("click", function(event) {
        if(enableClick2)
        {
            enableClick2 = false
            var showDiv = true
            if($(this).children("div:first").is(":visible"))
            {
                showDiv = false         
            }
            $(".upcomingTitle>div:visible:first").parent().children().find("img").attr({
                    src:"images/arrowRight.png",
                    alt:"arrow right"
            })
            $(".upcomingTitle>div:visible:first").hide("blind")
            if(showDiv)
            {
                $(this).find("img").attr({
                    src:"images/arrowDown.png",
                    alt:"arrow down"            
                })
                $(this).children("div:first").show("blind")
            }
            var t=setTimeout(function(){enableClick2 = true},500);
        }
    })
})
