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

function get(nid) {
	var div = "body_"+nid;
	var oXmlHttp = zXmlHttp.createRequest();
	oXmlHttp.open("get", "/includes/getBody.php?nid="+nid, true);
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4) {
			if (oXmlHttp.status == 200) {
				fillAnswer(oXmlHttp.responseText, div);
			} else {
				fillAnswer("An error occurred: " + oXmlHttp.statusText, div); //statusText is not always accurate
			}
		} else {
			fillAnswer("Searching", div);
		}
	};
	oXmlHttp.send(null);
}
	

	
function fillAnswer(properti, id) {
	var properties = document.getElementById(id);
	properties.innerHTML = properti;
}


function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function hidediv(layer) {
if (document.getElementById) { // DOM3 = IE5, NS6
	if (document.getElementById(layer).style.display == 'block') {
		document.getElementById(layer).style.display = 'none';
	}
} 
}

