﻿//   handleLoad: function(control, userContext, rootElement) 
//    {
//        this.control = control; 

//        //  Get a reference to your media element (mine is called "MainMovie")          
//        this.movie = control.content.findName("MainMovie");
//        // Add an Event Listener for the "MediaEnded" Event
//       this.movie.addEventListener("MediaEnded", Silverlight.createDelegate(this,this.movieMediaEnded));
//    }, 

//    //When the end of the movie is reached, return the movie to the start and play it again
//    movieMediaEnded: function(sender, eventArgs)
//    {
//        sender.Position = "00:00:00";
//        sender.play();
//    } 

if (!window.EdwardMueschBooks)
	EdwardMueschBooks = {};

EdwardMueschBooks.Page = function() 
{
}

EdwardMueschBooks.Page.prototype =
{
    handleLoad: function(control, userContext,  sender) { // be sure to add these parameters, by default they are not added   


// Insert test code below
//var plugin=sender.getHost();

// Insert test code above

        // We'll collapse the main page to allow the pre-loader to do it's work  
        control.content.findName("innerPage").Visibility ='Collapsed';   
        control.content.findName("innerPage").Opacity = 0;  
         
		this.control = control;
		this.Sender = sender;   // always holds outer Canvas in this method

        this.control.content.onResize = onResizeScale;

        // alert(plugin.id + " : " + userContext + " : " + sender.toString()); 
        
        // doesn;t always fire after page open if resources are low
        onResizeScale(sender, userContext);
        var preloader = new B.Ag1.PreloaderMultifile(sender.getHost()); // pass in the silverlight control  
    },
    getExternalRef: function(){
    // returns the external var (should set this in constructor ???)
        return scene;
    },
    books_Float: function(shortName)
    {
       // we use this on a setTimeout(), so we need the parm
       scene.control.content.findName("books"+shortName+"Float").Begin();
    },
    // called after Downloader object has finished
	handleLoad2: function(control, userContext, rootElement) 
	{

          //makeMovie(rootElement, userContext);
//        var storyBoard = control.gethost().content.CreateFromXaml(xaml, true);
//        this.root.resources.Add(storyBoard);
//        var s = this.root.FindName("mouseEnterRect");
//        s.begin();

		// initialize canvas and anmiations
		this.RATW_Timer;
		this.LOM_Timer;
		this.PBest_Timer;
		this.AfA_Timer;
		this.control.content.findName("innerPage").Visibility = 'Visible';
		this.control.content.findName("PageLight").Begin();
		
		this.control.content.findName("trig_ednHelenFadeIn").begin();
		this.control.content.findName("trig_ednHelenBob").begin();
		this.control.content.findName("trig_pageFadeIn").begin();
        //bannerHoliday_Set(rootElement.GetHost());  // set holiday style

        // Do initial layout of the application based on initial size.
        //updateLayout(this.control.content.actualWidth, this.control.content.actualHeight);
	
        this.isPageFullSize = true;
        this.isbooksPBestFloating = false;
        this.isBooksCopyFloating = false;
        this.isBooksCopyCopyFloating = true;
        this.isBooksCopyCopyCopyFloating = true;
        this.isSmallPicRotatingStarted = false;
        this.isSmallPicRotating = false;

		// video book excerpt
        this.isPlaying = false;
        if(this.isPlaying){
  	        this.control.content.findName("click2Pause_Light_Start").Begin();
	        this.control.content.findName("PersonalBestChap013_wmv_thumb_Dim_2").Begin();
  	    }else{
  	        this.control.content.findName("click2Play_Light_Start").Begin();
	        this.control.content.findName("PersonalBestChap013_wmv_thumb_Light_2").Begin();
  	    }

		this.control.content.findName("bannerDarkComingSoon").Begin();
		// Start events after initial
		this.control.content.findName("booksReset").Begin();
		this.control.content.findName("booksEnter").Begin();

		this.control.content.findName("booksLightLandOfMen_2").Begin();
		this.control.content.findName("booksLightAfA_2").Begin();
		this.control.content.findName("booksLightPBest_2").Begin();
		this.control.content.findName("booksLightRATW_2").Begin();
		
		this.control.content.findName("lightMenuCanvas").Begin();
		this.control.content.findName("bannerBlog_Light").Begin();
		
		// Now trigger all delayed menu animations (click-2-buy timers...etc.)
		this.control.content.findName("GB_menu_AfA_glow_enter").Begin();    // also reset (i.e. play) on every MouseEnter as well
		this.control.content.findName("GB_menu_AfA_glow_leave").Begin();    // also reset (i.e. play) on every MouseEnter as well
		this.control.content.findName("GB_menu_PBest_glow_enter").Begin();    // also reset (i.e. play) on every MouseEnter as well
		this.control.content.findName("GB_menu_PBest_glow_leave").Begin();    // also reset (i.e. play) on every MouseEnter as well
		this.control.content.findName("GB_menu_LOM_glow_enter").Begin();    // also reset (i.e. play) on every MouseEnter as well
		this.control.content.findName("GB_menu_LOM_glow_leave").Begin();    // also reset (i.e. play) on every MouseEnter as well
		this.control.content.findName("GB_menu_RATW_glow_enter").Begin();    // also reset (i.e. play) on every MouseEnter as well
		this.control.content.findName("GB_menu_RATW_glow_leave").Begin();    // also reset (i.e. play) on every MouseEnter as well
		this.control.content.findName("moveMenuBackBorder").Begin();    // also reset (i.e. play) on every MouseEnter as well

		// nice opening effect for buttons :-)
		this.control.content.findName("GB_menu_LOM_button_start").Begin();
		this.control.content.findName("GB_menu_AfA_button_start").Begin();
		this.control.content.findName("GB_menu_PBest_button_start").Begin();
		this.control.content.findName("GB_menu_RATW_button_start").Begin();
		this.control.content.findName("GB_menu_BIO_button_start").Begin();
		
        this.control.content.findName("small_pic_rotate_stop").Begin();
		// End events not in Page.xaml OnLoad

		// Event hookups:	
		rootElement.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleMouseDown));
