var storeDataJSON;
function showStoreForm() {
    if(storeDataJSON.selected == 0){
        var storePanel = new YAHOO.widget.Panel("selectStoreForm", { fixedcenter : true, modal:true, width:'400px', visible:false, zIndex:1000, constraintoviewport:true, close:true} );
        storePanel.setHeader("<div style='display:none' class='tl'></div><div class='tr'></div>");
        storePanel.setFooter("<div style='display:none'class='bl'></div><div class='br'></div>");
        YAHOO.util.Dom.setStyle("selectStoreForm",'display','block');
        storePanel.render();
        storePanel.show();
    }
}
function setActiveStore(storeId, noReload) {
    YAHOO.util.Connect.asyncRequest(
        'GET',
        base + lang + '/inventory/index/setactivestore/?storeId=' + storeId,
        {
            success: function(r){
                getActiveStoreData();
                if(noReload !== true) {
                    window.location.reload();
                }
            }
        }
    );
}
function getActiveStoreData() {
    YAHOO.util.Connect.asyncRequest(
        'GET',
        base + lang + '/inventory/index/getactivestore/',
        {
            success: function(r){

                storeDataJSON = YAHOO.lang.JSON.parse(r.responseText);
                
                /*if(productController == 1) {
                    if(storeDataJSON.name) {   
                        if (document.getElementById('store_name')) {
                            YAHOO.util.Dom.get('store_name').innerHTML = storeDataJSON.name;
                        }
                        if (document.getElementById('store_status_name')) {
                            YAHOO.util.Dom.get('store_status_name').innerHTML = storeDataJSON.name;
                        }
                    }
                }*/
                
                if(catalogControllers == 1) {
                    showStoreForm();
                }

                if(document.getElementById('book_store_'+storeDataJSON.id)) {
                   document.getElementById('book_store_'+storeDataJSON.id).style.display = 'block';
                }
            }
        }
    );
}
