<%@ page import="static org.b1.common.utils.StringUtils.isNotBlank" %>
<%@ page import="static org.b1.common.utils.StringUtils.isBlank" %>
<%@ page import="java.util.Arrays" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="includes/header-vars.jsp" %>
<%
    /* redirect for old urls */
    if (request.getRequestURI().equals("/download.jsp") && request.getQueryString() == null) {
        response.sendRedirect("/download");
        return;
    }
    if (request.getRequestURI().equals("/download.jsp") && request.getQueryString() != null) {
        if (request.getQueryString().equals("system=Win")) {
            response.sendRedirect("/download-windows");
            return;
        } else if (request.getQueryString().equals("system=Linux")) {
            response.sendRedirect("/download-linux");
            return;
        } else if (request.getQueryString().equals("system=Mac")) {
            response.sendRedirect("/download-mac");
            return;
        } else if (request.getQueryString().equals("system=Android")) {
            response.sendRedirect("/download-android");
            return;
        }
    }

    /* it's a fix for mis-links in b1 v0.4 & 0.5 *
     *  auto-download for win * mac, just redirect for linux coz no idea if it's 32 or 64 */
    if (build_id != null && channel_id != null && request.getParameter("uid") != null) {
        if (Arrays.asList("40", "41", "50", "51").contains(build_id)) {
            response.sendRedirect(WebTools.getDefLinkWin(request, response, false));
            return;
        } else if (Arrays.asList("44", "45", "54", "55").contains(build_id)) {
            response.sendRedirect("/download-linux");
            return;
        } else if (Arrays.asList("42", "52").contains(build_id)) {
            response.sendRedirect(WebTools.getDefLinkMac(request, response, false));
            return;
        }
    }

    /* redirect for old download */
    if (isNotBlank(request.getParameter("buildId"))) {
        if (Arrays.asList("1", "2", "12", "13", "34", "35", "44", "45", "51", "52", "59", "60", "67", "68").contains(build_id)) {
            response.sendRedirect(WebTools.getDefLinkWin(request, response, true));
            return;
        } else if (Arrays.asList("7", "18", "36", "46", "53", "61", "69").contains(build_id)) {
            response.sendRedirect(WebTools.getDefLinkMac(request, response, true));
            return;
        } else if (Arrays.asList("8", "16", "43", "47", "56", "62", "70", "9", "17", "42", "48", "57", "63", "71",
                "14", "37", "49", "54", "65", "72", "15", "38", "50", "55", "66", "73").contains(build_id)) {
            response.sendRedirect("/download-linux");
            return;
        } else if (Arrays.asList("58", "64", "74").contains(build_id)) {
            response.sendRedirect(WebTools.getDefLinkAndroid(request, response, true));
            return;
        } else {
            response.sendRedirect(WebTools.getDefLinkWin(request, response, true));
            return;
        }
    }
%>
<%@ page import="static org.b1.common.utils.StringUtils.isNotBlank" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <% if (os == OperatingSystem.WINDOWS) { %>
    <title>Win archiver. Download B1 free windows archiver. Zip, rar, b1, 7z, unzip, unrar</title>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="Description"
          content="Download free Win archiver. B1 is archive software utility, available for all popular OS. Compression and decompression for Windows. Zip, rar, b1, 7z, unzip">
    <meta name="Keywords"
          content="Win archiver, windows archiver, unzip, zip, file archiver, download, software, utility, unzip, Win, Windows, rar, unrar, b1, 7z, tool">
    <link rel="canonical" href="http://b1.org/download-windows"/>
    <% } else if ((os == OperatingSystem.DEB32) || (os == OperatingSystem.DEB64) || (os == OperatingSystem.BIN32) || (os == OperatingSystem.BIN64)) { %>
    <title>Linux archiver. Download B1 free Linux archiver. Zip, rar, b1, 7z, unzip, unrar</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="Description"
          content="Download free Linux archiver. B1 is archive software utility, available for all popular OS. Compression and decompression for Linux. Zip, rar, b1, 7z, unzip">
    <meta name="Keywords"
          content="Linux archiver, linux, unzip, zip, file archiver, download, software, utility, unzip, rar, unrar, b1, 7z, tool">
    <link rel="canonical" href="http://b1.org/download-linux"/>
    <% } else if (os == OperatingSystem.MAC) { %>
    <title>Mac archiver. Download B1 free Mac OS X archiver. Zip, rar, b1, 7z, unzip, unrar</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="Description"
          content="Download free Mac archiver. B1 is macintosh archive software utility, available for Mac OS X. Compression and decompression for Mac. Zip, rar, b1, 7z, unzip, unrar">
    <meta name="Keywords"
          content="Mac archiver, Mac OS, macintosh, unzip, zip, file archiver, download, software, utility, unzip, rar, unrar, b1, 7z, tool">
    <link rel="canonical" href="http://b1.org/download-mac"/>
    <% } else if (os == OperatingSystem.ANDROID) { %>
    <title>Android archiver. Download B1 free Android archiver. Zip, rar, b1, 7z, unzip, unrar</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="Description"
          content="Download free Android archiver. B1 is archive software utility, available for all popular OS. Compression and decompression for Android. Zip, rar, b1, 7z, unzip">
    <meta name="Keywords"
          content="Android archiver, Android, unzip, zip, file archiver, download, software, utility, unzip, rar, unrar, b1, 7z, tool    <title></title>">
    <link rel="canonical" href="http://b1.org/download-android"/>
    <% } else { %>
    <title>Download B1 Free Archiver. Download zip, rar, b1 archive utility for Windows, Mac, Linux, Android.</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="Description"
          content="Download free file archiver. B1 is archive software utility, available for all popular OS. Compression and decompression for Win, Mac, Linux and Android. Zip, rar, b1, 7z">
    <meta name="Keywords"
          content="download free archiver, free download, free file archiver, archive file, download mac archiver, software, utility, unzip, Win, Windows, Linux, Android, zip, download zip, rar, download rar, b1, 7z">
    <link rel="canonical" href="http://b1.org/download"/>
    <% } %>
    <jsp:include page="/includes/header-include-new.jsp"/>

