import java.io.*;
import java.util.*;
import java.sql.*;

public class BidPageGen{
    // private QueryEngine qe;
    
    //   BidPageGen(){
    //bqh=new BidQueryHandler();
    //}


    public String makeProductDetailsPage(ResultSet rs,int firstBid){
	String Page=null;
	/*
	  
	  Here is the scheme:
	  If first Bid then 0 else 1
	  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	  now call bqh.getProductDetails()
	  It returns a vector with all it's elements as vector again
	  these index vector has first element as column name
	  next elements are the values for this column 
	  same as resultset
	*/
	/*
	  I think in this case first element need not contain name of column 
	  as we will return the result in a specific order -I mean 1st 
	  element will be Curret Bid then Time left(follow bazee)
	*/
	try{
	    System.out.println("-------------++++++++");
	    ResultSetMetaData rsmd=rs.getMetaData();
	    int CBV=0;
	    //int daysleft,hrsleft,minleft,stprice;
	    String location;
	    int AID,stprice;
	    String startdate=null,closingdate=null;
	    //int stday,sthrs,styear,stmonth,stmin,stsec;
	    //int lsday,lshrs,lsyear,lsmonth,lsmin,lssec;
	    int bidIncrement;
	    Page=null;
	    //Vector productDetails = bqh.getProductDetails();
	    //rs.next();
	    System.out.println("-------------++++++++");
		
	    location=rs.getString("location");
	    System.out.println("-------------++++++++after first usage");
	    AID=rs.getInt("auctionId");
	    
	    bidIncrement=rs.getInt("minIncrement");
	    startdate=rs.getString("startDate");
	    closingdate=rs.getString("closingDate");
	    System.out.println("-------------++++++++after first usage");
	    stprice=rs.getInt("thresholdPrice");
	    System.out.println(location+AID+bidIncrement+stprice+startdate);
	    Page="<html>";
	    Page += "<body bgcolor=\"white\">";
	    //out.println(Page);
	    //ProdHtmlGen.linksToPages(out);
	    //Page="";
	    Page+="<table cellspacing=1 cellpadding=3 border=0 width=\"370\" bgcolor=\"#CCCCCC\">";
	    Page+="<tr bgcolor=\"#CCCCFF\"><td height=\"25\" align=left colspan=2 class=\"cathead\">";
	    
	    Page+="&nbsp;Auction Details</td></tr>";
	    Page+="<tr bgcolor=\"#EFEFEF\"><td width=\"50%\" align=left class=\"details\">Current Bid Value</td>";
	    if(firstBid==1){
		System.out.println(rsmd.getColumnName(3));
		CBV=rs.getInt("bidValue");
		Page+="<td width=\"50%\" align=left  class=\"details\"><b>"+CBV+"</b></td></tr>";
	    }
	    else {
		//CBV=rs.getInt("bidValue");
		System.out.println("******"+rsmd.getColumnName(3)+CBV);
		Page+="<td width=\"50%\" align=left  class=\"details\"><b>"+"No Bid done" +"</b></td></tr>";
	    }
	    //Page+="<tr bgcolor=\"#EFEFEF\"><td width=\"50%\" align=left class=\"details\">Time Left</td>";
	    //Page+="<td width=\"50%\" align=left class=\"details\">1 days 9 hours 47 mins </td></tr>";
	    //Page+="<tr bgcolor=\"#EFEFEF\"><td width=\"50%\" align=left class=\"details\" >Quantity</td>";
	    //Page+="<td width=\"50%\" align=left  class=\"details\"><b>1</b></td></tr>";
	    Page+="<tr bgcolor=\"#EFEFEF\"><td width=\"50%\" align=left class=\"details\">Starting Price</font></td>";
	    Page+="<td width=\"50%\" align=left class=\"details\">"+stprice+"</td></tr>";
	    Page+="<tr bgcolor=\"#EFEFEF\"><td width=\"50%\" align=left  class=\"details\">Bid Increment</font></td>";
	    Page+="<td width=\"50%\" align=left  class=\"details\" >"+bidIncrement+"</font></td></tr>";
	    Page+="<tr bgcolor=\"#EFEFEF\"><td width=\"50%\" align=left class=\"details\">Location</td>";
	    Page+="<td width=\"50%\" align=left class=\"details\">"+location+"&nbsp;</td></tr>";
	    //Page+="<tr bgcolor=\"#EFEFEF\"><td width=\"50%\" align=left class=\"details\">AuctionType</font></td>";
	    //Page+="<td width=\"50%\" align=left  class=\"details\">Normal</font></td></tr>";
	    Page+="<tr bgcolor=\"#EFEFEF\"><td width=\"50%\" align=left class=\"details\">Starting time</td>";
	    Page+="<td width=\"50%\" align=left class=\"details\">"+startdate+"</font></td></tr>";
	    Page+="<tr bgcolor=\"#EFEFEF\"><td width=\"50%\" align=left class=\"details\">Closing time</td>";
	    Page+="<td width=\"50%\" align=left class=\"details\"><b>"+closingdate+"</b></td></tr>";
	    Page+="<tr bgcolor=\"#EFEFEF\"><td width=\"50%\" align=left class=\"details\">Auction Id</td>";
	    Page+="<td width=\"50%\" align=left class=\"details\">"+AID+"</td></tr>";
	    Page+="<tr bgcolor=\"#EFEFEF\"><td width=\"50%\" align=left class=\"details\">Current Winning Bidder</td>";
	    Page+="<td width=\"50%\" align=left class=\"details\"><b>NO CURRENT WINNER EXISTS</b></td></tr>";
	    Page+="<tr bgcolor=\"#EFEFEF\"><td align=center colspan=2 class=\"cathead\">";
	    //Page+="<a href=\"#bid_now\"><img vspace=3 src=\"images/bid_now.gif\" border=0></a></td></tr>";
	    Page+="</td></tr></table>";
		Page += "</body>";
	    Page+="</html>";
	}catch(SQLException sqle){
            System.out.println("Exception from page generator" + sqle);
	}    
	 System.out.println(Page);
	    return Page;
	
    }
    
