var colorImgFiles = new Array(6);

if (document.images) {
	for (var i=0; i < colorImgFiles.length; ++i) {
		colorImgFiles[i] = new Image();
		colorImgFiles[i].src = "img/header/farbe"+(i+1)+".gif";
	}
}

function searchOnEnter(e, searchBy) {
	var keycode;
	if (window.event) {
		keycode = window.event.keyCode;
	} else if (e) {
		keycode = e.which;
	} else {
		return false;
	}
	if (keycode == 13) {
		search(searchBy);
		return false;
	}
}

function search(searchBy) {
	var field = document.getElementById("searchType");
	if (field != null) {
		field.value = searchBy;
		document.wh.submit();
	}
	return false;
}

function rowMunicipalsClick(municipalId, municipalZipcode, municipalName, grade, gradeText, gradeLevel) {
	var fieldMunicipalZipcode = document.getElementById("plz");
	if (fieldMunicipalZipcode != null) {
		fieldMunicipalZipcode.value = municipalZipcode;
	}
	var fieldMunicipalName = document.getElementById("gemeinde");
	if (fieldMunicipalName != null) {
		fieldMunicipalName.value = municipalName;
	}
	var fieldMunicipalName = document.getElementById("haerte");
	if (fieldMunicipalName != null) {
		fieldMunicipalName.value = grade;
	}
	var fieldMunicipalName = document.getElementById("stufe");
	if (fieldMunicipalName != null) {
		fieldMunicipalName.value = gradeText;
	}
	var fieldColorImage = document.getElementById("colorImage");
	if (fieldColorImage != null && document.images) {
		fieldColorImage.src = colorImgFiles[gradeLevel-1].src;
	}
	showIndicator(gradeLevel);
}

function showIndicator(gradeLevel) {
	var so = new SWFObject("stufentacho.swf", "stufentacho", "149", "149", "8", "#9EB0B2");
	so.addVariable("stufe", gradeLevel); 
	so.write("flashcontent");
}

function showMunicipalList() {
	var mc = document.getElementById("main-content-td");
	if (mc != null) {
		mc.className = "mapInBackground";
	}
	var mList = document.getElementById("content-table-background");
	if (mList != null) {
		mList.className = "wMunicipalList";
	}
}

function hideMunicipalList() {
	var mc = document.getElementById("main-content-td");
	if (mc != null) {
		mc.className = "mapInFront";
	}
	var mList = document.getElementById("content-table-background");
	if (mList != null) {
		mList.className = "woMunicipalList";
	}
}


