function loadZipBrowserComponents() {
	if (!AfianHandler.components['BrowseZipBaseMenu'].loaded) {
		window.setTimeout('loadComponentData(\'BrowseZipBaseMenu\')',300);
	}
}

function MyFilesBrowseZip(path) {
	tb = AfianHandler.activeTab;
	sel = tb.selectedItem();
	path = path?path:gluePath([tb.basepath, sel.input_value]);

	loadZipBrowserComponents();
	bzip = new Afian_Tab(sel.input_value, '', 'images/icons/taskbar/zip.gif');
	bzip.viewMode = 'list';
	bzip.section = 'browse-zip';
	bzip.singleSelection = true;
	bzip.basepath = path;
	bzip.innerpath = '';
	bzip.detailHTML = AfianHandler.BrowseZipDetailsTemplate;
	bzip.onload = BrowseZipOnLoad;
	bzip.onselect = BrowseZipOnSelect;
	bzip.baseMenu = 'BrowseZipBaseMenu';
	bzip.load();
	tabStartTimer(bzip);
	BrowseZipCd('/');
}


function BrowseZipCd(innerpath) {
	tb = AfianHandler.activeTab;
	innerpath = innerpath?innerpath:gluePath([tb.basepath, tb.selectedItem().input_value]);
	tb.ifram.src = '?zipbrowser=1&sub=listing&tabid='+AfianHandler.activeTab.id+'&path='+encodeURIComponent(tb.basepath)+'&innerpath='+encodeURIComponent(innerpath);
	tb.showHourGlass();
}


function BrowseZipOnLoad() {
	if (AfianHandler.activeTab == this) {
	/* show the menu */
	AfianHandler.showBaseMenu('BrowseZipBaseMenu');
	
	AfianHandler.hideBaseMenu('MyFilesBaseMenu');
	AfianHandler.hideBaseMenu('TrashBaseMenu');
	AfianHandler.hideBaseMenu('SearchBaseMenu');
	AfianHandler.hideBaseMenu('MySharesBaseMenu');
	AfianHandler.hideBaseMenu('BShareBaseMenu');
	
	/*admin stuff*/
	AfianHandler.hideBaseMenu('AdmGroupsBaseMenu');
	AfianHandler.hideBaseMenu('AdmUsersBaseMenu');
	AfianHandler.hideBaseMenu('AdmLogsBaseMenu');
	
		if (activeMenu) {
			hideMenu(activeMenu);
		}
		
		loadZipBrowserComponents();
		if (AfianHandler.components['BrowseZipBaseMenu']['loaded']) {
			AfianHandler.titleBar.innerHTML = this.title;
		}
		if (!this.showHG) {
		BrowseZipStatusBar();
		} else {
		this.showHourGlass();
		}
	}
}

function BrowseZipStatusBar() {
	tb = AfianHandler.activeTab;
	if (tb.countSelected == 0) {
		if (tb.countAll == 0) {
			if (tb.browsed) {
			AfianHandler.statusBar.innerHTML = AfianMessages['Empty archive'];
			} else {
			AfianHandler.statusBar.innerHTML = AfianMessages['Accessing archive...'];
			}
		} else {
			if (tb.countAll == 1) {
				AfianHandler.statusBar.innerHTML = AfianMessages['One object'];
			} else {
				AfianHandler.statusBar.innerHTML = AfianMessages['%1 objects'].replace('%1', tb.countAll);
			}
		}
	} else {
		selected = tb.selectedItem();
		AfianHandler.statusBar.innerHTML =  AfianMessages['%1, Actual size: %2, Compressed size: %3'].replace('%1',selected.icon_title).replace('%2',selected.formatedSize).replace('%3',formatFileSize(selected.extra));;
	}
}

function BrowseZipOnSelect() {
	 BrowseZipStatusBar();
}