function navigate(id, pageTitle) {

	if(pageTitle && pageTitle != '') {
		window.document.title = gSiteTitle + " : " + pageTitle;
	} else {
		window.document.title = gSiteTitle;
	}

	var menu = window.document.getElementById('menuIFrame');
	if(menu)
	{
		var doc;
		
		if (menu.contentDocument)
			doc = menu.contentDocument; 
		else if (menu.contentWindow)
			doc = menu.contentWindow.document;
		else if(menu.document) 
			doc = menu.document;
	
		if(doc) {
			var table = doc.getElementById('linkTable');
			if(table) {
				var list = table.getElementsByTagName('td');
				
				for(i=0; i < list.length; i++) {
					if(list[i].className != "") {
						list[i].className = (list[i].id == id) ? "SelectedLinkBox" : "UnSelectedLinkBox";				
					}
				}
			}
		}
	}	
	if(window.scrollTo)
		window.scrollTo(0,0);
}

function adjustContentHeight(height) {
	
	if(height < defaultMenuHeight)
		height = defaultMenuHeight;

	height += "px";
	
	var menu = window.document.getElementById('menuIFrame');
	var content = window.document.getElementById('mainContentIFrame');
	
	var left = window.document.getElementById('leftcontent');
	var right = window.document.getElementById('rightcontent');
	
	left.style.display = 'none';
	right.style.display = 'none';
	
	left.style.height = height;
	right.style.height = height;

	menu.height = height;
	content.height = height;
		
	left.style.display = 'block';	
	right.style.display = 'block';	
}

var defaultMenuHeight = 700;
var subMenuNavTarget;
var subMenuNavTargetTitle;
var gSiteTitle = 'DELC - eLearning for Defence';

function setSubMenuTarget(id, pageTitle) {
	subMenuNavTarget = id;
	subMenuNavTargetTitle = pageTitle;
}

function resizeFrames() {
	var menu = window.frames.menuIFrame;
	var content = window.frames.mainContentIFrame;

	var right = window.document.getElementById('rightcontent');
	var left = window.document.getElementById('leftcontent');

	var doc;
	if(content.document) 
		doc = content.document;
	else if (content.contentDocument)
		doc = content.contentDocument; 
	else if (content.contentWindow)
		doc = content.contentWindow.document;
	
	var div = doc.getElementById('contentDiv');
	var contentHeight = (div) ? div.scrollHeight : defaultMenuHeight;

	if(right.scrollHeight > contentHeight ) {	
		// if the right iframe is bigger than the new content then shrink it
		adjustContentHeight(contentHeight);
	} else if(contentHeight < left.scrollHeight) {
		// if the right content is smaller than the left content then expand the right content to match		
		adjustContentHeight(left.scrollHeight);
	} else if(contentHeight >= right.scrollHeight) {
		// if the new content is bigger than the old content then expand it
		adjustContentHeight(contentHeight);			
	} 					
		
	// reposition the logica logo
	var menuDoc;
	if(menu.document) 
		menuDoc = menu.document;
	else if (menu.contentDocument)
		menuDoc = menu.contentDocument; 
	else if (menu.contentWindow)
		menuDoc = menu.contentWindow.document;

	var logo = menuDoc.getElementById('footerLogo');
	if(logo) {	
		logo.style.display = 'none';	
		logo.style.top = (left.scrollHeight - 131) + "px";		
		logo.style.display = 'block';
	}	
}