//		control.content.findName("nowPlaying_banner").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.nowp_MouseEnter));
//		control.content.findName("nowPlaying_banner").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.nowp_MouseLeave));
		this.control.content.findName("visitSVTahlequah").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.svTahlequah_MouseEnter));
		this.control.content.findName("visitSVTahlequah").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.svTahlequah_MouseLeave));
		
    	//this.control.content.findName("BlogDesc_text2").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.booksRATW_MouseEnter));
		//this.control.content.findName("BlogDesc_text2").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.booksRATW_MouseLeave));
		this.control.content.findName("BlogDesc_text2").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.booksAfA_MouseEnter));
		this.control.content.findName("BlogDesc_text2").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.booksAfA_MouseLeave));
		//this.control.content.findName("RATW").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.bannerRATW_MouseEnter));
		//this.control.content.findName("RATW").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.bannerRATW_MouseLeave));
		this.control.content.findName("RATW").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.booksRATW_MouseEnter));
		this.control.content.findName("RATW").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.booksRATW_MouseLeave));
		//this.control.content.findName("bannerLOM").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.menuLOM_MouseEnter));
		//this.control.content.findName("bannerLOM").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.menuLOM_MouseLeave));
		this.control.content.findName("bannerLOM").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.booksAfA_MouseEnter));
		this.control.content.findName("bannerLOM").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.booksAfA_MouseLeave));

		//this.control.content.findName("book1_AfA").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.menuAfA_MouseClick));
		this.control.content.findName("book1_AfA").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.menuLOM_MouseClick));
		//this.control.content.findName("book1_LOM").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.menuLOM_MouseClick));
		this.control.content.findName("book1_LOM").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.menuAfA_MouseClick));
		this.control.content.findName("book1_PBest").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.menuPBest_MouseClick));
		this.control.content.findName("book1_RATW").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.menuRATW_MouseClick));

		//this.control.content.findName("book1_RATW").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.menuRATW_MouseClickDown));
		//this.control.content.findName("book1_RATW").addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.menuRATW_MouseClickUp));
		//this.control.content.findName("book1_RATW").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.menuRATW_MouseClickUp));

		//this.control.content.findName("book1_LOM").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.menuLOM_MouseClickDown));
		//this.control.content.findName("book1_LOM").addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.menuLOM_MouseClickUp));
		//this.control.content.findName("book1_LOM").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.menuLOM_MouseClickUp));

		this.control.content.findName("book1_AfA").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.booksAfA_MouseEnter));
		this.control.content.findName("book1_AfA").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.booksAfA_MouseLeave));
		this.control.content.findName("book1_PBest").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.booksPBest_MouseEnter));
		this.control.content.findName("book1_PBest").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.booksPBest_MouseLeave));
    	this.control.content.findName("book1_RATW").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.booksRATW_MouseEnter));
		this.control.content.findName("book1_RATW").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.booksRATW_MouseLeave));
		this.control.content.findName("book1_LOM").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.booksLOM_MouseEnter));
		this.control.content.findName("book1_LOM").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.booksLOM_MouseLeave));
		
		this.control.content.findName("PersonalBestChap013_wmv").addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.PersonalBestChap013_wmv_MouseClick));
		this.control.content.findName("PersonalBestChap013_wmv").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.booksPBest_MouseEnter));
		this.control.content.findName("PersonalBestChap013_wmv").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.booksPBest_MouseLeave));
		this.control.content.findName("PersonalBestChap013_wmv_thumb").addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.PersonalBestChap013_wmv_MouseClick));
		this.control.content.findName("PersonalBestChap013_wmv_thumb").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.booksPBest_MouseEnter));
		this.control.content.findName("PersonalBestChap013_wmv_thumb").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.booksPBest_MouseLeave));
		this.control.content.findName("PersonalBestChap013_wmv_copy").addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.PersonalBestChap013_wmv_MouseClick));
		this.control.content.findName("click_2_pause").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.PersonalBestChap013_wmv_MouseClick));
		this.control.content.findName("click_2_play").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.PersonalBestChap013_wmv_MouseClick));  
		this.control.content.findName("visitSVTahlequah").addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.visitSVTahlequah_MouseClick));
		this.control.content.findName("necessiSoft").addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.visitNecessiSoft_MouseClick));
		this.control.content.findName("small_pic").addEventListener("MouseEnter", Silverlight.createDelegate(this, this.smallPic_MouseEnter));
		this.control.content.findName("small_pic").addEventListener("MouseLeave", Silverlight.createDelegate(this, this.smallPic_MouseLeave));

		this.control.content.findName("small_pic").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.menuBIO_MouseClick));
		this.control.content.findName("BlogDesc_text1").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.bannerBlog_MouseClick));
		this.control.content.findName("BlogDesc_text2").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.bannerBlog_MouseClick));
		this.control.content.findName("BlogDesc_text3").addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.bannerBlog_MouseClick));
		//this.control.content.findName("GB_menu_PBest").addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.menuPBest_MouseClick));
		
		//this.control.content.findName("booksAfAFloat_Delay").Begin();
        this.isbooksPBestFloating = true;
        
		//this.control.content.findName("booksPBestFloat").Begin();
        this.isBooksCopyFloating = true;

		//this.control.content.findName("booksRATWFloat").Begin();
		clearTimeout(this.AfA_Timer)
		this.AfA_Timer = setTimeout("scene.books_Float(\""+"AfA"+"\")",6500);
		
		clearTimeout(this.LOM_Timer)
		this.LOM_Timer = setTimeout("scene.books_Float(\""+"LOM"+"\")",8000);
		
		clearTimeout(this.PBest_Timer)
		this.PBest_Timer = setTimeout("scene.books_Float(\""+"PBest"+"\")",5000);
		
		clearTimeout(this.RATW_Timer)
		this.RATW_Timer = setTimeout("scene.books_Float(\""+"RATW"+"\")",10000);

		//this.control.content.findName("booksLOMFloat").Begin();
        this.isBooksCopyCopyCopyFloating = true;

	},
	showComingSoonDesc: function(){
	    //this.control.content.findName("avail_CanvasLight").Begin();
	},
	hideComingSoonDesc: function(){
	    this.control.content.findName("avail_CanvasDark").Begin();
	},
	hideComingSoonDescQuick: function(){
	    //this.control.content.findName("avail_CanvasDark_quick").Begin();
	},
	menuLOM_MouseClickDown: function(sender, eventArgs) 
	{
	    //this.showComingSoonDesc();
	},
	menuLOM_MouseClickUp: function(sender, eventArgs) 
	{
	    //this.hideComingSoonDesc();
	},
	menuAfA_MouseClickDown: function(sender, eventArgs) 
	{
	    //this.showComingSoonDesc();
	},
	menuAfA_MouseClickUp: function(sender, eventArgs) 
	{
	    //this.hideComingSoonDesc();
	},
	menuPBest_MouseClickDown: function(sender, eventArgs) 
	{
	    //this.control.content.findName("avail_CanvasLight").Begin();
	},
	menuPBest_MouseClickUp: function(sender, eventArgs) 
	{
	    //this.control.content.findName("avail_CanvasDark").Begin();
	},
	menuRATW_MouseClickDown: function(sender, eventArgs) 
	{
	    //this.showComingSoonDesc();
	},
	menuRATW_MouseClickUp: function(sender, eventArgs) 
	{
	    //this.hideComingSoonDesc();
	},
	menuBIO_MouseClickDown: function(sender, eventArgs) 
	{
	    //this.control.content.findName("avail_CanvasLight").Begin();
	},
	menuBIO_MouseClickUp: function(sender, eventArgs) 
	{
	    //this.control.content.findName("avail_CanvasDark").Begin();
	},
	menuBIO_MouseClick: function(sender, eventArgs)     // only fires if Dn and Up while on same button
	{
    	window.location = "mailto:Author@EdwardMuesch.com?subject=Looking at your website (EdwardMuesch.com)&body=I was just on your website and..."; 
	},
	bannerBlog_MouseClick: function(sender, eventArgs) 
	{
	window.open("http://edwardmuesch.com/serendipity_books/","_newWindow"); 
		// The following line of code shows how to find an element by name and call a method on it.
	},
	menuRATW_MouseClick: function(sender, eventArgs) 
	{
	window.open("http://www.iuniverse.com/Bookstore/BookDetail.aspx?BookId=SKU-000066166","_newWindow"); 
	},
	menuLOM_MouseClick: function(sender, eventArgs) 
	{
	window.open("http://www.iuniverse.com/Bookstore/BookDetail.aspx?Book=122854","_newWindow"); 
	},
	menuPBest_MouseClick: function(sender, eventArgs) 
	{
//	window.open("http://www.amazon.com/gp/product/1589398394?ie=UTF8&amp;tag=svta-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1589398394","_newWindow"); 
//	window.open("http://search.barnesandnoble.com/booksearch/isbninquiry.asp?r=1&ean=1589398394","_newWindow");     // from Google Book Page
//	window.open("http://search.barnesandnoble.com/booksearch/results.asp?WRD=Personal+Best%3A+Chasing+the+Wind+Above+and+Below+the+Equator","_newWindow"); 

	window.open("http://www.iuniverse.com/bookstore/book_detail.asp?isbn=0-595-50735-2","_newWindow"); 
//	window.open("http://search.barnesandnoble.com/Personal-Best/Edward-Muesch/e/9780595507351/?itm=1","_newWindow"); 
	},
	menuAfA_MouseClick: function(sender, eventArgs) 
	{
//	window.open("http://www.amazon.com/gp/product/1589398394?ie=UTF8&amp;tag=svta-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1589398394","_newWindow"); 
//	window.open("http://search.barnesandnoble.com/booksearch/isbninquiry.asp?r=1&ean=1589398394","_newWindow");     // from Google Book Page
//	window.open("http://search.barnesandnoble.com/booksearch/results.asp?WRD=Personal+Best%3A+Chasing+the+Wind+Above+and+Below+the+Equator","_newWindow"); 

	window.open("http://www.iuniverse.com/bookstore/book_detail.asp?isbn=0-595-49930-9","_newWindow"); 
//	window.open("http://search.barnesandnoble.com/Ahmed-From-America/Edward-Muesch/e/9780595498857/?itm=2","_newWindow"); 
	},
	pageSize_MouseClick: function(sender, eventArgs) 
	{
	    if(this.isPageFullSize){
		    this.control.content.findName("PageSmall").Begin();
            this.isPageFullSize = false;
	    }else{
		    this.control.content.findName("PageFull").Begin();
            this.isPageFullSize = true;
	    }
	},
	visitSVTahlequah_MouseClick: function(sender, eventArgs) 
	{
	//HtmlPage.Navigate("http://www.svTahlequah.com","_newWindow");
	window.open("http://www.svTahlequah.com","_newWindow"); 
		// The following line of code shows how to find an element by name and call a method on it.
//		this.control.content.findName("trig_ednHelenBob").Begin();
	},
	visitNecessiSoft_MouseClick: function(sender, eventArgs) 
	{
	window.open("http://www.necessiSoft.com","_newWindow"); 
		// The following line of code shows how to find an element by name and call a method on it.
//		this.control.content.findName("trig_ednHelenBob").Begin();
	},
	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("trig_ednHelenBob").Begin();
	},
	// Sample event handler
	nowp_MouseEnter: 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("booksLeft").Begin();
		this.control.content.findName("booksDrop").Begin();
		this.control.content.findName("booksFan").Begin();
	},
	// Sample event handler
	nowp_MouseLeave: 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("booksLeft").Begin();
