﻿var x;
var imgRoot = "/App_Images/";
var imgPreload = new Array("fpBg2.jpg", "cn/fpBg1.jpg", "en/screenshots/frontpage/SoftwareBg.jpg", "cn/screenshots/frontpage/Distribution-Agreement.png", "btnGreen5.png", "fpProductivity.jpg", "fpCom.jpg", "fpPro.jpg", "/App_Images/fpSave.jpg", "fpTime.jpg");
for (x in imgPreload) {
    img = new Image();
    img.src = imgRoot + imgPreload[x];
}
var imgPreload2 = new Array("ssBg.png", "cn/screenshots/01.gif", "cn/screenshots/02.gif", "cn/screenshots/03.gif", "cn/screenshots/04.gif");
var imgPreload3 = new Array("cn/screenshots/Features_HQForms.jpg", "cn/screenshots/Features_Editors_Office2007.jpg", "cn/screenshots/Features_Search_Office2007.jpg", "cn/screenshots/Features_Activation_Office2007.jpg", "cn/screenshots/Features_Autofill-1.jpg", "cn/screenshots/Features_Languages.jpg", "cn/screenshots/Features_Application_Office2007.jpg", "cn/screenshots/Features_Autorecovery_Office2007.jpg", "cn/screenshots/Features_Updates_Office2007.jpg");
for (x in imgPreload2) {
    img = new Image();
    img.src = imgRoot + imgPreload2[x];
}
for (x in imgPreload3) {
    img = new Image();
    img.src = imgRoot + imgPreload3[x];
}

/* TOP BANNER SLIDES */
var iSlides = 0;
var tmrSlides = 0;
var tmrDelaySlides = 1000;
var aSlides = [
    { "img": "/App_Images/cn/screenshots/frontpage/SoftwareBg.jpg", "title": "¡El Programa #1 de Documentos Comerciales Y Legales!", "text": "Descargue Business-in-a-Box para obtener más de 1.200 plantillas de documentos. ¡Le ayudará en gran medida al lanzamiento, la gestión y al crecimiento de su empresa!", "ptr": "0" },
    { "img": "/App_Images/fpProductivity.jpg", "title": "节约时间并提高您的工作效率", "text": "使用商务宝盒是书写任何商务文档的最便捷的方式！<br />使用多用户许可提高每名员工的工作效率。", "ptr": "85" },
    { "img": "/App_Images/fpPro.jpg", "title": "言行更专业", "text": "使用经验丰富的律师创建的模板传递完美的企业形象", "ptr": "165" },
    { "img": "/App_Images/fpCom.jpg", "title": "改善您的交流效果", "text": "与客户、合作伙伴、经销商、<br />员工和投资者精确沟通。<br />从此摆脱无话可说的处境！", "ptr": "220" },
    { "img": "/App_Images/fpSave.jpg", "title": "节约律师费", "text": "使用专业的法律表格节省法律费用<br />保护您的公司并提高大订单的谈判能力。", "ptr": "285" },
    { "img": "/App_Images/fpHP.jpg", "title": "HP打印机现在支持<br />Biztree Docs程序！", "text": "Biztree与惠普通力合作打造打印机程序，<br />成为惠普首个基于网络的商用打印机<br/><br/><a href='/company/biztree-docs-business-in-a-box-templates-app-hp-printers_20101101.aspx' class='btnDownload2'>阅读更多 ►</a>", "ptr": "400" }
];
var sScreenshot, sTitle, sDescription;
function pauseAnimation() {
    clearInterval(tmrSlides);
    tmrSlides = 0;
}
function showSlide(no) {
    if (no == null) {
        if (iSlides >= aSlides.length - 1)
            iSlides = 0;
        else
            iSlides++;
        no = iSlides;
    }
    if (no > -1) {
        iSlides = no;
        $('#lTitle').html(aSlides[no].title);
        $('#lDescription').html(aSlides[no].text);
        $('#divPointer').css("left", aSlides[no].ptr + "px");
        $('#fpBanner_top').css("background-image", "url(" + aSlides[no].img + ")");
        $('#downloads').css("display", "");

        if (no == 0) {
            $('#fpBanner').css("background-image", "url(/App_Images/fpBg2.jpg)");
            $('#fpBanner_top').css("paddingLeft", "30px");
            $('#fpBanner_top').css("width", "920px");
            //$('#ctl00_cphContent_divText').css("background-image", sScreenshot);
            $('#lTitle').html(sTitle);
            $('#lTitle').css("textAlign", "right");
            $('#lTitle').css("width", "415px");
            $('#lDescription').html(sDescription);
            $('#lDescription').css("textAlign", "right");
            $('#lDescription').css("width", "415px");
            $('#lDescription').css("marginTop", "10px");
            $('#datePromo').css("display", "none");
            $('#downloads').css("marginLeft", "105px");
            $('#downloads').css("marginRight", "");
            if ($('#hlDownloadWin') != null)
                $('#hlDownloadWin').css("marginLeft", "auto");
            if ($('#hlDownloadMac1') != null)
                $('#hlDownloadMac1').css("marginLeft", "auto");
        }
        else {
            $('#fpBanner').css("background-image", "url(/App_Images/fpBg1.jpg)");
            $('#fpBanner_top').css("paddingLeft", "270px");
            $('#fpBanner_top').css("width", "680px");
            $('#imgScreenshot').css("visibility", "hidden");
            //$('#ctl00_cphContent_divText').css("background-image", "url()");
            $('#lTitle').css("textAlign", "left");
            $('#lTitle').css("width", "660px");
            $('#lDescription').css("textAlign", "left");
            $('#lDescription').css("width", "660px");
            $('#lDescription').css("marginTop", "20px");
            $('#datePromo').css("display", "");
            if ($('#hlDownloadWin') != null)
                $('#hlDownloadWin').css("marginLeft", "0");
            if ($('#hlDownloadMac1') != null)
                $('#hlDownloadMac1').css("marginLeft", "0");
            $('#downloads').css("marginLeft", "");
            $('#downloads').css("marginRight", "auto");
        }
        if (no == 5) {
            $('#downloads').css("display", "none");
            $('#datePromo').css("display", "none");
        }
    }
    else {
/*    	
        if( tmrSlides == 0 )
           tmrSlides = setInterval("showSlide()", tmrDelaySlides);
*/           
    }
};
$(document).ready(function () {
    //sScreenshot = $('#ctl00_cphContent_divText').css("background-image");
    sTitle = $('#lTitle').html();
    sDescription = $('#lDescription').html();
    // showSlide(-1);
});

