﻿var _ProgressStatus;
var _IsLoading;
var _LayoutRoot;

function SplashScreen_Loaded(sender, eventArgs) {
    _IsLoading = true;
    sender.findName("Rotate").begin();
    _ProgressStatus = sender.findName("ProgressStatus");
    _LayoutRoot = sender.findName("LayoutRoot");
    SplashScreen_Resize();
    var quantity = document.getElementById("TravelInfoQuantity").value;
    sender.findName("NewsNum").Text = quantity;
}


function SplashScreen_Resize() {
    if (_IsLoading) {
        var top = (document.documentElement.clientHeight - 245 - 110) / 2;
        var left = (document.documentElement.clientWidth - 196 - 110) / 2 + 15;
        _LayoutRoot.setValue("Canvas.Top", top);
        _LayoutRoot.setValue("Canvas.Left", left);
    }
}

function disableScrollbar() {
    document.getElementsByTagName('body')[0].style.overflow = 'hidden';
    document.getElementsByTagName('html')[0].style.overflow = 'hidden';
}


function onSourceDownloadComplete(sender, eventArgs) {
    DoResize();
    _IsLoading = false;
}

function onSourceDownloadProgressChanged(sender, eventArgs) {
    _ProgressStatus.Text = Math.round((eventArgs.progress * 100)) + "";
    _ProgressStatus.setValue("Canvas.Left", 160 - _ProgressStatus.ActualWidth);
}

