﻿

//Globals
var CurrentHightlightIndex = 0;




//
function RootCanvasLoaded(sender)
{


    if( num_Highlights == 0 )
    {
        
        // Reduce plugin size
        sender.getHost().height = 1;

    }
    else
    {

        //
        DisplayCurrentHighlight( sender );


        // Start timer
        sender.findName("timerStoryboard").begin();

    }

}






//
function timerStoryboardFinished( sender, eventArgs )
{

    // Increment current highlight index
    CurrentHightlightIndex++;
    
    if( CurrentHightlightIndex >= num_Highlights )
    {
        CurrentHightlightIndex = 0;
    }


    //
    DisplayCurrentHighlight( sender );


    // Restart timer
    sender.findName("timerStoryboard").begin();

} 




function DisplayCurrentHighlight( sender )
{

    sender.findName( "HightlightTextBlock_Title" ).Text = HighlighstTitleArray[CurrentHightlightIndex];
    sender.findName( "HightlightTextBlock_Dates" ).Text = HighlighstDatesArray[CurrentHightlightIndex];
    

    // Right justify TextBlock
    sender.findName( "HightlightTextBlock" )["Canvas.Left"] = (750 - sender.findName( "HightlightTextBlock" ).ActualWidth);

}




    

function CurrentHighlight_LeftButtonDown(sender, mouseEventArgs)
{

	window.location = "Events.aspx";	

}

