/**
 * This class adjusts the height of viewable map area of the Gigapan Explorer application,
 * and holds the Control Panel.
 * <br><br>
 * <a href="mailto:ehudsons@andrew.cmu.edu">Ellen Hudson-Snyder</a>, 
 * <a href="mailto:evedar@andrew.cmu.edu">Elvin Vedar</a>,
 * <a href="mailto:cbalz@andrew.cmu.edu">Christopher M. Balz</a>.
 * <br><br>CVS Version Info:<br>
 *  $Id: ViewPortWindowSill.js,v 1.5 2005/11/13 09:12:57 cbalz Exp $ 
 * <br>
 * Note: Revision 1.0 of this class was created from a renaming of ViewPort.js, 'v 1.8 2005/10/02 06:35:15 cbalz Exp'.
 * <br><br>
 * @inherits-from <code>AbstractWidget</code>
 * @listens-to-event <code>resize</code> from the <code>Console</code> object.
 * @object-prop <code>Widget</code>  <code>wgtControlPanel</code>  A control panel widget.
 * @object-prop <code>string</code>  <code>strWindowId</code>  The i.d. of the window document object, cached for
 *                                   fast performance in event handling code.
 * @object-prop <code>number</code>  <code>intHeightPx</code>  The height, in pixels, of the viewport windowsill.
 *                                   This must be set in the inline style (via the 'getHtml' method) due to browser
 *                                   bugs.
 * @object-prop <code>number</code>  <code>intBorderTopWidthPx</code>  The height, in pixels, of the viewport
 *                                   windowsill top border.  The top border must be the same width as the bottom
 *                                   border.  This must be set in the inline style (via the 'getHtml' method) due
 *                                   to browser bugs.
 * @object-prop <code>number</code>  <code>intBorderBottomWidthPx</code>  The height, in pixels, of the viewport
 *                                   windowsill top border. The top border must be the same width as the bottom
 *                                   border.  This must be set in the inline style (via the 'getHtml' method) due
 *                                   to browser bugs.
 * @object-prop <code>number</code>  <code>intBorderLeftWidthPx</code>  The height, in pixels, of the viewport
 *                                   windowsill top border. The top border must be the same width as the bottom
 *                                   border.  This must be set in the inline style (via the 'getHtml' method) due
 *                                   to browser bugs.
 * @object-prop <code>number</code>  <code>intBorderRightWidthPx</code>  The height, in pixels, of the viewport
 *                                   windowsill top border. The top border must be the same width as the bottom
 *                                   border.  This must be set in the inline style (via the 'getHtml' method) due
 *                                   to browser bugs.
 * @author Team GigaToasted (Fall-2005-CMU-NASA/Google-Practicum Subteam) 
 * @version 1.0
 * <br><br>
 */ 

// Set the prototype chain for efficient inheritance:
ViewPortWindowSill.prototype = new AbstractWidget();


/**
 * Create a <code>ViewPortWindowSill</code> object.
 * @param objParent <code>Object</code>  The parent, if any, of this object.
 */
function ViewPortWindowSill(objParent) {
    this.superC("viewportwindowsill", objParent); // Complete the inheritance.

    this.wgtControlPanel = new ControlPanel(this);
    this.strWindowId =  this.objParent.strWindowId;
    this.intHeightPx = 195; 
    this.intBorderTopWidthPx    =  7;
    this.intBorderBottomWidthPx =  7;
    this.intBorderLeftWidthPx   =  7; 
    this.intBorderRightWidthPx  =  7;

    // Methods: 
    this.keepAtBottom = ViewPortWindowSill_keepAtBottom;
    this.receiveEvent = ViewPortWindowSill_receiveEvent;
    this.getHtml = ViewPortWindowSill_getHtml;

    // Register events:
    self.gloScope.registerEvent(this.strId, this, this.objParent.strId, "onresize");
}



/**
 * This method aligns the bottom of the <code>viewport</code> element with the 
 * bottom of the screen.
 */
function ViewPortWindowSill_keepAtBottom() {
    this.getDomRef().style.bottom = "0px";
}


/**
 * Return the HTML of the object managed by the widget <code>ViewPortWindowSill</code> and its child widgets.    
 * @return <code>string</code>  A string representing the HTML of the 
 *                 object managed by the widget and its child widgets.
 */
function ViewPortWindowSill_getHtml() {
    var strHtml = 
        "<div id='" + this.strId + "'  style = '" + 
        "height: " + this.intHeightPx + "px; " + 
        "border-style: outset; " +
        "border-top-width: " + this.intBorderTopWidthPx + "px; " + 
        "border-bottom-width: " + this.intBorderBottomWidthPx + "px; " + 
        "border-left-width: " + this.intBorderLeftWidthPx + "px; " + 
        "border-right-width: " + this.intBorderRightWidthPx + "px; " + 
        "'>" +
        "<span id='" + this.strId + "_leftlogo'></span>" + 
        this.wgtControlPanel.getHtml() +
        "<span id='" + this.strId + "_rightlogo'></span>" + 
        "</div>";

    return strHtml;
}


/**
 * This method receives any events that this object listens to and 
 * routes them to the proper methods. 
 * @param pStrEventSourceElementId  <code>string</code> The i.d. of the document object model from which the event 
 *                                  sprang.
 * @param pStrEventType  <code>string</code> The event type of the object (e.g., 'onclick', etc).
 * @param pObjEvent  <code>string</code> The event object itself (may be null).
 */
function ViewPortWindowSill_receiveEvent(pStrEventSourceElementId, strEventType, objEvent) { 
    if (pStrEventSourceElementId == this.objParent.strId && strEventType == "onresize") {
        this.keepAtBottom();
    }
}