</head>
<body>
<!--Start wrapper-->
<div class="wrapper">
<div class="wrapper_bg_download">
<jsp:include page="includes/header_page.jsp">
    <jsp:param name="active" value="download"/>
</jsp:include>
<!--Start mainContainer-->
<div class="mainContainer">
<jsp:include page="/includes/socials.jsp"/>

<div class="inner_donw">
    <h1 class="inner_head">B1 Free Archiver download and installation are easy and quick</h1>
    <% if (os == OperatingSystem.MAC) { %>
    <div class="inner_cont_mac notranslate">
        <p class="inner_available">Available for:</p>

        <div class="inner_info">
            <ul>
                <li>Mac OS X 10.9 Mavericks</li>
                <li>Mac OS X 10.8 Mountain Lion</li>
            </ul>
            <ul style="margin: 0;">
                <li>Mac OS X 10.7 Lion</li>
                <li>Mac OS X 10.6 Snow Leopard</li>
            </ul>
        </div>
    </div>
    <% } else if ((os == OperatingSystem.DEB32) || (os == OperatingSystem.DEB64) || (os == OperatingSystem.BIN32) || (os == OperatingSystem.BIN64)) { %>
    <div class="inner_cont_ubt notranslate">
        <p class="inner_available">Available for:</p>

        <div class="inner_info">
            <ul>
                <li>Ubuntu 13.10</li>
                <li>Ubuntu 13.04</li>
            </ul>
            <ul style="margin: 0;">
                <li>Ubuntu 12.10</li>
                <li>Ubuntu 12.04 LTS</li>
            </ul>
        </div>
    </div>
    <% } else if (os == OperatingSystem.ANDROID) { %>
    <div class="inner_cont_and notranslate">
        <p class="inner_available">Available for:</p>

        <div class="inner_info">
            <ul>
                <li>B1 File Manager: Android 2.3.3 and up</li>
                <li>B1 Free Archiver: Android 2.1 and up</li>
            </ul>
        </div>
    </div>
    <% } else { %>
    <div class="inner_cont notranslate">
        <p class="inner_available">Available for:</p>

        <div class="inner_info">
            <ul>
                <li>Windows 8</li>
                <li>Windows 7</li>
            </ul>
            <ul style="margin: 0;">
                <li>Windows Vista</li>
                <li>Windows XP</li>
            </ul>
        </div>
    </div>
    <% } %>
    <div class="clearfix"></div>
</div>
<div class="inner_container p-rel">

    <div class="innerButton" id="btnArea">
        <% if (os == OperatingSystem.MAC) { %>
        <div class="rotator">
            <form action="<%=WebTools.getDefLinkAuto(request, response, false, os, "src=btn_orng")%>">
                <button class="yellow-butt2 yellow-butt-b ">
                    <span class="ico-first ico-m"></span>
                    <span class="span-left">Download B1 Archiver <span>for Mac OS</span></span>
                </button>
            </form>
        </div>
        <% } else if ((os == OperatingSystem.DEB32) || (os == OperatingSystem.DEB64) || (os == OperatingSystem.BIN32) || (os == OperatingSystem.BIN64)) { %>
        <div class="rotator">
            <form action="<%=WebTools.getDefLinkAuto(request, response, false, os, "src=btn_orng")%>">
                <button class="yellow-butt2 yellow-butt-b">
                    <span class="ico-first ico-m"></span>
                    <span class="span-left">Download B1 Archiver <span>for Linux</span></span>
                </button>
            </form>
        </div>
        <% } else if (os == OperatingSystem.ANDROID) { %>
        <div class="rotator">
            <form action="<%=WebTools.getDefLinkAuto(request, response, false, os)%>">
                <button class="yellow-butt2 yellow-butt-b ">
                    <span class="ico-first ico-m"></span>
                    <span class="span-left">Download B1 Archiver <span>for Android</span></span>
                </button>
            </form>
        </div>
        <% } else { %>
        <div class="rotator">
            <form action="<%=WebTools.getDefLinkAuto(request, response, false, os, "src=btn_orng")%>">
                <button class="yellow-butt2 yellow-butt-b ">
                    <span class="ico-first ico-m"></span>
                    <span class="span-left">Download B1 Archiver <span>for Windows</span></span>
                </button>
            </form>
        </div>
        <% } %>
    </div>
    <div class="clearfix"></div>