//		this.control.content.findName("booksDrop").Begin();
//		this.control.content.findName("booksFan").Begin();
	},
	// Sample event handler  PersonalBestChap013_wmv
	svTahlequah_MouseEnter: function(sender, eventArgs) 
	{
		//this.control.content.findName("booksDimPBest").Begin();
		this.control.content.findName("booksMoveToPBest").Begin();
		this.control.content.findName("booksDimAfA").Begin();
		this.control.content.findName("booksDimRATW").Begin();
		this.control.content.findName("booksDimLandOfMen").Begin();
		this.control.content.findName("bannerDarkLOM").Begin();
		this.control.content.findName("bannerDarkRATW").Begin();
		//this.control.content.findName("bannerDarkComingSoon").Begin();

		this.control.content.findName("svTahlequahDesc_Light").Begin();

		clearTimeout(this.PBest_Timer)
    	this.PBest_Timer = setTimeout("scene.books_Float(\""+"PBest3"+"\")",4000);
	},
	svTahlequah_MouseLeave: function(sender, eventArgs) 
	{
		this.control.content.findName("svTahlequahDesc_Dim").Begin();
		//this.control.content.findName("booksLightPBest").Begin();
		this.control.content.findName("booksMoveBackPBest").Begin();
		this.control.content.findName("booksLightAfA").Begin();
		this.control.content.findName("booksLightRATW").Begin();
		this.control.content.findName("booksLightLandOfMen").Begin();
		this.control.content.findName("bannerLightLOM").Begin();
		this.control.content.findName("bannerLightRATW").Begin();
		//this.control.content.findName("bannerLightComingSoon").Begin();
		this.control.content.findName("booksLightPBest").Begin();

		clearTimeout(this.PBest_Timer)
    	this.PBest_Timer = setTimeout("scene.books_Float(\""+"PBest"+"\")",4000);
	},
	fullPage_MouseEnter: function(sender, eventArgs) 
	{
		this.control.content.findName("bannerDimLOM").Begin();
		this.control.content.findName("bannerDimRATW").Begin();
		this.control.content.findName("booksDimPBest").Begin();
		this.control.content.findName("booksDimAfA").Begin();
		this.control.content.findName("booksDimRATW").Begin();
		//this.control.content.findName("nowPlaying_banner_Dim").Begin();
		//this.control.content.findName("bannerDimComingSoon").Begin();

		this.control.content.findName("PersonalBestChap013_wmv_Dim").Begin();
   	    this.setViewerControlsDim(this.isPlaying);
	},
	fullPage_MouseLeave: 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("bannerLightLOM").Begin(); 
		this.control.content.findName("bannerLightRATW").Begin(); 
		this.control.content.findName("booksLightPBest").Begin();
		this.control.content.findName("booksLightAfA").Begin();
		this.control.content.findName("booksLightRATW").Begin();
		this.control.content.findName("nowPlaying_banner_Light").Begin();
		//this.control.content.findName("bannerLightComingSoon").Begin();

		this.control.content.findName("PersonalBestChap013_wmv_Light").Begin();
   	    this.setViewerControlsLight(this.isPlaying);
	},
	
	smallPic_MouseEnter: function(sender, eventArgs) 
	{
		// The following line of code shows how to find an element by name and call a method on it.
//		if(!this.isSmallPicRotatingStarted){
//            this.control.content.findName("small_pic_rotate_start").Begin();
//            this.isSmallPicRotatingStarted = true;
//        }else{
        this.control.content.findName("BIODesc_Light").Begin();
		this.control.content.findName("bannerDimLOM").Begin();
		this.control.content.findName("bannerDimRATW").Begin();
		//this.control.content.findName("bannerDimComingSoon").Begin();
	    //this.control.content.findName("booksDimAfA").Begin();
	    
	    this.control.content.findName("booksMoveToAfA_4").Begin();
		//this.control.content.findName("bannerDimAfA").Begin();
		clearTimeout(this.AfA_Timer)
		this.AfA_Timer = setTimeout("scene.books_Float(\""+"AfA3"+"\")",4500);
	    //this.control.content.findName("booksDimLandOfMen").Begin();
	    //this.control.content.findName("booksDimRATW").Begin();
	    //this.control.content.findName("small_pic_cursor_wait").Begin();
	    //this.control.content.findName("arrowCursor_small_pic").Begin();
        
        if(!this.isSmallPicRotating){
            this.control.content.findName("small_pic_rotate_play").Begin();
            this.isSmallPicRotating = true;
            }
//        }
		this.setCursorArrow("small_pic");
	},
	smallPic_MouseLeave: 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("booksOutIn").Begin();
        this.control.content.findName("BIODesc_Dim").Begin();
        this.control.content.findName("small_pic_rotate_stop").Begin();
        this.isSmallPicRotatingStarted = false;
        this.isSmallPicRotating = false;
		
		this.control.content.findName("bannerLightLOM").Begin(); 
		this.control.content.findName("bannerLightRATW").Begin(); 
		//this.control.content.findName("bannerLightComingSoon").Begin();
	    //this.control.content.findName("booksLightAfA").Begin();
	    this.control.content.findName("booksMoveBackAfA").Begin();
		this.control.content.findName("bannerDimLOM").Begin();
		clearTimeout(this.AfA_Timer)
		this.AfA_Timer = setTimeout("scene.books_Float(\""+"AfA"+"\")",4500);
	    //this.control.content.findName("booksLightLandOfMen").Begin();

	    //this.control.content.findName("arrowCursor_away").Begin();
	},
	// Sample event handler
