var timerid
var dataLoaded = false

function hide(layer) {
		document.getElementById(layer).style.visibility = "hidden"
}
	
function show(layer) {
		document.getElementById(layer).style.visibility = "visible"
}
	
function dataDoneLoading() {
		dataLoaded = true
}

function getRef(field,id) {
    if (id != 2) id = '';
		var lower = new String(field).toLowerCase()
		return document.forms[lower + "Wrapper"+id][lower]
}

function swapData(field, suppress, id) {
	if (id != 2) id = '';
// Parse the data
	var listing
	if(document.getElementById("otherdata").contentDocument) {
		listing = document.getElementById("otherdata").contentDocument.forms["selData"].listing.options
	} else if(document.frames["otherdata"].document.selData) {
		listing = document.frames["otherdata"].document.selData.listing.options
	} else listing = document.frames["otherdata"].document.forms["selData"].listing.options
// Clear select box
	var swap = getRef(field, id)
	var counter = swap.options.length
	while(counter > 0) {
		counter--
		swap.options[counter] = null
		}
// Put the data in the select box
	var inc = 0;
	if(!suppress) {
		inc = 1;
		swap.options[0] = new Option("Select a " + field, "", true, true)
	}
	for(var i = 0;i < listing.length;i++) {
		swap.options[i + inc] = new Option(listing[i].text, listing[i].value, false, false)
		}
	swap.disabled = false
	swap.selectedIndex = 0
	hide("load" + field+id)
	return listing.length
}

function loadData(href) {
	document.getElementById("otherdata").src = href
}