/* OS / WP */
var iOsWp = 0;
var tmrDelayOsWp = 5000;
var aOsWp = new Array ( "/App_Images/os.jpg", "/App_Images/wp.jpg" );
function showOsWp() {
    $('#imgOsWp').attr("src", aOsWp[iOsWp]); 
    if (iOsWp == 0) iOsWp = 1; else iOsWp = 0;
};
$(document).ready(function () {
    setInterval("showOsWp()", tmrDelayOsWp);
});

/* FEATURES */
var oFeatures = null;
var aFeatures = [
    { "img": "Features_EverySituation", "title": "收藏了1300多种文档的文库", "text": "商务宝盒是拥有文档模板数目最多的文库，其专业水准无可挑剔" },
    { "img": "Features_HQForms", "title": "专业水准", "text": "文档全部出于律师、顾问和某方面的专家之手，所有的文档都用标准字体和布局进行了格式化，有助于维持专业的企业形象。以后再也不要把您的时间和耐性花在格式化文档上咯！" },
    { "img": "Features_Editors_Office2007", "title": "Microsoft Office / OpenOffice", "text": "使用您最喜爱的办公套件进行编辑。商务宝盒与 Microsoft Office（2010、2007、2003、XP和2000）以及免费的 OpenOffice.org 完全兼容。" },
    { "img": "Features_Search_Office2007", "title": "多重搜索选项", "text": "您可以按类型或类别浏览文档，可以使用与特定任务有关的关键词进行搜索并浏览。" },
    { "img": "Features_Activation_Office2007", "title": "立即激活", "text": "将商务宝盒的全部功能解除锁定快速而简单，在我们的安全的网上商店购买后您将立即收到产品密钥，然后只需将它复制粘贴到软件激活窗口即可完成。" },
    { "img": "Features_Autofill-1", "title": "文档自动填充", "text": "使用文档自动填充功能自动将公司有关信息填入所有相关字段。要求插入自定义信息的字段非常容易查找，并且相关操作指导使得文档操作更为简单。" },
    { "img": "Features_Languages", "title": "8语种可供选择", "text": "中文、英文、法语、西班牙语、葡萄牙语、德语、意大利语以及阿拉伯语八个语言版本的模板可满足您的国际业务需求。与国外伙伴和客户做生意从未如此简单！" },
    { "img": "Features_Application_Office2007", "title": "快速、安全、稳定", "text": "商务宝盒软件得到全世界200万人的信赖，它是一款在Windows和Mac OS两种系统中都能顺利运行的稳定安全的应用程序。我们不断根据用户发来的问题报告对其进行完善，确保每个用户都能从中受益。" },
    { "img": "Features_Autorecovery_Office2007", "title": "自动恢复", "text": "多亏了自动恢复功能，这样您就不会因电脑死机或程序崩溃而丢失工作成果。商务宝盒每隔一分钟就会自动保存您的文档。" },
    { "img": "Features_Updates_Office2007", "title": "定期更新", "text": "您完全可以依赖一款不断更新的产品。我们不断加入新的文档并增加它的特性功能，尽最大努力帮助我们的客户在当今的商业世界中取得成功。" }
];
function showFeatures(obj, no) {
    $('#imgSSTitle').html(aFeatures[no].title);
    $('#imgSSPreview').css("background-image", "url(/App_Images/screenshots/" + aFeatures[no].img + ".jpg)");
    $('#imgSSDescription').html(aFeatures[no].text);
    $(oFeatures).removeClass('selected');
    obj.className = "selected";
    oFeatures = obj;
}
$(document).ready(function () {
    oFeatures = $('#feature1');
});

