<%-- $Id: addCVFooter.jsp,v 1.8.2.1 2004/05/13 13:05:03 asivakumar Exp $ --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

<script language="javascript">
function previewResults()
{
                search();
                document.searchForm.method.value = "search";
}
function addCV()
{
    if(validateInputs() && validateSearch())
        {
            document.searchForm.method.value = "create";
            document.searchForm.submit();
        return true;
        }
    else
        {
            return false;
        }

}

function validateSearch()
{
   var numrows = parseInt(document.searchForm.rows.value);
    for(ci=0;ci<numrows;ci++)
    {
        criteriaValues = document.searchForm.elements["searchForm["+ci+"].criteriaValues"];
        var values = criteriaValues.value;
        if(trimAll(values) == "")
        {
            alert("<fmt:message key='webclient.common.fields.validation.empty'/>");
            return false;
        }
    }
    changeNames();
    document.searchForm.method.value = "search";
return true;
 }

function modifyCV()
{
    if(validateInputs() && validateSearch())
        {
            document.searchForm.method.value = "modify";
            document.searchForm.submit();
        return true;
        }
    else
        {
            return false;
        }
}

function validateInputs()
{
        var value = document.searchForm.cvName.value;
        if(trimAll(value) == "")
        {
            alert("<fmt:message key='webclient.topo.cv.cvname.validation.empty'/>");
            return false;
        }
        return true;
}

</script>

<tr > 
    <td align="left" valign="top"> <table width="596" border="0" cellspacing="0" cellpadding="6">
        <tr> 
          <td width="137" height="40" align="left"> 
<c:choose>
<c:when test ='${searchForm.map.actionToPerform == "create"}'>
 <input name="customview322" type="button" class="button" id="customview322" onClick="addCV()" value='<fmt:message key='webclient.topo.addcv.button'/>'> 
</c:when>
<c:when test ='${searchForm.map.actionToPerform == "modify"}'>
 <input name="customview322" type="button" class="button" id="customview322" onClick="modifyCV()" value='<fmt:message key='webclient.topo.modifycv.button'/>'> 
</c:when>
</c:choose>
         </td>
          <td width="427" align="left"><input name="preview" type="button" class="button" id="preview" onClick="previewResults()" value='<fmt:message key='webclient.topo.preview.button'/>'></td>
        </tr>
      </table></td>
  </tr>

<c:if test ='${param.method == "search"}'>
<c:choose>
<c:when test ='${! empty viewData}'>
<tr class="header1Bg"> 
<table width="100%" cellSpacing=0>    
<tr class="header1Bg">
<td height="30"><span class="header1"><fmt:message key='webclient.topo.preview.header'/></span></td>
<td class="text" align="right"> <fmt:message key='webclient.topo.preview.count'><fmt:param value="${RECORDS}"/></fmt:message></td>
</tr>
</table>
</tr>

  <tr > 
    <td align="left" valign="top" class="propertyHeader">
              <%@include file = "/webclient/topo/jsp/inventoryList.jsp" %>
    </td>
  </tr>
</c:when>
<c:otherwise>
<tr > 
    <td height="10" class="header1Bg"> <br></td>
</tr>
<tr class="header1Bg"> 
    <td height="30" class="header1Bg" align=center><span class="text"><fmt:message key='webclient.topo.preview.noresult'/> </span></td>
</tr>

</c:otherwise>
</c:choose>

</c:if>
