if (!window.ICIQ)
    window.ICIQ = {};

ICIQ.Scene = function() 
{
}

var iciqApp;

function scrollNotify()
{
    if (iciqApp)
        iciqApp.repositionDynamicPanels();
}

function clientResize()
{
    if (iciqApp)
        iciqApp.repositionDynamicPanels();
}

ICIQ.Scene.prototype =
{
    handleLoad: function(plugIn, userContext, rootElement) 
    {
        iciqApp = this;
        
        document.body.rightMargin = "0";
        document.body.leftMargin = "0";
        document.body.topMargin = "0";
        document.body.bottomMargin = "0";
        
        // set the initial visibility of elements
        rootElement.findName("_00").opacity = 1;
        this.introPanel = rootElement.findName("IntroPanel");
        this.introPanel.visibility = "Visible";
        this.introPanelBackground = rootElement.findName("IntroPanelBackground");
        this.statsPanel = rootElement.findName("StatsPanel");
        this.statsPanel.opacity = 0;
        this.scaleStats = rootElement.findName("ScaleStats");
        this.resultsPanel = rootElement.findName("ResultsPanel");
        this.resultsPanel.opacity = 0;
        this.resultsPanel.visibility = "Collapsed";
        this.image = rootElement.findName("image");
        this.image.opacity = 0.1;
        for (i = 0; i<=30; i++)
        {
            var prefix = (i < 10 ? "0" : "") + i.toString();
            var element = rootElement.findName("Root_" + prefix);
            if (element) element.opacity = 0;
            element = rootElement.findName("Description_" + prefix);
            if (element) element.opacity = 0;
        }

        // set the initial positions of dynamically located panels
        this.repositionDynamicPanels();
        
        // set global variables for handling scroll changes
        this.statsPanelStoryboard = rootElement.findName("statsPanelStoryboard");
        this.statsPanelAnimationX = rootElement.findName("statsPanelAnimationX");
        this.statsPanelAnimationY = rootElement.findName("statsPanelAnimationY");
        
        // set time offsets for revealing answers
        this.initializeRevealTimeOffsets();

        // cache references to rootElement and plugIn
        window.scene = this;
        this.plugIn = plugIn;
        this.rootElement = rootElement;

        // initialize the ItemsControl counters
        this.icCount = 0;
        this.iciq = 0;
        this.userCount = rootElement.findName("UserCount");
        this.cloneCount = rootElement.findName("CloneCount");
        this.actualCount = rootElement.findName("ActualCount");
        this.iciqScore = rootElement.findName("iciqScore");
        this.iciqTitle = rootElement.findName("iciqTitle");
        this.scoring = false;

        // get the overlay panel so that hittesting can be enabled and disabled
        this.overlayPanel = rootElement.findName("OverlayPanel");
        
        // get the tooltip storyboards
        this.showToolTipStoryboard = rootElement.findName("showToolTip");
        this.hideToolTipStoryboard = rootElement.findName("hideToolTip");
        this.showToolTipAnimation = rootElement.findName("showToolTipAnimation");
        this.hideToolTipAnimation = rootElement.findName("hideToolTipAnimation");

        // get the media player
        this.tick = rootElement.findName("tick");
        this.flush = rootElement.findName("flush");
        this.yourock = rootElement.findName("yourock");
        this.tick.addEventListener("MediaEnded", Silverlight.createDelegate(this, this.handleDingEnded));

        // get the Score Report members
        this.scoreReport = rootElement.findName("ScoreReport");
        this.scoreReport.Visibility = "Collapsed";
        this.scoreReportBackground = rootElement.findName("ScoreReportBackground");
        this.scoreTitle = rootElement.findName("ScoreTitle");
        this.scoreMessage = rootElement.findName("ScoreMessage");
        this.scoreExplore = rootElement.findName("ScoreExplore");
        
        // hookup handlers for Part A hyperlink
        this.partAHyperlink = rootElement.findName("PartAHyperlink");	
        this.partAHyperlinkLine = rootElement.findName("PartAHyperlinkLine");	
        this.partAHyperlinkLine.Visibility = "Collapsed";
        this.partAHyperlink.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.handlePartAHyperlinkMouseEnter));
        this.partAHyperlink.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.handlePartAHyperlinkMouseLeave));
        this.partAHyperlink.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handlePartAHyperlinkMouseDown));
        this.partAHyperlink.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.handlePartAHyperlinkMouseUp));

        // hookup handlers for ScoreReport button
        this.scoreReportButton = rootElement.findName("ScoreReportButton");	
        this.scoreReportButton.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.handleScoreReportButtonMouseEnter));
        this.scoreReportButton.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleScoreReportButtonMouseDown));
        this.scoreReportButton.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.handleScoreReportButtonMouseUp));
        this.scoreReportButton.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.handleScoreReportButtonMouseLeave));

        // hookup handlers for Begin button
        this.beginButton = rootElement.findName("BeginButton");	
        this.beginButton.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.handleBeginButtonMouseEnter));
        this.beginButton.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleBeginButtonMouseDown));
        this.beginButton.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.handleBeginButtonMouseUp));
        this.beginButton.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.handleBeginButtonMouseLeave));

        // hookup handlers for Score button
        this.scoreButton = rootElement.findName("ScoreButton");	
        this.scoreButton.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.handleScoreButtonMouseEnter));
        this.scoreButton.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleScoreButtonMouseDown));
        this.scoreButton.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.handleScoreButtonMouseUp));
        this.scoreButton.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.handleScoreButtonMouseLeave));

        // hookup handler for Close button
        rootElement.findName("CloseButton").addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.handleCloseButtonMouseUp));
        this.closeCount = 0;

        // hookup handlers for numbers		
        this.hookupToolTips();
        
        // hookup handler for silverlight logo click
        this.silverlightLogo = rootElement.findName("IridescentText");
        this.silverlightLogo.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleSilverlightLogoMouseDown));
    },
    
    repositionDynamicPanels: function()
    {
        var scale = 1;
        if (this.scaleStats)
        {
            scale = (document.body.clientWidth + 10) / 1000;
            scale = Math.min(1, Math.max(0.5, scale));
            this.scaleStats.ScaleX = scale;
            this.scaleStats.ScaleY = scale;
        }

        if (this.statsPanelStoryboard)
        { 
            this.statsPanelAnimationX.To = Math.min(1000 - this.statsPanel.Width * scale, Math.max(document.body.scrollLeft, 0));
            this.statsPanelAnimationY.To = Math.max(document.body.scrollTop - 10, 0);
            this.statsPanelStoryboard.begin();
        }
            
        if (this.introPanel)
        {
            this.introPanel["Canvas.Left"] = Math.max(0,(Math.min(1000, document.body.clientWidth) - this.introPanelBackground.Width) / 2) + document.body.scrollLeft;
            this.introPanel["Canvas.Top"] = Math.max(0,(Math.min(765, document.body.clientHeight) - this.introPanelBackground.Height) / 2) + document.body.scrollTop;
        }
        
        if (this.scoreReport)
        {
            this.scoreReport["Canvas.Left"] = Math.max(0,(Math.min(1000, document.body.clientWidth) - this.scoreReportBackground.Width) / 2) + document.body.scrollLeft;
            this.scoreReport["Canvas.Top"] = Math.max(0,(Math.min(765, document.body.clientHeight) - this.scoreReportBackground.Height) / 2) + document.body.scrollTop;
        }
    },

    handlePartAHyperlinkMouseEnter: function(sender, args)
    {
        this.partAHyperlink.Foreground = "#FF0000";  
        this.partAHyperlinkLine.Visibility = "Visible";  
        this.partAHyperlinkLine.Stroke = "#FF0000";  
    },

    handlePartAHyperlinkMouseLeave: function(sender, args)
    { 
        this.partAHyperlink.Foreground = "#0000CC"; 
        this.partAHyperlinkLine.Visibility = "Collapsed";  
        this.partAHyperlinkLine.Stroke = "#0000CC";   
    },

    handlePartAHyperlinkMouseDown: function(sender, args)
    { 
        this.partAHyperlink.Foreground = "#0000FF";  
        this.partAHyperlinkLine.Stroke = "#0000FF";  
        window.open("http://drwpf.com/blog/Home/tabid/36/EntryID/13/Default.aspx");
    },

    handlePartAHyperlinkMouseUp: function(sender, args)
    { 
        this.partAHyperlink.Foreground = "#FF0000";  
        this.partAHyperlinkLine.Stroke = "#FF0000";   
    },

    handleSilverlightLogoMouseDown: function(sender, eventArgs)
    {
        window.location = "http://www.microsoft.com/silverlight";
    },
    
    handleBeginButtonMouseEnter: function(sender, eventArgs) 
    {
        var mouseEnterAnimation = sender.findName("beginButtonMouseEnter");
        mouseEnterAnimation.begin(); 
    },
    
    handleBeginButtonMouseDown: function(sender, eventArgs) 
    {
        var mouseDownAnimation = sender.findName("beginButtonMouseDown");
        mouseDownAnimation.begin(); 
    },
    
    handleBeginButtonMouseUp: function(sender, eventArgs) 
    {
        this.introPanel.IsHitTestVisible = false;
        
        var mouseUpAnimation = sender.findName("beginButtonMouseUp");
        mouseUpAnimation.begin(); 
        
        // fade in the image
        var fadeInStoryboard = this.rootElement.findName("fadeIn");
        fadeInStoryboard.addEventListener("Completed", Silverlight.createDelegate(this, this.handleFadeInCompleted));
        fadeInStoryboard.begin();
        
        // make the stats panel hittestable
        this.statsPanel.IsHitTestVisible = true;
        this.rootElement.findName("CloseButton").IsHitTestVisible = true;

        // turn up the volume on the tick sound
        this.tick.volume = 1.0;

        // make the image hittestable and hookup LeftButtonUp handler
        this.imageLeftButtonUpHandler = this.image.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.handleImageLeftButtonUp));
    },
    
    handleBeginButtonMouseLeave: function(sender, eventArgs) 
    {
        var mouseLeaveAnimation = sender.findName("beginButtonMouseLeave");
        mouseLeaveAnimation.begin(); 
    },
    
    handleScoreReportButtonMouseEnter: function(sender, eventArgs) 
    {
        var mouseEnterAnimation = sender.findName("scoreReportButtonMouseEnter");
        mouseEnterAnimation.begin(); 
    },
    
    handleScoreReportButtonMouseDown: function(sender, eventArgs) 
    {
        var mouseDownAnimation = sender.findName("scoreReportButtonMouseDown");
        mouseDownAnimation.begin(); 
    },
    
    handleScoreReportButtonMouseUp: function(sender, eventArgs) 
    {
        var mouseUpAnimation = sender.findName("scoreReportButtonMouseUp");
        mouseUpAnimation.begin(); 
        
        this.scoreReport.Visibility = "Collapsed";
    },
    
    handleScoreReportButtonMouseLeave: function(sender, eventArgs) 
    {
        var mouseLeaveAnimation = sender.findName("scoreReportButtonMouseLeave");
        mouseLeaveAnimation.begin(); 
    },
    
    handleCloseButtonMouseUp: function(sender, eventArgs) 
    {
        switch (++this.closeCount)
        {
            case 1: 
                alert("Ummm...  You know you just clicked an *image* of a Close button, right?");
                break;
            case 2: 
                alert("Seriously.  It's just an image.");
                break;
            case 3: 
                alert("You're kinda new to this whole web thing, aren't you?  It's not a real Close button!");
                break;
            case 4: 
                alert("I'm just not sure what you want me to close...  the current tab?  the browser?  Maybe you'd like me to shut down the entire web for you!");
                break;
            case 5: 
                alert("You've really got to stop that now.  I *won't* tell you again.");
                break;
            case 6:
                this.flushItAway();
                break;
        }
    },
    
    handleFadeInCompleted: function (sender, eventArgs)
    {
        this.image.IsHitTestVisible = true;
        var introPanel = this.rootElement.findName("IntroPanel");
        introPanel.Visibility = "Collapsed";
        introPanel.IsHitTestVisible = false;
    },
    
    handleImageLeftButtonUp: function(sender, eventArgs) 
    {
        if (eventArgs.shift)
            this.decrementICCount(sender);
        else
            this.incrementICCount(sender);
    },
    
    handleDingEnded: function(sender, eventArgs) 
    {
        this.tick.stop();
    },
    
    incrementICCount: function(sender)
    {
        this.icCount = this.icCount + 1;
        this.updateCountText();
    },
    
    decrementICCount: function(sender)
    {
        if (this.icCount > 0)
        {
            this.icCount = this.icCount - 1;
            this.updateCountText();
        }
    },
    
    updateCountText: function()
    {
        this.tick.stop();
        if (this.tick.source)
            this.tick.play();
        this.userCount.Text = this.icCount.toString();
    },
    
    handleScoreButtonMouseEnter: function(sender, eventArgs) 
    {
        var mouseEnterAnimation = sender.findName("scoreButtonMouseEnter");
        mouseEnterAnimation.begin(); 
    },
    
    handleScoreButtonMouseDown: function(sender, eventArgs) 
    {
        var mouseDownAnimation = sender.findName("scoreButtonMouseDown");
        mouseDownAnimation.begin(); 
    },
    
    handleScoreButtonMouseUp: function(sender, eventArgs) 
    {
        var mouseUpAnimation = sender.findName("scoreButtonMouseUp");
        mouseUpAnimation.begin(); 

        if (this.icCount <= 0)
        {
            alert("You didn't read the instructions, did you?  You're supposed to click the image once for each ItemsControl you see.");
            return;
        }
        // avoid re-entrancy
        if (!this.scoring)
        {
            this.scoring = true;
            this.prepareToScoreTest();
        }
    },
    
    handleScoreButtonMouseLeave: function(sender, eventArgs) 
    {
        var mouseLeaveAnimation = sender.findName("scoreButtonMouseLeave");
        mouseLeaveAnimation.begin(); 
    },
    
    prepareToScoreTest: function()
    {
        this.iciqScore.Text = "0";
        this.iciqTitle.Text = "";
        this.actualCount.Text = "0";
        this.scoreReport.Visibility = "Collapsed";

        // make sure the image is not hittestable anymore and remove LeftButtonUp handler
        this.image.IsHitTestVisible = false;
        this.image.removeEventListener("MouseLeftButtonUp", this.imageLeftButtonUpHandler);
        this.overlayPanel.IsHitTestVisible = false;

        // clone score
        this.cloneCount.Text = this.userCount.Text;
        this.cloneCount.foreground = "#FF000000";
        this.cloneCount.Visibility = "Visible";
        
        // if necessary, fade out click tips and fade in results panel
        var instructionsText = this.rootElement.findName("_00");
        if (instructionsText.opacity == 1.0)
        {
            instructionsText.IsHitTestVisible = false;
            this.showToolTipStoryboard.stop();
            this.hideToolTipStoryboard.stop();
            this.rootElement.findName("Description_00").opacity = 0;
            this.resultsPanel.visibility = "Visible";
            this.rootElement.findName("revealResultsPanel").begin();
        }

        // stop storyboard from earlier scoring pass
        this.rootElement.findName("revealAnswers").stop();

        // clone user's score
        var cloneUserCountStoryboard = this.rootElement.findName("cloneUserCount");
        cloneUserCountStoryboard.stop();
        this.cloneUserCountCompletedHandler = cloneUserCountStoryboard.addEventListener("Completed", Silverlight.createDelegate(this, this.handlePrepareToScoreTestCompleted));
        cloneUserCountStoryboard.begin();
    },
    
    handlePrepareToScoreTestCompleted: function(sender, eventArgs)
    {
        sender.removeEventListener("Completed", this.cloneUserCountCompletedHandler);
        this.rootElement.findName("_00").opacity = 0;
        this.rootElement.findName("ResultsPanel").opacity = 1;
        this.revealAnswers();
    },
    
    revealAnswers: function()
    {
        this.iciq = 0;
        this.userGuess = this.icCount;
        this.controlsCounted = 0;
        
        // begin the ShowItemsControlInstances storyboard
        var revealAnswersStoryboard = this.rootElement.findName("revealAnswers");
        this.revealAnswersCompletedHandler = revealAnswersStoryboard.addEventListener("Completed", Silverlight.createDelegate(this, this.handleRevealAnswersCompleted));
        revealAnswersStoryboard.begin();

        // begin the timer
        var timerStoryboard = this.rootElement.findName("timer");
        this.stopTimer = false;
        this.startTime = (new Date()).getTime();
        this.nextEventTime = this.getNextEventTime();
        this.timerTickHandler = timerStoryboard.addEventListener("Completed", Silverlight.createDelegate(this, this.handleTimerTick));
        timerStoryboard.begin();
    },
    
    handleRevealAnswersCompleted: function(sender, eventArgs)
    {
        sender.removeEventListener("Completed", this.revealAnswersCompletedHandler);
        this.cloneCount.Visibility = "Collapsed";
        this.rootElement.findName("cloneUserCount").stop();
        var scoreText = this.rootElement.findName("ScoreText");
        scoreText.Text = "Rescore";
        scoreText["Canvas.Left"] = 21;
        this.scoring = false;
        this.overlayPanel.IsHitTestVisible = true;
        
        // give score report
        var msg = "Your ICIQ is " + this.iciq.toString();
        if (this.iciq <= 50)
        {
            this.iciqTitle.Text = "\"Dunce\"";
            this.iciqTitle["Canvas.Left"] = 476;
            this.scoreTitle.Text = "\"ItemsControl Dunce\"";
            this.scoreTitle["Canvas.Left"] = 79;
            this.scoreExplore["Canvas.Top"] = 175;
            msg = msg + ".  But that's okay... not everyone is meant to work in the software industry.";
        }
        else if (this.iciq <= 100)
        {
            this.iciqTitle.Text = "\"Newbie\"";
            this.iciqTitle["Canvas.Left"] = 474;
            this.scoreTitle.Text = "\"ItemsControl Newbie\"";
            this.scoreTitle["Canvas.Left"] = 71;
            this.scoreExplore["Canvas.Top"] = 197;
            msg = msg + ".  Clearly you recognize the major categories of ItemsControls.  You may want to review MenuItem and TreeViewItem.";
        }
        else if (this.iciq <= 200)
        {
            this.iciqTitle.Text = "\"Professional\"";
            this.iciqTitle["Canvas.Left"] = 443;
            this.scoreTitle.Text = "\"ItemsControl Professional\"";
            this.scoreTitle["Canvas.Left"] = 33;
            this.scoreExplore["Canvas.Top"] = 197;
            msg = msg + "!  That's great!  You found all of the big ones.  So what tripped you up?  Was it those  *&!@#  TreeViewItems?";
        }
        else if (this.iciq <= 270)
        {
            this.iciqTitle.Text = "\"Genius\"";
            this.iciqTitle["Canvas.Left"] = 474;
            this.scoreTitle.Text = "\"ItemsControl Genius\"";
            this.scoreTitle["Canvas.Left"] = 71;
            this.scoreExplore["Canvas.Top"] = 175;
            msg = msg + "!  Wow!  You've definitely got a future in Windows software development!";
        }
        else
        {
            this.iciqTitle.Text = "\"Guru\"";
            this.iciqTitle["Canvas.Left"] = 481;
            this.scoreTitle.Text = "\"ItemsControl Guru\"";
            this.scoreTitle["Canvas.Left"] = 88;
            this.scoreExplore["Canvas.Top"] = 197;
            msg = msg + "!  Holy Shnikees!  Do people whisper a lot (and sometimes kneel) in your presence?";
        }
        this.scoreMessage.Text = msg;
        
        this.repositionDynamicPanels();
        this.scoreReport.Visibility = "Visible";

        // perfect score gets a sound bite
        if (this.iciq == 300)
            this.yourock.play();
    },
    
    handleTimerTick: function(sender, eventArgs)
    {
        if (this.stopTimer)
        {
            sender.removeEventListener("Completed", this.timerTickHandler);
        }
        else
        {
            if ((new Date()).getTime() > this.nextEventTime)
            {
                this.nextEventTime = this.getNextEventTime();
                this.updateScore();
            }
            sender.begin();
        }
    },

    updateScore: function()
    {
        this.controlsCounted = this.controlsCounted + 1;

        // play tick
        if (this.tick.source && this.controlsCounted <= 30)
            this.tick.play();
            
        // update score variables
        if (this.controlsCounted > 30 && this.userGuess > 0)
        {
            this.iciq = this.iciq - 10;
        }
        else if (this.userGuess > 0)
        {
            this.iciq = this.iciq + 10;
        }
        this.userGuess = this.userGuess - 1;
        
        // update TextBlocks
        this.cloneCount.Text = this.userGuess.toString();
        if (this.userGuess < 0)
        {
            this.cloneCount.foreground = "#FFFF0000";
        }
        this.iciqScore.Text = this.iciq.toString();
        if (this.controlsCounted <= 30)
            this.actualCount.Text = this.controlsCounted.toString();
    },

    getNextEventTime: function()
    {
        var currentTime = (new Date()).getTime();
        var delta = currentTime - this.startTime;

        for (i = 1; i<=30; i++)
        {
            var offset = this["offset_" + (i < 10 ? "0" : "") + i.toString()];
            if (offset && delta < offset)
            {
                return this.startTime + offset;
            }
        }
        
        // if the user overbid, return current time plus 500 milliseconds
        if (this.userGuess > 0)
        {
            return currentTime + 500;
        }

        // if we made it this far, we're done
        this.stopTimer = true;
        return currentTime + 50000;
    },
    
    hookupToolTips: function()
    {
        for (i = 0; i<=30; i++)
        {
            var number = this.rootElement.findName("_" + (i < 10 ? "0" : "") + i.toString());
            if (number)
            {
                number.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.handleNumberMouseEnter));
                number.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.handleNumberMouseLeave));
            }
        }
    },

    handleNumberMouseEnter: function(sender, eventArgs) 
    {
        this.showToolTipStoryboard.stop();
        this.showToolTipAnimation["Storyboard.TargetName"] = this.getToolTipTargetName(sender.Name);
        this.showToolTipStoryboard.begin();
    },

    handleNumberMouseLeave: function(sender, eventArgs) 
    {
        this.hideToolTipStoryboard.stop();
        this.hideToolTipAnimation["Storyboard.TargetName"] = this.getToolTipTargetName(sender.Name);
        this.hideToolTipStoryboard.begin();
    },
    
    getToolTipTargetName: function(senderName) 
    {
        if (senderName == "_13")
            return "Description_10";
        else if (senderName == "_17")
            return "Description_14";
        else if (senderName == "_30")
            return "Description_18";
        else
            return "Description" + senderName;
    },
    
    initializeRevealTimeOffsets: function()
    {
        this.offset_01 =   300;
        this.offset_02 =  1800;
        this.offset_03 =  3300;
        this.offset_04 =  5800;
        this.offset_05 =  8300;
        this.offset_06 = 10800;
        this.offset_07 = 13300;
        this.offset_08 = 15800;
        this.offset_09 = 18300;
        this.offset_10 = 20800;
        this.offset_11 = 21300;
        this.offset_12 = 21800;
        this.offset_13 = 22300;
        this.offset_14 = 24800;
        this.offset_15 = 25300;
        this.offset_16 = 25800;
        this.offset_17 = 26300;
        this.offset_18 = 28800;
        this.offset_19 = 29300;
        this.offset_20 = 29800;
        this.offset_21 = 30300;
        this.offset_22 = 30800;
        this.offset_23 = 31300;
        this.offset_24 = 31800;
        this.offset_25 = 32300;
        this.offset_26 = 32800;
        this.offset_27 = 33300;
        this.offset_28 = 33800;
        this.offset_29 = 34300;
        this.offset_30 = 34800;
    },
    
    flushItAway: function()
    {
        this.stopTimer = true;
        this.plugIn["width"] = "100%";
        this.plugIn["height"] = "100%";
        this.flush.volume = 1.0;
        this.flush.play();
        this.rootElement.findName("iridescentAnimation").begin();
        this.rootElement.findName("flushAnimation").begin();
        this.silverlightLogo.IsHitTestVisible = true;
    },
    
    lastFunction: function()
    {
    }
}