//	bannerRATW_MouseEnter: function(sender, eventArgs)
//	{
//		// amke sure we're positioned properly
//		this.control.content.findName("booksMoveBackRATW_3").Begin();
//		this.control.content.findName("booksDimPBest").Begin();
//		this.control.content.findName("booksDimLandOfMen").Begin();
//		this.control.content.findName("booksMoveToRATW").Begin();
//		this.control.content.findName("booksMoveToAfA").Begin();
//	    this.control.content.findName("bannerDimLOM").Begin();
//	    this.control.content.findName("RATWDesc_Light").Begin();
//   		clearTimeout(this.RATW_Timer)
//    	this.RATW_Timer = setTimeout("scene.books_Float(\""+"RATW2"+"\")",4000);

//	},
//	bannerRATW_MouseLeave: function(sender, eventArgs)
//	{
//	    this.control.content.findName("RATWDesc_Dim").Begin();
//		this.control.content.findName("booksMoveBackRATW").Begin();
//		this.control.content.findName("booksLightPBest").Begin();
//		this.control.content.findName("booksLightLandOfMen").Begin();
//	    this.control.content.findName("bannerLightLOM").Begin();
//		this.control.content.findName("booksMoveBackAfA").Begin();
//		clearTimeout(this.RATW_Timer)
//    	this.RATW_Timer = setTimeout("scene.books_Float(\""+"RATW2"+"\")",5000);
//	},
	booksRATW_MouseLeave: 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("booksRATWZoomOut").Begin();
