var prefixID = 'element';
var numPrevious;

function setAsParentHeight( numCurrent ){	
	$( '#' + prefixID + '_tr_' + numCurrent ).show();
	var current = document.getElementById( prefixID + '_div_' + numCurrent )	
	var parent =  document.getElementById( prefixID + '_td_' + numCurrent );	
	var parentHeight = parent.offsetHeight + 40;			
	if( parentHeight < 240 )
		parentHeight = 240;	
	current.style.height = parentHeight + 'px';		
}

function switchElements( numCurrent ){	
	if( typeof(numPrevious) == 'undefined' ){
		showSubParts( numCurrent );			
	}
	else{		
		if( numPrevious != numCurrent ){
			hideSubParts( numPrevious );	
			showSubParts( numCurrent );					
		}
		else{				
			if( $( '#' + prefixID + '_div_' + numCurrent ).css('display') == 'none' ){ 			
				showSubParts( numCurrent );			
			}
			else{
				hideSubParts( numCurrent );	
			}
		}
	}	
	numPrevious = numCurrent;
}

function showSubParts( numCurrent ){	
	$( '#' + prefixID + '_div_' + numCurrent ).show();	
	$( '#' + prefixID + '_tr_' + numCurrent ).show();	
}

function hideSubParts( numCurrent ){
	$( '#' + prefixID + '_div_' + numCurrent ).hide();		
	$( '#' + prefixID + '_tr_' + numCurrent ).hide();	
}