/*	Save this very file to a directory of your choice on your web server.
	ex: js/toggle_display.js
	
	Put this line in the <head> of the web page(s) you want to use the behavior:
	<script src="js/toggle_display.js" type="text/javascript" charset="utf-8"></script>
	
	(Note the "src" attribute of the above line. This should be the relative path to this file on your web server)
	
	Put this attribute on the element you what to trigger the behavior:
	onclick="toggleDisplay('the_id_you_want_to_toggle');" 
	ex: <a name="toggle_div" onclick="toggleDisplay('the_id_you_want_to_toggle');">Toggle the damn thing</a>
	
*************************************************************************/

function toggleDisplay(obj_id){ // Toggles display of certain syled elements
	if (document.getElementById){
		var obj = document.getElementById(obj_id);
		if (obj.style.display == '' || obj.style.display == 'none'){
			var state = 'block';
		} else {
			var state = 'none';
		}
		obj.style.display = state;
	}
}

function swapImage (id, src) {
	if (document.getElementById) {
		var img = document.getElementById(id);
		img.src = src;
		return false;
	}
}

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}
