/* jLightBox (using jQuery library).
*--------------------------------------------*
*  @author : ukhome ( ukhome@gmail.com | ntkhoa_friends@yahoo.com )
*--------------------------------------------*
*  @released : 24-Mar-2009 : version 1.0
*--------------------------------------------*
*  @revision history : ( latest version : 1.0 )
*--------------------------------------------*
*      + 24-Mar-2009 : version 1.0
*          - released
*--------------------------------------------*
*/

/* package $lightbox.SizeControl
*/

/*
* parent = $lightbox object
*/

$lightbox.SizeControl = function (parent) {
	
    parent.setPopupHeight = function () { //use to calculate the height for popup in case content is NOT IMAGE TYPE
        /*determine the height of the popup*/
        var windowHeight;
        if ( jQuery.browser.safari ) {
            windowHeight = jQuery(window).get(0).innerHeight;
        }
        else {
            windowHeight = jQuery(window).height();
        }

        parent.popup.show();
        var popupHeight = 800;//parent.popupContent.outerHeight(true);
        if ( popupHeight > parent.options.maxLightBoxHeight ) { //has scrollbar
            popupHeight = parent.options.maxLightBoxHeight;
        }
        else if ( popupHeight > windowHeight ) {
            popupHeight = windowHeight;
        }

        this.popup.css({
            height: popupHeight,
            overflow: "auto"
        });

        if ( parent.options.enableScrollbar ) {
            parent.popup.css({
                overflow: "auto"
            });
        }
        else {
            parent.popup.css({
                overflow: "hidden"
            });
        }

        return parent;
    }

}