</div>
<div class="inner_news">
    <div class="news_text">
        <p>What's new in v1.5.86:</p>
    </div>

    <div class="newsBlock">
        <div class="news_corner"></div>
        <ul>
            <li>better file preview</li>
            <li>support for .001-.NNN archives</li>
            <li>numerous bug fixes and improvements</li>
        </ul>
    </div>
</div>
</div>
</div>
<!--End mainContainer-->
<jsp:include page="/includes/google-translate-element.jsp"/>

<!--Start content-->
<div class="content_bg">
    <div class="content">
        <div class="down" id="divide3">
            <a href="#divide3" class="divids smoothscroll"></a>
        </div>
        <div class="clearfix"></div>
        <div class="content_header">
            <div class="content_arhive">
                <p>Download B1 Free Archiver </p>
            </div>
        </div>

        <div class="contentWrapper"><!--Start contentWrapper-->
            <div class="contentBlock">
                <div><a href="#" class="dn_h dn_w"></a></div>
                <p class="dnw_text">Download B1 Free Archiver for Windows</p>

                <p class="abt_content">Available for: Microsoft Windows XP (32 bit),<br/> Windows Vista (32 bit), Windows 7 (32 bit and 64 bit),<br/> Windows 8 (32 bit and 64 bit)
                </p>

                <div class="content_butt">
                    <div class="butt">
                        <a href="<%=WebTools.getDefLinkWin(request, response, false)%>">Windows Installer</a>
                    </div>
                    <div class="butt butt_first ">
                        <a href="<%=WebTools.getDefLinkWin(request, response, false, "standalone=true")%>">Stand-alone<br/><span class="full">(full versions)</span></a>
                    </div>
                </div>
            </div>

            <div class="contentBlock">
                <div><a href="#" class="dn_l"></a></div>
                <p class="dnw_text">Download B1 Free Archiver for MAC OS</p>

                <p class="abt_content">Available for: Mac OS X 10.9 Mavericks, <br/>Mac OS X 10.8 Mountain Lion, Mac OS X 10.7 Lion, <br/>Mac OS X 10.6 Snow Leopard</p>

                <div class="content_butt">
                    <div class="butt butt_first butt-mac">
                        <a href="/download-start/0/os=mac/B1FreeArchiver_1.5.86.dmg">Mac installer (stand-alone)</a>
                    </div>
                </div>
            </div>

            <div class="contentBlock odd">
                <p class="dnw_text text-google">B1 Free Archiver<br/>
                    <span>also available on</span></p>

                <div class="gl-n gl-t"></div>
                <div class="content_butt">
                    <div class="google_play"><a class="gl-n play" href="<%=WebTools.getDefLinkAndroid(request, response, true)%>"> </a></div>
                </div>
            </div>

            <div class="contentBlock">
                <div><a href="#" class="dn_h dn_u"></a></div>
                <p class="dnw_text">Download B1 Free Archiver for Ubuntu</p>

                <p class="abt_sec">Available for: Ubuntu 12.04 LTS, Ubuntu 12.10,<br/> Ubuntu 13.04, Ubuntu 13.10</p>

                <div class="content_butt">
                    <div class="butt">
                        <a href="/download-start/0/os=deb32/b1freearchiver_current_stable_i386.deb">Ubuntu Linux 32 bit</a>
                    </div>
                    <div class="butt">
                        <a href="/download-start/0/os=deb64/b1freearchiver_current_stable_amd64.deb">Ubuntu Linux 64 bit</a>
                    </div>
                </div>
            </div>

            <div class="contentBlock">
                <div><a href="#" class="dn_h dn_f"></a></div>
                <p class="dnw_text">Download B1 Free Archiver for Fedora</p>

                <p class="abt_content abt_third">Available for: Fedora 18 and up</p>

                <div class="content_butt">
                    <div class="butt">
                        <a href="/download-start/0/os=bin32/b1freearchiver_current_stable_raw_i386.tar.gz">Linux 32 bit</a>
                    </div>
                    <div class="butt">
                        <a href="/download-start/0/os=bin64/b1freearchiver_current_stable_raw_amd64.tar.gz">Linux 64 bit</a>
                    </div>
                </div>
            </div>

            <div class="contentBlock contentBlock-mac odd">
                <div class="gl-n gl-a"></div>
                <p>Comming soon...</p>

                <div><a href="javascript:alert('Comming soon...');return false;" class="gl-n gl-app"></a></div>
            </div>
            <div class="clearfix"></div>
        </div>
        <!--End content_wrapper-->
    </div>
    <div class="inner_bottom"></div>
</div>
<!--End content_bg-->
<jsp:include page="includes/footer_page.jsp">
    <jsp:param name="active" value="download"/>
</jsp:include>
</div>
<!--End wrapper-->
</body>
</html>
