/*
* Ext JS Library 2.0.2
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
* 
* http://extjs.com/license
*/
var oTabs = null;
Ext.onReady(function() {

    var tabs = new Ext.TabPanel({
        renderTo: 'tabs',
        resizeTabs: true, // turn on tab resizing
        minTabWidth: 102,
        tabWidth: 135,
        enableTabScroll: true,
        width: 350,
        height: 300,
        defaults: { autoScroll: false },
        plugins: new Ext.ux.TabCloseMenu(),
        listeners: { tabchange: tabPanelChange_test }
    });
    if (tabs != null) {
        oTabs = tabs;
        if (ZSY) {
            ZSY();
        }
    }
    // tab generation code
    var index = 0;
    while (index < 0) {
        addTab();
    }
    function addTab() {
        tabs.add({
            title: 'New Tab ' + (++index),
            iconCls: 'tabs',
            html: 'Tab Body ' + (index) + '<br/>',
            closable: true
        }).show();
    }

});

function tabPanelChange_test() {
    ClearVS();
    for (var i = 0; i < oTabs.items.length; i++) {
        if (oTabs.getActiveTab().id != oTabs.items.items[i].id) {
            var iframe = document.getElementById((oTabs.items.items[i]).getEl().id).childNodes[0].childNodes[0].childNodes[0];

            if ((iframe.src.toLowerCase()).indexOf('bizsearch.aspx') != -1 || (iframe.src.toLowerCase()).indexOf('nearbybiz.aspx') != -1) {
                try {
                    //if (typeof(eval(parent.frames[i + 1].UnActiveSSView)) == "function") {
                    parent.frames[i + 1].ClearCache();
                    parent.frames[i + 1].fnLineClear();
                    parent.frames[i + 1].UnActiveSSView();

                    //}

                } catch (e) {
                }
            }
        } else if (oTabs.getActiveTab().id == oTabs.items.items[i].id) {
            try { 
                if (typeof (eval(parent.frames[i + 1].fnHideAll)) == "function") {
                    parent.frames[i + 1].fnHideAll();
                }

            } catch (e) {
        } 
        var iframe = document.getElementById((oTabs.items.items[i]).getEl().id).childNodes[0].childNodes[0].childNodes[0];
            if ((iframe.src.toLowerCase()).indexOf('bizsearch.aspx') != -1 || (iframe.src.toLowerCase()).indexOf('nearbybiz.aspx') != -1) {
                try {
                    //if (typeof(eval(parent.frames[i + 1].UnActiveSSView)) == "function") {
                    parent.frames[i + 1].ClearCache();
                    parent.frames[i + 1].fnLineClear();
                    parent.frames[i + 1].UnActiveSSView();

                    //}

                } catch (e) {
                }
            }
        }

    }
    //    document.getElementById((oTabs.getActiveTab()).getEl().id).childNodes[0].childNodes[0].childNodes[0].src = ;
    //UnActiveSSView
}
