

function wipeShow2(nodeId, callback) {
	var node = document.getElementById(nodeId);
	
	// Calculate the expanded height
	//var overflow = dojo.html.getStyle(node, "overflow");
	node.style.overflow = "hidden";
	node.style.height = "0px";
	node.style.display = 'block';

	var height = node.scrollHeight;
	
	sinWipe(nodeId, 0, height, getDx(height), 0, function() { if(callback) { callback(node); }});
}

wipeHide2 = function(nodeId, callback) {
	

	var node = document.getElementById(nodeId);
	
	var height = node.offsetHeight;
	
	//var overflow = dojo.html.getStyle(node, "overflow");
	node.style.overflow = "hidden";
	
	sinWipe(nodeId, height, 0, getDx(height), 0, callback);
}

getDx = function(height) {
	var steps = Math.round(height / 45); // duration / 5.0;
	steps = (steps > 15 ? 15 : (steps < 7 ? 7 : steps));
	var dx = Math.PI / steps;
	return dx;
}

pi = Math.PI;
function sinWipe(nodeId, startHeight, endHeight, dx, xVal, cb)
{
	var node = document.getElementById(nodeId);
	xVal += dx;
	if(xVal > pi) xVal = pi;
	var dh = (endHeight-startHeight)*(1.0-Math.pow((1.0+Math.cos(xVal))/2.0, 2));
	var newH = startHeight + dh;

	newH = Math.round(newH > endHeight && endHeight > startHeight ? endHeight : (newH < endHeight && endHeight < startHeight ? startHeight : newH));
	newH = (newH > 0 ? newH : 0);
	node.style.height = newH + 'px';
	if(endHeight == 0 && newH == 0)
	{
		node.style.display = 'none';
	}
	
	if(xVal == pi) {
		if(cb) window.setTimeout(cb, 75);
		return;
	}
	
	window.setTimeout(function() { sinWipe(nodeId, startHeight, endHeight, dx, xVal, cb);}, 75);
}




function showThis(elem, extra) {
	

	
	// Fix up the open link to do nothing while we open
	var linkElem = document.getElementById(elem + 'link');
	linkElem.onclick = function() { return false;};
	//linkElem.style.display = 'none';
	
	
	var linkOther = document.getElementById(extra + 'link');
	
	//var loadingElem = document.getElementById(elem + 'loading');
	//loadingElem.style.display='inline';
	
	
	//function() { }
	
	wipeHide2(extra,function() {linkElem.onclick = function() {showThis(elem, extra); return false;};});
	
	wipeShow2(elem, function() { linkElem.style.display = 'none';linkOther.style.display = 'block'; });

}




function fetchAndShowInlineSpecs(elem, data, extra) {

	//var loadingElem = document.getElementById(elem + 'loading');
	//loadingElem.innerHTML = limit;
	//error('data is ' + data + '  elem is ' + elem +' extra is '+extra);
	
	if(data == "") window.history.go(0);
	
	var specElem = document.getElementById(elem);
	
	//error (specElem.innerHTML);
	specElem.innerHTML = Url.decode(data);
	
	//error('elem is  ' + elem + '<br /> extra is '+ extra);

	
	showThis( elem, extra);
	
		
	//if(extra != '' ) {
	
		//error('in actions ' + extra);
		//hideInlineSpecs(extra,elem);
		//extra = '';
	//}
}


