// JavaScript for Chinese pages

function hideAllToggledCells() {
	var tds = document.getElementsByTagName('TD');
	for( i=0; i<tds.length; i++ ) {
		if( tds[i].className.indexOf('hide') != -1 ) {
			for( j=0; j<tds[i].childNodes.length; j++ ) {
				if( tds[i].childNodes[j].nodeType == 1 ) tds[i].childNodes[j].style.display = 'none';
			}
			var tdHeaders = tds[i].getAttribute('headers');
			var colName = document.getElementById(tdHeaders).getAttribute('axis');
			var input = document.createElement('INPUT');
			input.className = 'button';
			input.setAttribute('type','button');
			input.value = 'Show ' + colName;
			addEvent(input,'click',showCell);
			tds[i].appendChild(input);
			tds[i].style.verticalAlign = 'middle';
		}
	}
}

function showCell(evt) {
	var node = findEventOwner(evt);
	while( node.tagName != 'TD' ) {
		node = node.parentNode;
	}
	for( j=0; j<node.childNodes.length; j++ ) {
		if( node.childNodes[j].nodeType == 1 ) node.childNodes[j].style.display = 'block';
	}
	var input = node.getElementsByTagName('INPUT')[0];
	input.value = input.value.replace('Show','Hide');
	removeEvent(input,'click',showCell);
	addEvent(input,'click',hideCell);
	node.style.verticalAlign = 'top';
}

function hideCell(evt) {
	var node = findEventOwner(evt);
	while( node.tagName != 'TD' ) {
		node = node.parentNode;
	}
	for( j=0; j<node.childNodes.length; j++ ) {
		if( node.childNodes[j].nodeType == 1 && node.childNodes[j].nodeName != 'INPUT' ) node.childNodes[j].style.display = 'none';
	}
	var input = node.getElementsByTagName('INPUT')[0];
	input.value = input.value.replace('Hide','Show');
	removeEvent(input,'click',hideCell);
	addEvent(input,'click',showCell);
	node.style.verticalAlign = 'middle';
}