//		this.control.content.findName("PBestDesc_Dim").Begin();
		this.control.content.findName("booksLightAfA").Begin();
		this.control.content.findName("booksMoveBackAfA").Begin();
		clearTimeout(this.AfA_Timer)
		this.AfA_Timer = setTimeout("scene.books_Float(\""+"AfA"+"\")",4500);
		this.control.content.findName("booksLightLandOfMen").Begin();
		//this.control.content.findName("booksMoveBackRATW_2").Begin();
		this.control.content.findName("booksLightRATW").Begin();
	    this.control.content.findName("RATWDesc_Dim").Begin();
		this.control.content.findName("booksLightPBest").Begin();
		this.control.content.findName("bannerLightLOM").Begin();
		this.control.content.findName("bannerRATW_MoveBack").Begin();
		//this.control.content.findName("bannerLightComingSoon").Begin();
		//this.control.content.findName("comingSoon_MoveBack").Begin();
		this.control.content.findName("nowPlaying_banner_Light").Begin();

		clearTimeout(this.RATW_Timer)
    	this.RATW_Timer = setTimeout("scene.books_Float(\""+"RATW"+"\")",5000);

	},
	booksRATW_MouseEnter: 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("booksRATWZoomIn").Begin();
//		this.control.content.findName("PBestDesc_Light").Begin();
		this.control.content.findName("booksDimPBest").Begin();
		this.control.content.findName("booksDimLandOfMen").Begin();
		//this.control.content.findName("booksMoveToRATW_2").Begin();
	    this.control.content.findName("RATWDesc_Light").Begin();
		//this.control.content.findName("booksMoveToAfA").Begin();
		this.control.content.findName("booksDimAfA").Begin();
		this.control.content.findName("bannerDimLOM").Begin();
		this.control.content.findName("bannerRATW_MoveTo").Begin();
		//this.control.content.findName("bannerDimComingSoon").Begin();
		//this.control.content.findName("comingSoon_MoveTo").Begin();
		//this.control.content.findName("nowPlaying_banner_Dim").Begin();
		clearTimeout(this.RATW_Timer)
    	this.RATW_Timer = setTimeout("scene.books_Float(\""+"RATW2"+"\")",4000);
	},
	menuLOM_MouseEnter: function(sender, eventArgs)
	{
        this.control.content.findName("booksLOMZoomIn2").Begin();
        this.control.content.findName("descMoveToLOM").Begin();
        
		this.control.content.findName("booksDimPBest").Begin();
		this.control.content.findName("booksDimAfA").Begin();
		this.control.content.findName("booksMoveToAfA").Begin();
//		this.control.content.findName("comingSoon_MoveTo").Begin();
		this.control.content.findName("bannerLOM_MoveTo").Begin();
		this.control.content.findName("booksDimRATW").Begin();
	    this.control.content.findName("bannerDimRATW").Begin();
	    this.control.content.findName("AfADesc_Light").Begin();
	    //this.control.content.findName("nowPlaying_banner_Dim").Begin();
	    //bannerLOM_MoveTo
		clearTimeout(this.LOM_Timer)
		this.LOM_Timer = setTimeout("scene.books_Float(\""+"LOM3"+"\")",4000);
	    
	},
	menuLOM_MouseLeave: function(sender, eventArgs)
	{
		this.control.content.findName("booksLOMZoomOut").Begin();
        this.control.content.findName("descMoveBackLOM").Begin();

	    this.control.content.findName("AfADesc_Dim").Begin();
		this.control.content.findName("booksLightRATW").Begin();
		this.control.content.findName("booksLightPBest").Begin();
		this.control.content.findName("booksLightAfA").Begin();
	    this.control.content.findName("booksMoveBackAfA").Begin();
		clearTimeout(this.AfA_Timer)
		this.AfA_Timer = setTimeout("scene.books_Float(\""+"AfA"+"\")",4500);
		//this.control.content.findName("comingSoon_MoveBack").Begin();
		this.control.content.findName("bannerLOM_MoveBack").Begin();
	    this.control.content.findName("bannerLightRATW").Begin();
		this.control.content.findName("nowPlaying_banner_Light").Begin();

		clearTimeout(this.LOM_Timer)
		this.LOM_Timer = setTimeout("scene.books_Float(\""+"LOM"+"\")",5000);
	},
	bannerLOM_MouseEnter: function(sender, eventArgs)
	{
        this.control.content.findName("booksLOMZoomIn").Begin();
		this.control.content.findName("booksDimPBest").Begin();
		this.control.content.findName("booksDimAfA").Begin();
		this.control.content.findName("booksMoveToAfA").Begin();
		//this.control.content.findName("comingSoon_MoveTo").Begin();
		this.control.content.findName("booksDimRATW").Begin();
	    this.control.content.findName("bannerDimRATW").Begin();
	    this.control.content.findName("LOMDesc_Light").Begin();
	    this.control.content.findName("descMoveToLOM").Begin();
		//this.control.content.findName("nowPlaying_banner_Dim").Begin();

		clearTimeout(this.LOM_Timer)
		this.LOM_Timer = setTimeout("scene.books_Float(\""+"LOM3"+"\")",4000);
	},
	bannerLOM_MouseLeave: function(sender, eventArgs)
	{
		this.control.content.findName("booksLOMZoomOut").Begin();
	    this.control.content.findName("LOMDesc_Dim").Begin();
		this.control.content.findName("booksLightRATW").Begin();
		this.control.content.findName("booksLightPBest").Begin();
		this.control.content.findName("booksLightAfA").Begin();
	    this.control.content.findName("booksMoveBackAfA").Begin();
		clearTimeout(this.AfA_Timer)
		this.AfA_Timer = setTimeout("scene.books_Float(\""+"AfA"+"\")",4500);
		//this.control.content.findName("comingSoon_MoveBack").Begin();
	    this.control.content.findName("bannerLightRATW").Begin();

		clearTimeout(this.LOM_Timer)
		this.LOM_Timer = setTimeout("scene.books_Float(\""+"LOM"+"\")",5000);
	},
	booksLOM_MouseEnter: function(sender, eventArgs) 
	{
        this.control.content.findName("booksLOMZoomIn").Begin();
		this.control.content.findName("booksDimPBest").Begin();
		this.control.content.findName("booksDimRATW").Begin();
    	this.control.content.findName("booksDimAfA").Begin();
		this.control.content.findName("booksMoveToAfA").Begin();
		//this.control.content.findName("comingSoon_MoveTo").Begin();
		this.control.content.findName("bannerDimLOM").Begin();

		//this.control.content.findName("LOMDesc_Light").Begin();
		this.control.content.findName("AfADesc_Light").Begin();
		//this.control.content.findName("descMoveToLOM2").Begin();
		this.control.content.findName("bannerDimRATW").Begin();
		//this.control.content.findName("nowPlaying_banner_Dim").Begin();

		clearTimeout(this.LOM_Timer)
		this.LOM_Timer = setTimeout("scene.books_Float(\""+"LOM2"+"\")",4000);
	},
	booksLOM_MouseLeave: function(sender, eventArgs) 
	{
		this.control.content.findName("booksLOMZoomOut").Begin();
		this.control.content.findName("booksLightPBest").Begin();
		this.control.content.findName("booksLightRATW").Begin();
		this.control.content.findName("booksLightAfA").Begin();
		this.control.content.findName("booksMoveBackAfA").Begin();
		this.control.content.findName("bannerLightLOM").Begin();

		clearTimeout(this.AfA_Timer)
		this.AfA_Timer = setTimeout("scene.books_Float(\""+"AfA"+"\")",5000);

		//this.control.content.findName("comingSoon_MoveBack").Begin();

		//this.control.content.findName("LOMDesc_Dim").Begin();
		this.control.content.findName("AfADesc_Dim").Begin();
		this.control.content.findName("bannerLightRATW").Begin();
		//this.control.content.findName("bannerLightComingSoon").Begin();
		this.control.content.findName("nowPlaying_banner_Light").Begin();

		clearTimeout(this.LOM_Timer)
		this.LOM_Timer = setTimeout("scene.books_Float(\""+"LOM"+"\")",5000);
	},
	booksAfA_MouseEnter: function(sender, eventArgs) {
	    // The following line of code shows how to find an element by name and call a method on it.
	    //	    if(!this.isbooksPBestFloating){
	    //            this.control.content.findName("booksAfAFloat").Begin();
	    //            this.isbooksPBestFloating = true;
	    //        }
	    clearTimeout(this.AfA_Timer)
	    this.AfA_Timer = setTimeout("scene.books_Float(\"" + "AfA2" + "\")", 5000);

	    this.control.content.findName("booksAfAZoomIn").Begin();
	    //this.control.content.findName("bannerDimLOM").Begin();
	    this.control.content.findName("bannerDimRATW").Begin();
	    //		this.control.content.findName("comingSoon_MoveTo").Begin();
	    this.control.content.findName("booksDimPBest").Begin();
	    this.control.content.findName("booksDimRATW").Begin();
	    this.control.content.findName("booksDimLandOfMen").Begin();
	    //		this.control.content.findName("nowPlaying_banner_Dim").Begin();
	    //this.control.content.findName("bannerDarkComingSoon").Begin();

	    this.control.content.findName("PersonalBestChap013_wmv_Dim").Begin();
	    this.setViewerControlsDim(this.isPlaying);

	    this.control.content.findName("descMoveToLOM").Begin();
	    this.control.content.findName("bannerDimRATW").Begin();
	    this.control.content.findName("LOMDesc_Light").Begin();
	},
	booksAfA_MouseLeave: 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("booksOutIn").Begin();
	    this.control.content.findName("booksAfAZoomOut").Begin();
	    this.control.content.findName("bannerLightLOM").Begin();
	    this.control.content.findName("bannerLightRATW").Begin();
	    //this.control.content.findName("comingSoon_MoveBack").Begin();
	    this.control.content.findName("booksLightPBest").Begin();
	    this.control.content.findName("booksLightRATW").Begin();
	    this.control.content.findName("booksLightLandOfMen").Begin();
	    //		this.control.content.findName("nowPlaying_banner_Light").Begin();
	    //this.control.content.findName("bannerLightComingSoon").Begin();

	    this.control.content.findName("PersonalBestChap013_wmv_Light").Begin();
	    this.setViewerControlsLight(this.isPlaying);

	    this.control.content.findName("LOMDesc_Dim").Begin();

	    clearTimeout(this.AfA_Timer)
	    this.AfA_Timer = setTimeout("scene.books_Float(\"" + "AfA" + "\")", 4500);

	},
	booksPBest_MouseLeave: 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("booksPBestZoomOut").Begin();
		this.control.content.findName("PBestDesc_Dim").Begin();
		this.control.content.findName("booksLightAfA").Begin();
		this.control.content.findName("booksLightRATW").Begin();
		this.control.content.findName("booksLightLandOfMen").Begin();
		this.control.content.findName("bannerLightLOM").Begin();
		this.control.content.findName("bannerLightRATW").Begin();
		//this.control.content.findName("bannerLightComingSoon").Begin();

		clearTimeout(this.PBest_Timer)
		this.PBest_Timer = setTimeout("scene.books_Float(\""+"PBest"+"\")",5000);
	},
	booksPBest_MouseEnter: 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("booksPBestZoomIn").Begin();
		this.control.content.findName("PBestDesc_Light").Begin();
		this.control.content.findName("booksDimAfA").Begin();
		this.control.content.findName("booksDimRATW").Begin();
		this.control.content.findName("booksDimLandOfMen").Begin();
		this.control.content.findName("bannerDarkLOM").Begin();
		this.control.content.findName("bannerDarkRATW").Begin();
		//this.control.content.findName("bannerDarkComingSoon").Begin();

		clearTimeout(this.PBest_Timer)
		this.PBest_Timer = setTimeout("scene.books_Float(\""+"PBest2"+"\")",4000);
	},
	PersonalBestChap013_wmv_MouseClick: function(sender, eventArgs)
	{
	    if(!this.isPlaying){
	        this.control.content.findName("PersonalBestChap013_wmv").Play();
	        this.control.content.findName("PersonalBestChap013_wmv_thumb_Dim").Begin();
	    }else{
	        this.control.content.findName("PersonalBestChap013_wmv").Pause();
	    }
	    this.isPlaying = !this.isPlaying;
	    this.setViewerControlsLight(this.isPlaying);
	    
	},
	setViewerControlsLight: function(playing)
	{
	    if(!playing){
    	    this.control.content.findName("click2Play_Light").Begin();
    	    this.control.content.findName("PersonalBestChap013_wmv_thumb_Light").Begin();
	    }else{
    	    this.control.content.findName("click2Pause_Light").Begin();
    	    this.control.content.findName("PersonalBestChap013_wmv_thumb_Dim").Begin();
	    }
	},
	setViewerControlsDim: function(playing)
	{
	    if(!playing){
    	    this.control.content.findName("click2Play_Dim").Begin();
    	    this.control.content.findName("PersonalBestChap013_wmv_thumb_Dim").Begin();
	    }else{
    	    this.control.content.findName("click2Pause_Dim").Begin();
    	    this.control.content.findName("PersonalBestChap013_wmv_thumb_Dim").Begin();
	    }
	},
	setCursorArrow: function(item2Set){
//var t = setTimeout(this.control.content.findName("click2Pause_Dim"), 40000);
   //this.control.content.findName(item2Set).Cursor = Cursors.Arrow;

}



}
	
