﻿/// <reference name="MicrosoftAjax.js"/>

Type.registerNamespace("BreedersAssistant.Controls.PhotoGallery");

BreedersAssistant.Controls.PhotoGallery = function(element) {
    BreedersAssistant.Controls.PhotoGallery.initializeBase(this, [element]);
    this._photoContainerId = null;
    this._containerId = null;
}

BreedersAssistant.Controls.PhotoGallery.prototype = {
    initialize: function() {
    BreedersAssistant.Controls.PhotoGallery.callBaseMethod(this, 'initialize');

        $('#' +this._containerId + ' ul li a').click(function() {
            var img = $(this).find('img:first');

            var newImg = new Image();
            $(newImg).hide();
            $(newImg).attr('src', $(img).attr('src'));
            $(newImg).attr('alt', $(img).attr('alt'));
            $(this).parent().parent().parent().find("div:first").empty().append($(newImg));
            
            $(newImg).fadeIn('slow');
            $(newImg).removeAttr('style');
            return false;
        }).filter(":first").click();
    
    },
    dispose: function() {
        //Add custom dispose actions here
        $clearHandlers(this.get_element());
        BreedersAssistant.Controls.PhotoGallery.callBaseMethod(this, 'dispose');
    },
    get_photoContainerId: function() {
        return this._photoContainerId;
    },
    set_photoContainerId: function(value) {
        if (this._photoContainerId != value) {
            this._photoContainerId = value;
        }
    },
    get_containerId: function() {
        return this._containerId;
    },
    set_containerId: function(value) {
        if (this._containerId != value) {
            this._containerId = value;
        }
    }
   
}
BreedersAssistant.Controls.PhotoGallery.registerClass('BreedersAssistant.Controls.PhotoGallery', Sys.UI.Control);

if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();