/* TESTIMONIALS */
var iTestimonials = 0;
var tmrTestimonials = 0;
var tmrDelayTestimonials = 8000;
var aTestimonials = new Array
(
    "十分感谢您对我的需求和问题所提供的不懈帮助和即时关注。您的关注应作为所有在线销售机构的榜样，让他们知道怎样才是正确的做法。<br/><br/><b>Shaun Kelly</b><br/>Chrikaso Pty Ltd.",
    "我认为一个人的成功直接与其在更少的时间里完成更多工作的能力相关。您们的软件使的生产率成倍的提升。它是一个十分有用的产品，我向所有小公司的人们推荐它。<br/><br/><b>Greg Georges</b><br/>OpenPole",
    "新版本看上去好极了 - 其全新的界面和自动填充功能简直太棒了！- 我不久前提出过意见，提到这些功能会使该产品更加出色……现在您们真的做到了这一点。我给出5颗星的评价！<br/><br/><b>Simon Lewis</b><br/>Monty International",
    "我想要告诉您们，我们十分满意多样化的文档组合，它们帮助我们在法律支出方面节约了成千上万欧元并且极大地加快了我们业务中的归档流程。<br/><br/><b>Tonino Roseno</b><br/>CELTUS Financial services",
    "使用该产品时，查找文档十分方便，文档内容很有价值而且格式美观、标准。夫复何求？<br/><br/><b>Jack McCLure</b><br/>SalesConnects"
);
/*
function showTestimonials() {
    if (iTestimonials > aTestimonials.length - 1)
        iTestimonials = 0;
    else if (iTestimonials < 0)
        iTestimonials = aTestimonials.length - 1;
    $('#divTestimonials').html(aTestimonials[iTestimonials]);
    iTestimonials++;
};
$(document).ready(function () {
    tmrTestimonials = setInterval("showTestimonials()", tmrDelayTestimonials);
    $('#btnTestimonialsPrevious').click(function () {
        clearInterval(tmrTestimonials);
        iTestimonials = iTestimonials - 2;
        tmrTestimonials = setInterval("showTestimonials()", tmrDelayTestimonials);
        showTestimonials();
    });
    $('#btnTestimonialsNext').click(function () {
        clearInterval(tmrTestimonials);
        tmrTestimonials = setInterval("showTestimonials()", tmrDelayTestimonials);
        showTestimonials();
    });
});
*/

/// TASKS ///
$(document).ready(function () {
    // $(".tasks").accordion({ active: false }, { clearStyle: true }, { collapsible: true }, { header: '.accordionHeader' });
    $(".accordionHeader a").click(function (event) {
        event.preventDefault();
    });
});

/// SCREENSHOTS ///

$(document).ready(function () {

    // show 'em
    $('.screenshotThumbnail').css("cursor","pointer").click(function () {
        var no = $(this).attr('name');
        $('#pScreenshotDropzone').css("background-image", "url(/App_Images/screenshots/" + no + ".gif)");
        var windowWidth = $(window).width();
        var windowHeight = $(window).height();
        var popupHeight = $("#pScreenshot").height();
        var popupWidth = $("#pScreenshot").width();
        $("#pScreenshot").css({
            "position": "fixed",
            "top": $(window).height() / 2 - popupHeight / 2,
            "left": $(window).width() / 2 - popupWidth / 2
        }).show();
    });

    // hide 'em
    $('#btnClose').click(function () {
        $('#pScreenshotDropzone').css("background-image", "none");
        $("#pScreenshot").hide();
    })

});

/*
var popupStatus = 0;
function showScreenshot(no) {
    if(no > -1) {
        if (popupStatus == 0) {
            $('#pScreenshotDropzone').css("background-image", "url(/App_Images/screenshots/" + no + ".gif)");
            $("#pScreenshot").css({"display": ""});
            var windowWidth = document.documentElement.clientWidth;
            var windowHeight = document.documentElement.clientHeight;
            var popupHeight = $("#pScreenshot").height();
            var popupWidth = $("#pScreenshot").width();
            $("#pScreenshot").css({
                "position": "fixed",
                "top": $(window).height() / 2 - popupHeight / 2,
                "left": $(window).width() / 2 - popupWidth / 2
            });
            popupStatus = 1;
        }
    }
    else {
        $("#pScreenshot").fadeOut("slow");
        popupStatus = 0;
    }
}
*/