    public String makeBidFormPage(ResultSet rs){
	String Page=null;
	try{
	    Page=null;
	    ResultSetMetaData rsmd=rs.getMetaData();
	    int cid=0,mininc,autoinc;
	    String addr;
	    addr=Configure.SERVLET_SERVER+":"+Configure.SERVLET_PORT+"/"+Configure.SERVLET_PATH;
	    cid=rs.getInt(1);
	    mininc=cid+rs.getInt(2);
	    autoinc=cid+(2*rs.getInt(2));
	    Page="<html>";
		Page += "<body bgcolor=\"white\">";
	    Page+="<table width=760 border=\"0\" bgcolor=\"#ffffff\"><tr border=\"0\"><td bgcolor=\"FFFFFF\" border=\"0\">";
	     Page+="<form name=form1 method=post action=\""+addr+"/BidServlet\" onSubmit=\"return verify()\"";
	    
	     // Page+="<form name=form1 method=post action=\"http://144.16.111.4:5015/servlet/BidServlet\" onClick=verify()";


	    Page+="<table bgcolor=\"#FFFFFF\" cellspacing=0 cellpadding=0 border=0 width=\"760\">";
	    Page+="<table cellspacing=1 cellpadding=2 border=0 width=\"100%\">";
	    Page+="<tr bgcolor=\"#CCCCFF\"><td align=left height=\"25\" colspan=2 ><b><font face=Arial size=2 color=\"#000000\"><a name=\"bid_now\">&nbsp;Bidding Details</a></font></b></td></tr>";
	    Page+="<tr bgcolor=\"#FFFFFF\"><td align=left colspan=2 height=\"25\"><b><font face=Arial size=2 color=\"#000000\" > &nbsp;<b>Please note that you are bound to honour your bid. Failure to do so will lead to your User id being suspended</b></font></b></td></tr>";
	    Page+="<tr bgcolor=\"#CCCCFF\"><td align=left width=\"262\"><font face=Arial size=2 color=\"#000000\" >Place a Bid </font></td></tr>";
	    Page+="<tr bgcolor=\"#E2E0D8\"><td width=\"262\" align=left >";
	    Page+="<table cellspacing=0 cellpadding=0 border=0 width=\"100%\"><tr><td width=\"50%\">";
	    Page+="<font face=Arial size=2 color=\"#000000\" >User ID :</td><td width=\"50%\" align=\"center\"> <input type=text name=username value=\"\" size=10 onBlur=\"document.form1.password.focus()\"></font></td></tr></table></td>";
	    Page+="</tr>";
	    Page+="<tr bgcolor=\"#E2E0D8\"><td width=\"262\" align=left >";
	    Page+="<table cellspacing=0 cellpadding=0 border=0 width=\"100%\"><tr><td width=\"50%\">";
	    Page+="<font face=Arial size=2 color=\"#000000\" >Password  :</td><td width=\"50%\" align=\"center\"><input type=password name=password size=10 ></font></td></tr></table></td>";
	    Page+="</tr>";
	    Page+="<tr bgcolor=\"#E2E0D8\"><td width=\"262\" align=left >";
	    Page+="<table cellspacing=0 cellpadding=0 border=0 width=\"100%\"><tr><td width=\"50%\">";
	    Page+="<input type=hidden name=quantity value=12 >";
	    Page+="<font face=Arial size=2 color=\"#000000\" >Enter Your Bid :</td><td width=\"50%\" align=\"center\"><input type=text name=\"bidprice\" value="+mininc+" size=10 ></font></td></tr></table></td></tr>";
	    Page+="";
	    Page+="<tr bgcolor=\"#E2E0D8\"><td width=\"262\" align=left >";
	    Page+="<table cellspacing=0 cellpadding=0 border=0 width=\"100%\"><tr><td width=\"50%\">";
	    Page+="<font face=Arial size=2 color=\"#000000\" >Auto Bid:</td><td width=\"50%\" align=\"center\"><input type=radio name=autobidbutton value=1>Yes <input type=radio name=autobidbutton value=0 checked> No</font></td></tr></table></td>";
	    Page+="<tr bgcolor=\"#E2E0D8\"><td width=\"262\" align=left >";
	    Page+="<table cellspacing=0 cellpadding=0 border=0 width=\"100%\"><tr><td width=\"50%\">";
	    Page+="<font face=Arial size=2 color=\"#000000\" >Maximum bid:</td><td width=\"50%\" align=\"center\"><input type=text name=\"maxbid\" size=10 > </font></td></tr></table></td>";
	    Page+="<td width=\"350\" align=left ><font face=Arial size=2 color=\"#000000\">If using Auto Bid, enter the max amount you would like to pay for this product.</font></td></tr>";
	    //Page+="<input type=hidden name=maxbid value=0>"; 
	    Page+="<input type=hidden name=bid_increment value=0>"; 
	    Page+="<input type=hidden name=auctionid value=565253>";
	    Page+="<input type=hidden name=auctiontype value=dutchnormal>";
	    Page+="<input type=hidden name=city value=72>";
	    Page+="<input type=hidden name=currentbidvalue value=12000>";
	    Page+="<input type=hidden name=minbidincrement value=500>";
	    Page+="<input type=hidden name=sellerid value=1324076>";
	    Page+="<input type=hidden name=startprice value=\"12000\">";
	    Page+="<input type=hidden name=\"dateString\" value=\"Thu Oct 11 17:48:00 GMT+05:30 2001\">";
	    Page+="<input type=hidden name=catid value=\"1549\">";
	    Page+="<tr bgcolor=\"#CCCCFF\"><td align=center height=\"30\" colspan=2 class=\"cathead\">";
	    Page+="<input type=\"Image\" src=\"images/preview_bid.gif\" name=\"preview\" border=\"0\" value=\"Preview\"></a></td></tr>";
	    // Page+="<input type=\"submit\" name=\"preview\" border=\"0\" value=\"Preview\"></a></td></tr>";
	    //	    Page+="<input type=\"button\" Name=\"submit\" Value=\"submit\" onclick=\"verify()\"></a></td></tr>";
	    Page+="</form></table>";
	    Page+="</table>\n";
	    Page+="<script language=\"JavaScript\">\n";
	    Page+="\n";
	    Page+="var thenumbid = ''\n";
	    Page+="var thenummax = ''\n";
	    Page+="var maxbidvalue = ''\n";
	    Page+="var bidpricevalue = ''\n";
	    Page+="function verify(){\n";
	    Page+="if(document.form1.username){\n";
	    Page+="if(document.form1.username.value==''){\n";
	    Page+="alert('Please enter User Id')\n";
	    Page+="document.form1.username.focus()\n";
	    Page+="return false\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="if(document.form1.password){\n";
	    Page+="if(document.form1.password.value==''){\n";
	    Page+="alert('Please enter Password')\n";
	    Page+="document.form1.password.focus()\n";
	    Page+="return false\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="if(document.form1.bidprice){\n";
	    Page+="if(document.form1.bidprice.value==''){\n";
	    Page+="alert('Please enter Bidprice')\n";
	    Page+="document.form1.bidprice.focus()\n";
	    Page+="return false\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="if(document.form1.bidprice){\n";
	    Page+="thenumbid = parseInt(document.form1.bidprice.value)\n";
	    Page+="if(document.form1.bidprice.value !=''+thenumbid){\n";
	    Page+="alert('Please enter a numeric value for Bidprice.')\n";
	    Page+="document.form1.bidprice.select()\n";
	    Page+="return false\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="if(document.form1.quantitybid){\n";
	    Page+="if(document.form1.quantitybid.value==0){\n";
	    Page+="alert('Please enter value greater than zero')\n";
	    Page+="document.form1.quantitybid.select()\n";
	    Page+="return false\n";
	    Page+="}\n";
	    Page+="theqtybid = parseInt(document.form1.quantitybid.value)\n";
	    Page+="if(document.form1.quantitybid.value !=''+theqtybid){\n";
	    Page+="alert('Please enter a numeric value for Quantity.')\n";
	    Page+="document.form1.quantitybid.select()\n";
	    Page+="return false\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="if(document.form1.maxbid){\n";
	    Page+="if(document.form1.maxbid.value !=''){\n";
	    Page+="thenummax = parseInt(document.form1.maxbid.value)\n";
	    Page+="if(document.form1.maxbid.value !=''+thenummax){\n";
	    Page+="alert('Please enter a numeric value for Maxprice.')\n";
	    Page+="document.form1.maxbid.select()\n";
	    Page+="if(document.form1.autobidbutton)\n";
	    Page+="\n";
	    Page+="return false\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="if(document.form1.bidprice){\n";
	    Page+="if(document.form1.bidprice.value < "+mininc+"){\n";
	    Page+="alert('Please enter a bid value greater than or equal to "+mininc+" ');\n";
	    Page+="return false;\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="if(document.form1.autobidbutton){\n";
	    Page+="if(document.form1.elements[parseInt(document.form1.elements.length)-13].checked==true){\n";
	    Page+="if(document.form1.maxbid.value==''){\n";
	    Page+="alert('You should enter a maxprice if you have chosen Autobid yes');\n";
	    Page+="document.form1.maxbid.focus();\n";
	    Page+="return false;\n";
	    Page+="}\n";
	    Page+="if(document.form1.maxbid.value < "+autoinc+"){\n";
	    Page+="alert('Please enter a maximum bid value greater than or equal to "+autoinc+" ');\n";
	    Page+="document.form1.maxbid.select()\n";
	    Page+="return false;\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="if((document.form1.maxbid)&&(document.form1.bidprice)) {\n";
	    Page+="maxbidvalue=parseInt(document.form1.maxbid.value)\n";
	    Page+=";bidpricevalue=parseInt(document.form1.bidprice.value)\n";
	    Page+="if(maxbidvalue <= bidpricevalue){;\n";
	    Page+="alert('MaxPrice Should be  greater than BidPrice')\n";
	    Page+="document.form1.maxbid.select();\n";
	    Page+="return false;\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="if(document.form1.elements[parseInt(document.form1.elements.length)-12].checked==true){\n";
	    Page+="if(document.form1.maxbid.value!=''){\n";
	    Page+="alert('You should choose autobid option in order to enter a maxprice');\n";
	    Page+="document.form1.maxbid.focus();\n";
	    Page+="return false;\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="if(document.form1.quantitybid){\n";
	    Page+="if(document.form1.quantitybid.value >12){\n";
	    Page+="alert('The entered value is more than the total quantity of product i.e '+12);\n";
	    Page+="document.form1.quantitybid.select();\n";
	    Page+="return false;\n";
	    Page+="}\n";
	    Page+="}\n";
	    Page+="\n";
	    Page+="\n";
	    Page+="}\n";
	    Page+="</script>\n";
		Page += "</body>";
	    Page+="</html>\n";
	}catch(SQLException sqle){
            System.out.println("Exception from makeBidFormpage " + sqle);
	}
	    return Page;
    }

    public String makeBidDetailsPage(ResultSet rs){
	String Page=null;
	try{
	    Page=null;
	    ResultSetMetaData rsmd=rs.getMetaData();
	    int auctionId=rs.getInt("auctionId");
	    String addr;
	    addr=Configure.SERVLET_SERVER+":"+Configure.SERVLET_PORT+"/"+Configure.SERVLET_PATH;
	    Page="<html>";
	    Page += "<body bgcolor=\"white\">";
	    Page+="<table width=760 border=\"0\" bgcolor=\"#ffffff\"><tr><td bgcolor=\"FFFFFF\">";
	    Page+="<table width=\"760\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#CCCCFF\">";
	    Page+="<tr bgcolor=\"#CCCCFF\">";
	    Page+="<td class=\"cathead\" height=\"20\">&nbsp;<a name=\"desc\">Product Details</a></td>";
	    Page+="</tr>";
	    Page+="<tr bgcolor=\"#FFFFFF\">";
	    Page+="<td class=\"cathead\" height=\"20\">&nbsp;</td>";
	    Page+="</tr>";
	    Page+="<tr>";
	    Page+="<td>";
	    Page+="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#CCCCFF\">";
	    Page+="<tr>";
	    Page+="<td height=\"25\" class=\"desc\" width=\"32%\" valign=\"bottom\" bgcolor=\"#CCCCFF\">";
	    Page+="<a href=\""+addr+"/ItemInfoServlet?auctionId="+auctionId+"\">&nbsp;Item Information</a></td>";
	    // Page+="<td width=\"16\" bgcolor=\"#FFFFFF\" valign=\"bottom\"><img src=\"../images/corner_yellow.gif\" ></td>";
	      Page+="<td width=\"16\" bgcolor=\"#FFFFFF\" valign=\"bottom\"></td>";

	      // Page+="<td width=\"10\" bgcolor=\"#FFFFFF\"><img src=\"../images/spacer.gif\" width=\"13\" height=\"1\"></td>";
	      Page+="<td width=\"10\" bgcolor=\"#FFFFFF\"></td>";

	    Page+="<td height=\"25\" class=\"desc\" width=\"32%\" valign=\"bottom\" bgcolor=\"#CCCCFF\">";
	    Page+="<a href=\""+addr+"/BidInfoServlet?auctionId="+auctionId+"\">&nbsp;Bid History</a></td>";
	    //   Page+="<td width=\"16\" valign=\"bottom\" bgcolor=\"#FFFFFF\"><img src=\"../images/corner_grey.gif\" ></td>";
	    Page+="<td width=\"16\" valign=\"bottom\" bgcolor=\"#FFFFFF\"></td>";
	    //	    Page+="<td width=\"10\" bgcolor=\"#FFFFFF\"><img src=\"../images/spacer.gif\" width=\"13\" height=\"1\"></td>";
	      Page+="<td width=\"10\" bgcolor=\"#FFFFFF\"></td>";

	    Page+="<td height=\"25\" class=\"desc\" width=\"32%\" valign=\"bottom\" bgcolor=\"#CCCCFF\">";
	    Page+="<a href=\""+Config.htmlUrl+"tut.htm\">&nbsp;Question Answer</a></td>";
	    //   Page+="<td width=\"16\" valign=\"bottom\" bgcolor=\"#FFFFFF\"><img src=\"../images/corner_grey.gif\" ></td>";
	       Page+="<td width=\"16\" valign=\"bottom\" bgcolor=\"#FFFFFF\"></td>";
	    
	    
	    Page+="</tr>";
	    Page+="</table>";
	    Page+="</td>";
	    Page+="</tr>";
	    Page+="</table>";
	    Page+="<tr>";
	    Page+="<td>";
	    Page+="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#CCCCFF\">";
	    Page+="<tr>";
	    
	    // Page+="<td rowspan=\"2\" width=\"5\"><img src=\"../images/spacer.gif\" width=\"6\" height=\"1\"></td>";

	    Page+="<td rowspan=\"2\" width=\"5\"></td>";

	    Page+="<td bgcolor=\"#CCCCFF\">&nbsp;</td>";
	    
	    // Page+="<td rowspan=\"2\" width=\"5\"><img src=\"../images/spacer.gif\" width=\"6\" height=\"1\"></td>";
	    
	    Page+="<td rowspan=\"2\" width=\"5\"></td>";

	    Page+="</tr>";
	    Page+="<tr>";
	    //     Page+="<td width=\"5\"><img src=\"../images/spacer.gif\" width=\"6\" height=\"5\"></td>";

	        Page+="<td width=\"5\"></td>";


	    Page+="</tr>";
	    Page+="<tr bgcolor=\"#CCCCFF\">";
	    Page+="<td width=\"5\">&nbsp;</td>";
	    Page+="<td>";
	    Page+="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"100%\" bgcolor=\"#CCCCCC\">";
	    Page+="<tr><td>";
	    Page+="<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" height=\"100%\">";
	    // 	    Page+="<tr><td bgcolor=\"#FFFFFF\" width=\"100%\" align=\"center\" class=\"disclaimer\"><br><img src=./../images/products0801/MK5819011026AM.bmp border=0><br>&nbsp;</td></tr>";

	    	    Page+="<tr><td bgcolor=\"#FFFFFF\" width=\"100%\" align=\"center\" class=\"disclaimer\"><br><br>&nbsp;</td></tr>";

	    Page+="</table>";
	    Page+="</td>";
	    Page+="</tr>";
	    Page+="</table>";
	    //	    Page+="<td width=\"5\"><img src=\"../images/spacer.gif\" width=\"5\" height=\"1\"></td>";
	    Page+="<td width=\"5\"></td>";
	    Page+="</tr>";
	    Page+="</table>";
	    Page+="</td>";
	    Page+="</tr>";
	    Page+="<tr bgcolor=\"#CCCCFF\">";
	    //	    Page+="<td><img src=\"../images/spacer.gif\" width=\"1\" height=\"6\"></td>";
	    Page+="<td></td>";
	    Page+="</tr>";
	    Page+="</table>";
	    Page+="</td></tr>";
	    Page+="</table>";
	    Page+="</td></tr></table>";
	    Page+="        ";
	    Page+="";
	    Page+="";
	    Page+="";
	    Page+="";
	    Page+="";
	    Page+="";
		Page += "</body>";
	    Page+="</html>";


	}catch(SQLException sqle){
            System.out.println("Exception from makeBidFormpage " + sqle);
	}
	return Page;
    }    

    
    public String makeBidHistoryPage(ResultSet rs){
	String Page=null;
	try{
	    Page=null;
	    ResultSetMetaData rsmd=rs.getMetaData();
	    
	    Page = "<HTML><body bgcolor=\"white\">";
	    Page +="<P>";
	    Page+="<TABLE border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
	    Page+="<TR>";
	    Page+="<TD width=\"100%\"><A name=\"bids\"></A><FONT color=\"blue\" size=\"2\" face=\"{$FontFace}\"><B>Bidding History (Ascending Order) </B></FONT>";
	    Page+="</TD>";
	    Page+="</TR>";
	    Page+="</TABLE><TABLE width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#FFFFFF\">";
	    Page+="<TR valign=\"middle\" bgcolor=\"#CCCCFF\">";
	    Page+="<TD align=\"middle\" height=\"21\" width=\"40%\"><B>";
	    Page+="User ID";
	    Page+="</B></TD>";
	    Page+="<TD align=\"middle\" height=\"21\" width=\"20%\"><B>";
	    Page+="Bid Amount";
	    Page+="</B></TD>";
	    Page+="<TD align=\"middle\" height=\"21\" width=\"40%\"><B>";
	    Page+="Date of Bid";
	    Page+="</B></TD></TR>";
	    Page+="</TABLE><BR>";
	    
	    int col=0;
	    while(rs.next()){
		if((col%2)==0)
		    Page+="<TABLE border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"100%\" bgcolor=\"#FFFFFF\">";
		else
		    Page+="<TABLE border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"100%\" bgcolor=\"#EFEFEF\">";
		Page+="<TR>";
		Page+="<TD align=\"left\" width=\"40%\"><A href=\""+Config.servletUrl+"UserRatingServlet?userLogin="+rs.getString("bidderLogin")+"\"";//\"http://www.cse.iitb.ac.in/~pandey\"";
		Page+=">"+rs.getString("bidderLogin")+"</A></TD>";
		Page+="<TD align=\"middle\" width=\"20%\">"+rs.getInt("bidvalue")+"</TD>";
		Page+="<TD align=\"middle\" width=\"40%\">"+rs.getString("bidTime")+"</TD>";
		Page+="</TR>";
		Page+="</TABLE>";
		col++;
	    }
	    Page+="<P align=\"center\">Bid amount protected until close of auction.Remember that earlier bids of the same amount take precedence.</P>";

		Page += "</body></html>";
	    }catch(SQLException sqle){
            System.out.println("Exception from makeBidFormpage " + sqle);
	}
	return Page;
    }    

	    
	    //Under Construction -----------------************-----
    
    public String InvalidLoginPage(){
	String Page=null;
	Page="<html>";
	Page+="<tr bgcolor=\"white\"><td align=left colspan=2 height=\"25\"><b><font face=Arial size=2 color=\"red\" > &nbsp;<b>Login Incorrect.Please try again</b></font></b></td></tr></html>";

	return Page;
    }


    public String InvalidPasswordPage(){
	String Page=null;
	Page="<html>";
	Page+="<tr bgcolor=\"white\"><td align=left colspan=2 height=\"25\"><b><font face=Arial size=2 color=\"red\" > &nbsp;<b>Password Incorrect.Please try again</b></font></b></td></tr></html>";

	return Page;
    }
	    


    public String InvalidBidPage(){
	String Page=null;
	Page="<html>";
	Page+="<tr bgcolor=\"white\"><td align=left colspan=2 height=\"25\"><b><font face=Arial size=2 color=\"red\" > &nbsp;<b>Invalid bid.Note that your bid should be more than the last maximum bid.Please try again</b></font></b></td></tr></html>";

	return Page;
    }


    public String SuccessfulBidPage(){
	String Page=null;
	Page="<html>";
	Page+="<tr bgcolor=\"white\"><td align=left colspan=2 height=\"25\"><b><font face=Arial size=2 color=\"red\" > &nbsp;<b>Your bid has been accepted.Thankyou</b></font></b></td></tr></html>";
	
	return Page;
    }

}










