DotNetNukeŽ Silverlight Album

// (C) 2007 Jeff Paries
// http://designwithsilverlight.com
 
if (!window.photoGallery)
    window.photoGallery = {};
 
photoGallery.Page = function() 
{
}
 
photoGallery.Page.prototype =
{
    handleLoad: function(control, userContext, rootElement) 
    {
        this.control = control;
        intUserContext = userContext;
        
        // Sample event hookup:    
        rootElement.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleMouseDown));
    },
    
    // Sample event handler
    handleMouseDown: function(sender, eventArgs) 
    {
        // The following line of code shows how to find an element by name and call a method on it.
        // this.control.content.findName("Timeline1").Begin();
    }
}
 
var zoomFlag = 0;
 
function loadImages(sender,args){
 
var plugin = sender.getHost();
var module_id = plugin.id;
var photoArray = eval('photoArray' + module_id);
  
    // change the background color for the images
    // being used to white
    for (var i=0; i < photoArray.length; i++) {
        if (photoArray[i] != "") {
            nameString = "photo" + i;
            sender.findName(nameString).Opacity = 1;
            sender.findName(nameString).Visibility = "Visible";
        }
    }
 
    // load the images from the array into
    // the gallery canvases
    for (var i=0; i<photoArray.length; i++) {
        nameString = "image" + i;
        sender.findName(nameString).Source = photoArray[i];
    }    
}
 
function mouseEnter(sender, args) {
 
var plugin = sender.getHost();
var module_id = plugin.id;
var photoArray = eval('photoArray' + module_id);
 
    // zero out the z-index for any photos being displayed
    for (var i=0; i<photoArray.length; i++) {
        nameString = "photo" + i;
        sender.findname(nameString)["canvas.ZIndex"] = 0;
    }    
    
    // play the mouse enter storyboard for the selected image
    photoPosition = sender.name.charAt(5) + sender.name.charAt(6);
    nameString = "mouseEnter" + photoPosition;
    sender.findName(nameString).begin();
}
 
function mouseLeave(sender, args) {
    photoPosition = sender.name.charAt(5) + sender.name.charAt(6);
 
    // if the image has already been clicked, first, zoom back out
    // then play the mouse out action. Otherwise (the image has not
    // yet been clicked, so just play the mouse out action
    if (zoomFlag == 1) {
        nameString = "pictureZoomOut" + photoPosition;
        sender.findName(nameString).begin();
        nameString = "mouseLeave" + photoPosition;
        sender.findName(nameString).begin();
        zoomFlag = 0;
    }
    else {
        nameString = "mouseLeave" + photoPosition;
        sender.findName(nameString).begin();
    }
}
 
function pictureZoomIn(sender, args) {
    photoPosition = sender.name.charAt(5) + sender.name.charAt(6);
    
    // if the photo is already zoomed in (clicked), then play the
    // zoom out storyboard, otherwise, the picture has not
    // been zoomed in (clicked) and should be.
    if (zoomFlag == 1) {
        nameString = "pictureZoomOut" + photoPosition;
        sender.findName(nameString).begin();
        zoomFlag = 0;
    }
 
    else {
        nameString = "pictureZoomIn" + photoPosition;    
        sender.findName(nameString).begin();
        sender["canvas.ZIndex"] = 1;
        zoomFlag = 1;
    }
}