function trig_ednHelenDropIn_Completed(sender, args) 
{
    //[ Do a frame of animation ]
    // Start next animation
    this.control.content.findName("trig_ednHelenBob").Begin();
}

    
    
var gMapViewer;
var gBrowserIsIE = false;


// Register for scroll wheel events
if(window.addEventListener) {
	window.addEventListener('DOMMouseScroll', OnScrollWheel, true);
	gBrowserIsIE = true;
} else {
	window.onmousewheel = document.onmousewheel = OnScrollWheel;
}


// Creates the SL application
function WriteEmbedTag()
{
	Silverlight.createObjectEx({
		source: "MapViewer.xap?r="+Math.random(),
		parentElement: document.getElementById("SilverlightControlHost"),
		id: "SilverlightControl",
		properties: {
			width: "100%",
			height: "100%",
			version: "2.0",
			enableHtmlAccess: "true"
		},
		events: {
			onLoad: HandleLoaded,
			onError: HandleError
		}
	});
}

function OnErrorEventHandler(sender, errorArgs)
{
    // The error message to display.
    var errorMsg = "Please accept our apologies.  There has been a problem with this website.\r\n\r\nSilverlight Error: \r\n\r\n";
    
    // Error information common to all errors.
    errorMsg += "Error Type:    " + errorArgs.errorType + "\r\n";
    errorMsg += "Error Message: " + errorArgs.errorMessage + "\r\n";
    errorMsg += "Error Code:    " + errorArgs.errorCode + "\r\n\r\n";
    
    // Determine the type of error and add specific error information.
    switch(errorArgs.errorType)
    {
        case "RuntimeError":
            // Display properties specific to RuntimeErrorEventArgs.
            if (errorArgs.lineNumber != 0)
            {
                errorMsg += "Line:       " + errorArgs.lineNumber + "\r\n";
                errorMsg += "Position:   " + errorArgs.charPosition + "\r\n";
            }
            errorMsg +=     "MethodName: " + errorArgs.methodName + "\r\n";
            break;
        case "ParserError":
            // Display properties specific to ParserErrorEventArgs.
            errorMsg += "Xaml File:      " + errorArgs.xamlFile      + "\r\n";
            errorMsg += "Xml Element:    " + errorArgs.xmlElement    + "\r\n";
            errorMsg += "Xml Attribute:  " + errorArgs.xmlAttribute  + "\r\n";
            errorMsg += "Line:           " + errorArgs.lineNumber    + "\r\n";
            errorMsg += "Position:       " + errorArgs.charPosition  + "\r\n";
            break;
        default:
            break;
    }
    return errorMsg+"\r\n";
    // Display the error message.
    //alert(errorMsg);
}


