<%--
  Copyright 2003 Sun Microsystems, Inc. All rights reserved 
  Use is subject to license terms.
 --%>
<%-- @(#)rating.jsp --%>

<search:getValue attribute="rd-rating" id="rd_rating"/>
<jx:declare id="rd_rating" type="java.lang.String"/>
<% if (rd_rating == null || rd_rating.equals("")) {
       rd_rating = "0";
   } %>

<search:getValue attribute="rd-num-rating" id="rd_num_rating"/>
<jx:declare id="rd_num_rating" type="java.lang.String"/>
<% if (rd_num_rating == null || rd_num_rating.equals("")) {
       rd_num_rating = "0";
   } %>

<search:getValue attribute="rd-sum-rating" id="rd_sum_rating"/>
<jx:declare id="rd_sum_rating" type="java.lang.String"/>
<% if (rd_sum_rating == null || rd_sum_rating.equals("")) {
       rd_sum_rating = "0";
   } %>

<search:getValue attribute="rd-peak-rating" id="rd_peak_rating"/>
<jx:declare id="rd_peak_rating" type="java.lang.String"/>
<% if (rd_peak_rating == null || rd_peak_rating.equals("")) {
       rd_peak_rating = "0";
   } %>

<%
String curRating = "Not rated";
if (rd_rating.equals("-1")) {
  curRating = "Irrelevant";
} else if (rd_rating.equals("0")) {
  curRating = "Routine";
} else if (rd_rating.equals("1")) {
  curRating = "Interesting";
} else if (rd_rating.equals("2")) {
  curRating = "Important";
} else if (rd_rating.equals("3")) {
  curRating = "Must Read";
}

String selectName = "select"+(new Random().nextInt());
%>

<SELECT id="<%=selectName%>" onChange="rating_submit('<%=rd_database%>', '<%=rd_url%>', '<%=selectName%>', '<%=rd_num_rating%>', '<%=rd_sum_rating%>', '<%=rd_peak_rating%>');">
 <option value="-99" SELECTED>Select rating...</option>
 <option value="-1">Irrelevant</option>
 <option value="0">Routine</option>
 <option value="1">Interesting</option>
 <option value="2">Important</option>
 <option value="3">Must Read</option>
</SELECT> 
<FONT color=#707070 face=<%=tFontFace%> size="-1"><LABEL>&nbsp;Current rating is "<%=curRating%>"</LABEL></FONT>
