/**
* Show the blocks of the chosen subtemplate.
*/
function showSubtdf(elementId, subTemplateContentIndex, subtdfId) {

	bb.command.load('/print/contents/setblocksubtemplate/id/'+elementId+'|'+subTemplateContentIndex+'/subtdfid/'+subtdfId, 'GET');

	hideSubtdfs(elementId);

	var divSubTdf = bb.document.getElementById(elementId+'_subtemplate_'+subtdfId);
	
	divSubTdf.viewNode.style.display = 'block';
}

/**
* Show the blocks of the chosen subtemplate.
*/
function isSubtdfShown(elementId, subTemplateContentIndex, subtdfId) {

	var divSubTdf = bb.document.getElementById(elementId+'_subtemplate_'+subtdfId);
	
	return (divSubTdf.viewNode.style.display == 'block');
}

/**
* Hide all the subtemplates of the element.
*/ 
function hideSubtdfs(elementId) {

	var divSubTdfs = bb.document.getElementById(elementId+'_subtemplates');
	
	var divSubTdfArray = bb.evaluate('descendant::div[@class = \'block_subtemplate\']', divSubTdfs.viewNode);
	
	for (divSubTdfArrayIdx in divSubTdfArray) {
        if(typeof divSubTdfArray[divSubTdfArrayIdx] == 'function') continue;
	
		divSubTdfArray[divSubTdfArrayIdx].style.display = 'none';
	}
	
	
}