// Handles errors from Silverlight
function HandleError(sender, args)
{
   var newNode;
   var parNode;

   // ignore image errors
   if(args.errorType == "ImageError") {
      return;
   }
      
   // create new text area element
   newNode = document.createElement("textarea");
   //newNode.appendChild(document.createTextNode(CreateDefaultErrMsg(args)));
   newNode.appendChild(document.createTextNode(OnErrorEventHandler(sender, args)));

   newNode.setAttribute("wrap", "on");
   newNode.setAttribute("cols", "100");
   newNode.setAttribute("rows", "25");
   
   // update Silverlight control host
   parNode = document.getElementById("silverlightPlugInHost");
   parNode.removeChild(parNode.firstChild);
   parNode.appendChild(newNode);

   // clear map viewer reference
   gMapViewer = null;
}


// Message for runtime failure
function CreateDefaultErrMsg(args)
{
   if(args.errorType == "ParserError" && args.errorCode == 2011 ) { //5014) {
      return (
         "If you have just installed or upgraded Silverlight; \r\n"+
         "In order to complete the Silverlight plug-in "+
         "installation\r\nyou must first close your browser "+
         "and then re-open this URL:\r\n\r\n"+
         "http://www.EdwardMuesch.com"
      );
   } else {
      return (
         "Sliverlight Error\r\n"+
         "Error Type:    " + args.errorType    +"\r\n"+
         "Error Code:    " + args.errorCode    +"\r\n"+
         "Error Message: " + args.errorMessage +"\r\n"
      );
   }
}


