
function afterDojoLoad() {
    var tabs = dijit.byId('productInfoTabContainer');
    
    this.adjustPageSize = function(tabDj) {
        var tab = tabDj.domNode;
        tab.style.height='';
        tab.parentNode.style.height='';
        tab.parentNode.parentNode.style.height = (tab.offsetHeight+tab.parentNode.offsetTop+12)+'px'
    }
    
    if (!!tabs) {
        dojo.connect(tabs, 'selectChild', this, 'adjustPageSize');

//        (function () {
            this.adjustPageSize( tabs.selectedChildWidget );
//        }).defer(50);
    }
}

function posPageLoad() {
    dojo.require('dojox.image.Lightbox');
    dojo.require("dojo.parser");
    dojo.require("dijit.layout.ContentPane");
    dojo.require("dijit.layout.TabContainer");
    dojo.parser.parse($('bodySection'));
    
    dojo.addOnLoad( afterDojoLoad );
}

function setImg(imgElem, showImg) {
    if (!dijit || !dijit.byId)
        return;
    var widget = dijit.byId('imgProductImage');
    if (!widget)
        return;
    var src = !!imgElem.href ? imgElem.href : imgElem.src;
    widget.attr('href', src);
    $('imgProductImage').href = src;
    $('imgProductImage').src = src;
    
    if (!!showImg) {
        widget.show();
    }
}

woodstock.widget.common.addOnLoad(posPageLoad);
