var aDictionaryItems = [];

function initDictionary(
	oContainer,
	oIframeLoader
	) {

	var
		aItems = oContainer.getElementsByTagName('dt'),
		oHref
		;
	
	for(var i = 0; i < aItems.length; i++) {
	
		oHref = aItems[i].getElementsByTagName('a')[0];
		
		aDictionaryItems[oHref.id] = {
			bLoaded : false,
			bOpened : false
		};
		
		oHref.onclick = function() {
			
			if(!aDictionaryItems[this.id].bLoaded) {		
				oIframeLoader.src = this.href;
			}
			else if(!aDictionaryItems[this.id].bOpened) {
				
				Common.Class.remove(document.getElementById('dictionary_' + this.id), 'invisible');
				Common.Class.add(this, 'opened');
				aDictionaryItems[this.id].bOpened = true;
				
			}
			else {
							
				Common.Class.add(document.getElementById('dictionary_' + this.id), 'invisible');				
				Common.Class.remove(this, 'opened');
				aDictionaryItems[this.id].bOpened = false;				
				
			}
			
			return false;
		
		};
	
	}

}

document.updateDictionaryItem = function(sId) {
	
	if(!aDictionaryItems[sId].bLoaded) {
	
		aDictionaryItems[sId] = {
			bLoaded : true,
			bOpened : true
			};
			
		Common.Class.add(document.getElementById(sId), 'opened');
		
	}

}

function updateDictionary(sId) {

	if(top != window) {
			
		var
			oParentElement = top.document.getElementById('dictionary_' + sId),
			oThisElement = document.getElementById('dictionary_' + sId)
			;
		
		if(oParentElement && oThisElement) {
		
			oParentElement.innerHTML = oThisElement.innerHTML;
			Common.Class.remove(oParentElement, 'invisible');
			
			top.document.updateDictionaryItem(sId);
			
		}
			
	}

}