// Called when the SL control is loaded
function HandleLoaded(sender, args)
{
//  gMapViewer = sender.Content.IdvDemoMap;
}


// Called when scroll wheel is used
function OnScrollWheel(event)
{
   var intDelta = 0;

   // quit now if map viewer invalid   
   if(gMapViewer == null) return;

   // get scroll wheel event
   event = (event)? event : window.event

   // get actual scroll wheel value
   if(event.wheelDelta) {
      if(window.opera) {
         intDelta = -event.wheelDelta;
      } else {
         intDelta =  event.wheelDelta;
      }
   } else if(event.detail) {
      intDelta = -event.detail;
   }
   
   // process scroll wheel event
   intDelta = (intDelta > 0)? 1 : -1;
	gMapViewer.OnScrollWheel(intDelta);

   // handle the mouse event
	if(gBrowserIsIE) {
		event.preventDefault();
		event.stopPropagation();
	} else {
		event.returnValue = false;
	}
}

function getWindowWidth(){
  var ww = 0;
  d = document;
   if ( typeof window.innerWidth != 'undefined' )
     ww = window.innerWidth;  // NN and Opera version
   else
   {
     if ( d.documentElement
       && typeof d.documentElement.clientWidth!='undefined'
       && d.documentElement.clientWidth != 0 )
       ww = d.documentElement.clientWidth;
     else
       if ( d.body
         && typeof d.body.clientWidth != 'undefined' )
         ww = d.body.clientWidth;
     else alert ("Can't identify window width - unknown browser.")
   }
   return ww;
}

function getWindowHeight(){
  var ww = 0;
  d = document;
   if ( typeof window.innerHeight != 'undefined' )
     ww = window.innerHeight;  // NN and Opera version
   else
   {
     if ( d.documentElement
       && typeof d.documentElement.clientHeight!='undefined'
       && d.documentElement.clientHeight != 0 )
       ww = d.documentElement.clientHeight;
     else
       if ( d.body
         && typeof d.body.clientHeight != 'undefined' )
         ww = d.body.clientHeight;
     else alert ("Can't identify window height - unknown browser.")
   }
   return ww;
}

// Resize and reposition application elements.
function updateLayout(width, height)
{
    // Perform layout tasks based on width and height.
}

function onResizeScale(sender, eventArgs)
{
    var winWidth = getWindowWidth();
    var winHeight = getWindowHeight();

    // needed to resolve
    var plugIn = sender.GetHost();

    // Display an alert dialog box with a formatted message string.
    var pageScaleX = winWidth / sender.actualWidth;
    var pageScaleY = winHeight / sender.actualHeight;
    var pageScale = Math.min(pageScaleX,pageScaleY);    // maintains aspect ratio
    
    var pageTransScale = sender.findName("RenderTransformScale_Page");
    pageTransScale.ScaleX = pageScale;
    pageTransScale.ScaleY = pageScale;

    var pageTransPosit = sender.findName("RenderTransformPosition_Page");
    // use this to keep flush-left with browser
    //pageTransPosit.X = (sender.actualWidth * (pageScale-1) ) / 2;
    // use this to center Silverlight Control horizontally
    pageTransPosit.X = (sender.actualWidth * (pageScaleX-1) ) / 2;
    
    // use this to keep flush-top with browser
    pageTransPosit.Y = (sender.actualHeight * (pageScale-1) ) / 2;
    // use this to center Silverlight Control vertically
    //pageTransPosit.Y = (sender.actualHeight * (pageScaleY-1) ) / 2;
}

function pausecomp(millis) 
{
    var date = new Date();
    var curDate = null;

    do { curDate = new Date(); } 
    while(curDate-date < millis);
} 

function bannerHoliday_Set(sender)
{
   sender.content.findName("bannerHoliday").Text=getDateWithHoliday();
   sender.content.findName("bannerHoliday_Light").Begin();
   //sender.content.findName("bannerHoliday_glow_enter").Begin();
   
   
}

//function makeMovie(sender, args)
//{
//  var downloader = sender.getHost().createObject("Downloader");
//  // Add DownloadProgressChanged and Completed events.
//  //downloader.downloadProgressChanged = "javascript:onDownloadProgressChanged";
//  downloader.addEventListener("completed", Silverlight.createDelegate(this, onCompleted3));

//  // Initialize the Downloader request.
//  downloader.open("GET", "Movie/player.xaml");

//  // Execute the Downloader request.
//  downloader.send();
//}

//function onCompleted3(sender, eventArgs)
//{
//  var control = sender.getHost();
//  var sPart = "";
//  var xamlFragment = control.content.createFromXamlDownloader(sender, sPart); 

//	
//  // Add the XAML object as a child of the root Canvas object.
//  var root = sender.findName("PersonalBestChap013_wmv_canvas");
//  root.children.add(xamlFragment);
//  //var player = new StartPlayer_0();
//}
