<%@ Page Language="JScript" EnableViewState="false" %>
<%@ Register TagPrefix="IBuySpy" TagName="ReviewList" Src="_ReviewList.ascx" %>
<%@ Register TagPrefix="IBuySpy" TagName="AlsoBought" Src="_AlsoBought.ascx" %>
<%@ Register TagPrefix="IBuySpy" TagName="Menu" Src="_Menu.ascx" %>
<%@ Register TagPrefix="IBuySpy" TagName="Header" Src="_Header.ascx" %>
<%@ OutputCache Duration="60" VaryByParam="ProductID" %>
       
<script runat="server">

    //*******************************************************
    //
    // The Page_Load event on this page is used to obtain
    // product information from a database and then update
    // UI elements with them.
    //
    // Note that this page is output cached at 1 minute
    // intervals.  This eliminates the need to hit the database
    // on each request to the page.
    //
    //*******************************************************

    function Page_Load(sender: Object , e: EventArgs) : void {

        // Obtain ProductID from QueryString
        var ProductID : int  = Int32.Parse(Request.Params["ProductID"]);

        // Obtain Product Details
        var products : IBuySpy.ProductsDB  = new IBuySpy.ProductsDB();
        var myProductDetails : IBuySpy.ProductDetails  = products.GetProductDetails(ProductID);
		
		
        // Update Controls with Product Details
        desc.Text = myProductDetails.Description;
        UnitCost.Text = String.Format("{0:c}", myProductDetails.UnitCost);
        ModelName.Text = myProductDetails.ModelName;
        ModelNumber.Text = myProductDetails.ModelNumber.ToString();
        ProductImage.ImageUrl = "ProductImages/" + myProductDetails.ProductImage;
        addToCart.NavigateUrl = "AddToCart.aspx?ProductID=" + ProductID;
        ReviewList.ProductID = ProductID;
        AlsoBoughtList.ProductID = ProductID;
    }
	

</script>

<html>
  <head>
        <link href="IBuySpy.css" type="text/css" rel="stylesheet">
  </head>
    <body bottomMargin="0" leftMargin="0" background="images/sitebkgrd.gif" topMargin="0" rightMargin="0" marginwidth="0" marginheight="0">
        <table cellSpacing="0" cellPadding="0" width="100%" border="0">
            <tr>
                <td colSpan="2">
                    <IBuySpy:Header id="Header1" runat="server" />
                </td>
            </tr>
            <tr>
                <td vAlign="top" width=145>
                    <IBuySpy:Menu id="Menu1" runat="server" />
                    <img height="1" src="images/1x1.gif" width="145">
                </td>
                <td vAlign="top" align="left">
                    <table height="100%" cellSpacing="0" cellPadding="0" width="620" align="left" border="0">
                        <tr vAlign="top">
                            <td>
                                <br>
                                <img src="images/1x1.gif" width="24" align="left">
                                <table cellSpacing="0" cellPadding="0" width="100%" border="0">
                                    <tr>
                                        <td class="ContentHead">
                                            <img height="32" src="images/1x1.gif" width="60" align="left"><asp:label id="ModelName" runat="server" />
                                            <br>
                                        </td>
                                    </tr>
                                </table>
                                <table cellSpacing="0" cellPadding="0" width="100%" border="0" valign="top">
                                    <tr vAlign="top">
                                        <td rowspan="2">
                                            <img height="1" width="24" src="images/1x1.gif">
                                        </td>
                                        <td width="309">
                                            <img height="15" src="images/1x1.gif">
                                            <br>
                                            <asp:image id="ProductImage" runat="server" height="185" width="309" border="0" />
                                            <br>
                                            <br>
                                            <img height="20" src="images/1x1.gif" width="72"><span class="UnitCost"><b>Your Price:</b> <asp:label id="UnitCost" runat="server" /></span>
                                            <br>
                                            <img height="20" src="images/1x1.gif" width="72"><span class="ModelNumber"><b>Model Number:</b> <asp:label id="ModelNumber" runat="server" /></span>
                                            <br>
                                            <img height="30" src="images/1x1.gif" width="72"><asp:hyperlink id="addToCart" runat="server" ImageUrl="images/add_to_cart.gif" />
                                        </td>
                                        <td>
                                            <table width="300" border="0">
                                                <tr>
                                                    <td vAlign="top">
                                                        <asp:label class="NormalDouble" id="desc" runat="server"></asp:label>
                                                        <br>
                                                    </td>
                                                </tr>
                                            </table>
                                            <img height="30" src="images/1x1.gif">
                                            <IBuySpy:AlsoBought id="AlsoBoughtList" runat="server" />
                                        </td>
                                    </tr>
                                    <tr>
                                    </tr>
                                </table>
                                <table border="0">
                                    <tr>
                                        <td>
                                            <img src="images/1x1.gif" width="89" height="20">
                                        </td>
                                        <td width="100%">
                                            <IBuySpy:ReviewList id="ReviewList" runat="server" />
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </body>
</HTML>