<%--
    Document   : search
    Created on : May 28, 2013, 8:16:18 AM
    Author     : Joos Kiener <Joos.Kiener@gmail.com>
--%>

<jsp:include page="/WEB-INF/jsp/header.jsp"/>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<script type="text/javascript" language="javascript" src="<c:url value="/resources/js/jsme/jsme.nocache.js"/>"></script>

<script type="text/javascript">
    $(function() {
        $("#searchForm").submit(function() {
            var smiles = document.JME.smiles();
            document.getElementById('structure').value = smiles;
        });
    });

    function jsmeOnLoad() {
        jsmeApplet = new JSApplet.JSME("structureEditor", {
            //optional parameters
            "options" : "query,hydrogens"
        });
        document.JME = jsmeApplet;
    }

</script>
<!-- Surrounding div required. JSME messes up html...
    Without it the structureEditor div will include the form and the
    editor will be drawn below the search button.
-->
<div>
    <div id="structureEditor"/>
</div>
<form id="searchForm" class="cssform" action="searchResult" method="get">
    <div>
        <label for="searchType">Structure Search Type</label>
        <select id="searchType" name="searchType" size="1">
            <option value="exact">Exact</option>
            <option value="substructure">Substructure</option>
            <option value="tanimoto">Similarity - Tanimoto</option>
        </select>
    </div>
    <div>
        <label for="sortBy">Sort By</label>
        <select id="sortBy" name="sortBy" size="1">
            <option value="compoundName">Compound Name</option>
            <option value="cas">CAS</option>
            <option value="compoundDescription">Compound Description</option>
        </select>
    </div>
    <div>
        <label for="sortDirection">Sort Direction</label>
        <select id="sortDirection" name="sortDirection" size="1">
            <option value="ASC">Ascending</option>
            <option value="DESC">Descending</option>
        </select>
    </div>
    <div>
        <label for="compoundName">Compound Name</label>
        <input type="text" id="compoundName" name="compoundName"/>
    </div>
    <div>
        <label for="cas">CAS</label>
        <input type="text"  id="cas" name="cas"/>
    </div>
    <div>
        <label for="compoundDescription">Description</label>
        <input type="text"  id="compoundDescription" name="compoundDescription"/>
    </div>
    <div><input type="hidden" id="structure" name="structure"></div>
    <div class="buttons"><input id="searchButton" class="submit" type="submit" value="Search"/></div>
</form>
<jsp:include page="/WEB-INF/jsp/footer.jsp"/>
