<%@ page import="java.io.*" %>
<%@ page import="java.util.Properties" %>


<%!
  String propfile;

  String name;
  String email;
  Properties p;
  InputStream str;
  ServletContext ctx;
%>

<%
  propfile="/auction/auction";
  p=new Properties();
  ctx=getServletContext();
  name=request.getParameter("UName");
  email=request.getParameter("Email");
  
  if (name==null || name.equals("") || email==null || email.equals("")) {
%>
    <jsp:forward page="index.jsp" >
     <jsp:param name="err" value="Please enter a valid name and e-mail address."/>
    </jsp:forward>
    
<%    
    }
  propfile=propfile + request.getParameter("ANO") + ".properties";
  str=ctx.getResourceAsStream(propfile);
  if (str==null)
    out.println("Internal server error:" + propfile );
  else
    {
    p.load(str);
    str.close();
    }


%>
<HTML>
<HEAD><TITLE>Live auction</TITLE></HEAD>
<BODY BGCOLOR=WHITE>
<H1>
 <%= p.getProperty("Short") %>
</H1>
<P ALIGN=CENTER><IMG SRC=<%= p.getProperty("IMG") %>></P>
<P><FONT SIZE=+1>
<%  
   String desc;
   desc=p.getProperty("Description"); 
   if (desc.charAt(0)=='/')
     {
     int c;
     InputStream is=ctx.getResourceAsStream(desc);
     try
      {
      while ((c=is.read())!=-1) {
        out.print((char)c);
        }
      }
      catch (Exception e) { }
      }
   else
     out.println(desc);
%>
<HR>
<P>Starting bid: $<%= p.getProperty("StartBid"); %>
</P>
<!-- start bidding applet -->
<APPLET code=AuctionApplet.class Width=640 Height=50>
<PARAM name=port Value=<%= p.getProperty("port") %>>
<PARAM name=bgcolor value=FFFFFF>
<PARAM name=ID value='<%= email %>'>
<PARAM name=StartBid value='<%= p.getProperty("StartBid"); %>'>
</APPLET>
</BODY>
</HTML>
