﻿/// <reference path="jquery-vsdoc2.js"/>

$(document).ready(function() {
    $(document).pngFix();

    $("#adminProjectPhotos a").hover(
      function() {
          var theID = $(this).attr("ImageID");
          $(this).append("<ul class=adminPhotoOptions><li><a href=primaryphoto.aspx?photoID=" + theID + ">Make Default Thumbnail</a></li><li><a href=deletephoto.aspx?photoID=" + theID + ">Delete Photo</a></li></ul>");
          $(this).find("img").css("border-color", "#FF0000");
      },
      function() {
          $(this).find("ul").remove();
          $(this).blur();
          $(this).find("img").css("border-color", "#000");
      }
    );

    $("#photoThumbs img").click(function() {
        var newSrc = $(this).attr("src").replace("_th", "_m");

        //$(".displayPhoto").attr("src", newSrc);
        $("#displayedPhoto img").attr("src", newSrc);

        $("#dPhotoTitle").html($(this).attr("alt"));
        $("#dPhotoDesc").html($(this).attr("title"));
    });

    $("ul#newsTickerList").ticker("init", {
        delay: 10000, 	// Delay between switching of elements
        speed: 500, 		// Animation speed
        linked: true, 	// If stepping after last element will go to first or stop and stepping before first will goto last or stop
        selection: 'li', // The sub-selection to use for each element
        animations: {
            _in: 'fadeIn', // Animation used to fade in
            out: 'fadeOut'	// Animation used to fade out
        },
        callbacks: {
            _in: function(ul) {
                // Current (active) element is in ul.ticker.current
                // Called when the fade in animation starts
            },
            out: function(ul) {
                // Current (active) element is in ul.ticker.current
                // Called when the fade out animations tarts
            },
            init: function(ul) {
                // Current (active) element is in ul.ticker.current
                // Called when ticker is initialized
            }
        }
        // This call enables looping for this ticker, without it start/stop doesn't do anything and it wont loop
    }).ticker("loop")

    $("ul#newsTickerList").show();

    $(".displayPhoto").click(function() {
        window.location = $(this).attr("src").replace('_m','_l');
    });
});