﻿var acPath = '~/AjaxAscx/AjaxChineseInc.ascx';
var adPath = '~/AjaxAscx/AjaxDigitalInc.ascx';
var ayPath = '~/AjaxAscx/AjaxYuLuInc.ascx';
var alPath = '~/AjaxAscx/AjaxLettersInc.ascx';
var asPath = '~/AjaxAscx/AjaxSymbolInc.ascx';

Sys.Application.add_init(AppInit);

function AppInit() {
    WCF.ShowReader.GetReader(ayPath, OnSuccess, OnFailure);
}

function AppShowData(elemName, elemID) {
    if (elemName == 'ac') {
        WCF.ShowReader.GetReader(acPath, OnSuccess, OnFailure);
    } else if (elemName == 'ad') {
        WCF.ShowReader.GetReader(adPath, OnSuccess, OnFailure);
    } else if (elemName == 'ay') {
        WCF.ShowReader.GetReader(ayPath, OnSuccess, OnFailure);
    } else if (elemName == 'al') {
        WCF.ShowReader.GetReader(alPath, OnSuccess, OnFailure);
    } else if (elemName == 'as') {
        WCF.ShowReader.GetReader(asPath, OnSuccess, OnFailure);
    }
    var lic = $get('sptb').getElementsByTagName('li').length;
    for (var k = 0; k < lic; k++) {
        $get('sptb').getElementsByTagName('li').item(k).className = 'sptbn';
    }
    elemID.className = 'sptbs';
}

function OnSuccess(result) {
    $get('AjaxDataInc').style.display = 'none';
    Sys.UI.DomElement.removeCssClass($get('AjaxDataInc'), 'loading');
    $get('AjaxDataInc').innerHTML = result;
    $get('AjaxDataInc').style.display = 'block';
    SetDivHeight('dcb5a', 'dcb4a', 'dcb6a');
}

function OnFailure(error) {
    // Error handling
}