<%@ page language="java" import=" java.util.*" errorPage="error.jsp"%>
<%!
    String timeScale;
    String environmentParameter;
    String resolution;
	String fromMonth;
	String toMonth;
	String fromYear;
	String toYear;
%>
<html>
<head>
<title>ComparisonAnalysis</title>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</head>
<%!
    String[]  fuelTypeStrings = { "0 : Total","1 : Electricity(kWh)", "2 : Gas(kWh)", "3 : Oil"} ;
    String[]  fuelTypeCode   = {"0","1","2","3" };
    String [] scopeNameSet = { "living_1" , "Demand All" };

    String[] years = {"1994","1995","1996","1997","1998","1999","2000","2001","2002"};
    String fuelType = "1";
    String scope = "living_1";
    String resultType = "";
    String fromMonth = "Jan";
    String toMonth = "Dec";
    String fromYear = "";
    String toYear = "";

    String[] months = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep",
                    "Oct", "Nov","Dec" } ;
%>
<body BGCOLOR="#FFFFFF" TEXT="#000000" LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<table WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" HEIGHT="100%" BORDERCOLOR="#000000">
  <tr> 
	<td WIDTH="70%" HEIGHT="129" ALIGN="CENTER" VALIGN="middle"> 
	  <form NAME="form1" METHOD="post" ACTION="">
		<table WIDTH="80%" BORDER="0" CELLPADDING="2" BGCOLOR="#000000" ALIGN="CENTER">
		  <tr VALIGN="middle" BGCOLOR="#999999"> 
			<td ALIGN="center"><font FACE="Arial, Helvetica, sans-serif" COLOR="#FFFFFF" SIZE="2">Scopes 
			  to Compare:</font></td>
			<td ALIGN="center" NOWRAP> 
			  <table WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" HEIGHT="100%">
				<tr> 
				  <td> 
					<select NAME="scope1" SIZE="1">
					  <%
                        for(int i=0;i<scopeNameSet.length;i++) {

                            if(scopeNameSet[i].equals(scope)) {
                    %>
					  <option selected><%=scopeNameSet[i]%></option>
					  <%
                            } //if(scopeNameSet[i].equals(scope))

                            else {
                    %>
					  <option><%=scopeNameSet[i]%></option>
					  <%
                            } //else

                        } //for(int i=0;i<scopeNameSet.length;i++)
                    %>
					</select>
				  </td>
				</tr>
				<tr> 
				  <td> 
					<select NAME="scope2" SIZE="1">
					  <%
                        for(int i=0;i<scopeNameSet.length;i++) {

                            if(scopeNameSet[i].equals(scope)) {
                    %>
					  <option selected><%=scopeNameSet[i]%></option>
					  <%
                            } //if(scopeNameSet[i].equals(scope))

                            else {
                    %>
					  <option><%=scopeNameSet[i]%></option>
					  <%
                            } //else

                        } //for(int i=0;i<scopeNameSet.length;i++)
                    %>
					</select>
				  </td>
				</tr>
			  </table>
			</td>
			<td ALIGN="center"> 
			  <center>
				<font FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FFFFFF">Parameter:</font> 
			  </center>
			</td>
			<td WIDTH="148" ALIGN="center"> 
			  <center>
				<font FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FFFFFF"> 
				<select NAME="environmentParameterMenu">
				  <option VALUE="id1" SELECTED>Temperature Sensor 1</option>
				  <option VALUE="id2">Temperature Sensor 2</option>
				  <option VALUE="id3">Temperature Sensor 3</option>
				  <option>CO</option>
				  <option>Mould and Dustmites</option>
				  <option>Fuel Use Electricity</option>
				  <option>Fuel Use Gas</option>
				</select>
				</font> 
			  </center>
			</td>
			<td ALIGN="center"> 
			  <center>
				<font FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FFFFFF">Timescale:</font> 
			  </center>
			</td>
			<td WIDTH="188" ALIGN="center" VALIGN="middle"> 
			  <table WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" HEIGHT="100%" ALIGN="center">
				<tr> 
				  <td ALIGN="center" VALIGN="middle" NOWRAP><font FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FFFFFF">from: 
					<select NAME="fromMonth" SIZE="1">
					  <%
                                for(int i=0;i<months.length;i++) {

                                    if(months[i].equals(fromMonth)) {
                            %>
					  <option VALUE=<%=i%>selected><%=months[i]%></option>
					  <%
                                    } //if(months[i].equals(fromMonth))
                                    else {
                            %>
					  <option VALUE=<%=i%>><%=months[i]%></option>
					  <%
                                    } //else
                                } //for(int i=0;i<months.length;i++)
                            %>
					</select>
					<select NAME="fromYear">
					  <%
                                for(int i=0;i<years.length;i++) {
                                    if(years[i].equals(fromYear)) {
                            %>
					  <option selected><%=years[i]%></option>
					  <%
                                    } //if(years[i].equals(fromYear))
                                    else {
                            %>
					  <option><%=years[i]%></option>
					  <%
                                    } //else
                                } //for(int i=0;i<years.length;i++)
                            %>
					</select>
					</font></td>
				</tr>
				<tr> 
				  <td ALIGN="center" VALIGN="middle" NOWRAP><font COLOR="#FFFFFF" FACE="Arial, Helvetica, sans-serif" SIZE="2">to: 
					</font> <font FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FFFFFF"> 
					<select NAME="toMonth" SIZE="1">
					  <%
                                for(int i=0;i<months.length;i++) {

                                    if(months[i].equals(toMonth)) {
                            %>
					  <option selected><%=months[i]%></option>
					  <%
                                    } //if(months[i].equals(toMonth))
                                    else {
                            %>
					  <option><%=months[i]%></option>
					  <%
                                    } //else
                                } //for(int i=0;i<months.length;i++)
                            %>
					</select>
					<select NAME="toYear">
					  <%
                                for(int i=0;i<years.length;i++) {
                                    if(years[i].equals(toYear)) {
                            %>
					  <option selected><%=years[i]%></option>
					  <%
                                    } //if(years[i].equals(toYear))
                                    else {
                            %>
					  <option><%=years[i]%></option>
					  <%
                                    } //else
                                } //for(int i=0;i<years.length;i++)
                            %>
					</select>
					</font></td>
				</tr>
			  </table>
			</td>
			<td ALIGN="center"><font FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FFFFFF"> 
			  <input TYPE="image" BORDER="0" NAME="imageField" SRC="images/start.gif" WIDTH="64" HEIGHT="17">
			  </font></td>
		  </tr>
		</table>
	  </form>
	</td>
  </tr>
  <tr> 
	<td WIDTH="70%" ALIGN="center" VALIGN="top" HEIGHT="516"> 
	  <center>
		<% 
		if (request.getParameter("environmentParameterMenu")!=null){
			environmentParameter=request.getParameter("environmentParameterMenu");
						fromMonth=request.getParameter("fromMonth");
						fromYear=request.getParameter("fromYear");
						toMonth=request.getParameter("toMonth");
						toYear=request.getParameter("toYear");
	  %>
		<img SRC="LineChart123?environmentParameter=<%=environmentParameter%>&fromMonth=<%=fromMonth%>&fromYear=<%=fromYear%>&toMonth=<%=toMonth%>&toYear=<%=toYear%>" WIDTH="500" HEIGHT="300"> 
		<%
		}
		%>
	  </center>
	</td>
  </tr>
</table>
</body>
</html>
