	
function preSelectSection (id, intType, intID) {
	
	
	var theVal = intType + "::" + intID;

	var dd = document.getElementById ("internal" + id);
	
	var opts = dd.options;
	
	for (var i=0;i<opts.length; i++) {
		
		if (opts[i].value == theVal) {
			
			// found it
		
			
			dd.options.selectedIndex = i;
			
		}
		
	}
	
	
}



function preSelectDocument (id, intID) {
	
	
	var theVal = intID;

	var dd = document.getElementById ("document" + id);
	
	var opts = dd.options;
	
	for (var i=0;i<opts.length; i++) {
		
		if (opts[i].value == theVal) {
			
			// found it
		
			
			dd.options.selectedIndex = i;
			
		}
		
	}
	
	
}



function preSelectTarget (id, target) {
	
	
	var theVal = target;

	var dd = document.getElementById ("target" + id);
	
	var opts = dd.options;
	
	for (var i=0;i<opts.length; i++) {
		
		if (opts[i].value == theVal) {
			
			// found it
		
			
			dd.options.selectedIndex = i;
			
		}
		
	}
	
	
}


	

	function internalSelectChanged (id) {
		if (document.getElementById)
		{
			var dd = document.getElementById ("internal" + id);
			
			var value = (dd.options[dd.options.selectedIndex].value);
			
			if (value == -1) {
				
				
				alert ("Please make a valid selection.");
			}
			
			return true;
			
		}
	}
	
	
	function documentSelectChanged (id) {
		if (document.getElementById)
		{
			var dd = document.getElementById ("document" + id);
			
			var value = (dd.options[dd.options.selectedIndex].value);
			
			if (value == -1) {
				
				
				alert ("Please choose a document from the menu.");
			}
			
			return true;
			
		}
	}
	
	
	
	
	function linkTypeChanged (id) {
		
		if (document.getElementById)
		{
			var dd = document.getElementById ("linkType" + id);
		
			var extSection = document.getElementById ("externalSection" + id);
			var intSection = document.getElementById ("internalSection" + id);	
			var docSection =  document.getElementById ("documentSection" +id);
			var targetSection =  document.getElementById ("targetSection" + id);
			var value = (dd.options[dd.options.selectedIndex].value);
			
			// depending on the new value, we do one or the other
			if (value == 1) {
				
				extSection.style.display = "none";
				intSection.style.display = "block";
				docSection.style.display = "none";
				targetSection.style.display = "none";
				linkType = "internal";
				
			}
			
			else
			
			{
				if (value == 2) {
					
					extSection.style.display = "none";
					intSection.style.display = "none";
					docSection.style.display = "block";
					targetSection.style.display = "block";
					linkType = "document";
					
				}
				
				else
				
				{
					extSection.style.display = "block";
					targetSection.style.display = "block";
					intSection.style.display = "none";
					docSection.style.display = "none";
					linkType = "external";
				}
				
			}
			
		}
		
		
	}