<%-- 
    Document   : importCssJs
    Created on : Nov 15, 2015, 5:48:40 PM
    Author     : khanhdn1
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib uri="http://ajaxtags.org/tags/ajax" prefix="ajax" %>
<%@ taglib tagdir="/WEB-INF/tags/common/" prefix="tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<!--Import CSS File-->
<link href="<html:rewrite page='/share/datepicker/css/datepicker.css'/>" rel="stylesheet">
<link href="<html:rewrite page='/share/bootstrap/css/bootstrap.css'/>" rel="stylesheet">
<link href="<html:rewrite page='/share/bootstrap/css/bootstrap-theme.css'/>" rel="stylesheet">
<link href="<html:rewrite page='/share/css/vpn-home-style.css'/>" rel="stylesheet">


<!--Import JS File-->

<script type="text/javascript"  src="<html:rewrite page='/share/js/jquery.min.js'/>"></script>
<script type="text/javascript"  src="<html:rewrite page='/share/js/jquery.fileDownload.js'/>"></script>
<script type="text/javascript"  src="<html:rewrite page='/share/bootstrap/js/bootstrap.js'/>"></script>
<script type="text/javascript"  src="<html:rewrite page='/share/datepicker/js/bootstrap-datepicker.js'/>"></script>



<!--Ajax JS File-->
<script type="text/javascript"  src="<html:rewrite page='/share/js/scriptaculous/prototype.js'/>"></script>
<script type="text/javascript"  src="<html:rewrite page='/share/js/scriptaculous/scriptaculous.js'/>"></script>
<script type="text/javascript"  src="<html:rewrite page='/share/js/ajax/ajaxtags.js'/>"></script>
<script type="text/javascript"  src="<html:rewrite page='/share/js/ajax/ajaxtags_controls.js'/>"></script>
<script type="text/javascript"  src="<html:rewrite page='/share/js/ajax/ajaxtags_parser.js'/>"></script>
<script type="text/javascript"  src="<html:rewrite page='/share/js/ajax/Ajax.js'/>"></script>



<script language="javascript">
    function setTokenToForm(id_Token) {
        var areaId = "token";
        var actionUrl = "<%=request.getContextPath()%><%=utils.ResourceBundleUtils.getApplicationResource("get.token.url")%>";
        new Ajax.Updater(areaId, actionUrl, {
            asynchronous: false
        });
        var te = document.getElementById("tokenParam");
        if (te != null) {
            document.getElementById(id_Token).value = te.value;
        } else {
            document.getElementById(id_Token).value = "";
        }
    }


    function getNewTokenString() {
        var areaId = "token";
        var actionUrl = "<%=request.getContextPath()%><%=utils.ResourceBundleUtils.getApplicationResource("get.token.url")%>";
        new Ajax.Updater(areaId, actionUrl, {
            asynchronous: false
        });
        var te = document.getElementById("tokenParam");
        if (te != null) {
            return te.name + "=" + te.value;
        }
        return "";
    }

    function showErrorMessage(messageDivId, messageError1, messageError2) {
        if (messageDivId == null || messageDivId == undefined || messageDivId == "") {
            return;
        }
        if (messageError1 == undefined) {
            messageError1 = "";
        }
        if (messageError2 == undefined) {
            messageError2 = "";
        }
        if (messageError2 != "") {
            if (messageError1 != "") {
                messageError1 += ";" + messageError2;
            } else {
                messageError1 = messageError2;
            }
        }
        var messageArray = messageError1.split(";");
//        var messageError1 = messageArray.join("<br/>");
        var messageError1 = messageArray[0];
        if (messageError1 != "") {
            jQuery("#" + messageDivId).show();
            document.getElementById(messageDivId).innerHTML = messageError1;
        } else {
            jQuery("#" + messageDivId).hide();
        }
    }

    <logic:present name="<%=String.valueOf(utils.ConstantVariant.SYSTEM_MESSAGE_ALERT)%>" scope="request">
    jQuery(document).ready(function () {
        showMessage("<bean:write name="<%=String.valueOf(utils.ConstantVariant.SYSTEM_MESSAGE_ALERT)%>" scope="request" />");
    });
    </logic:present>

    function styleResultSearchTable() {
        jQuery(".resultSearch .table-bordered thead tr").addClass("success");
        jQuery(".resultSearch .table-bordered tr.odd").addClass("active");
        jQuery(".resultSearch .table-bordered tr.even").addClass("info");
    }

</script>