function confirm_delete(entity, id) {
	if (input_box=confirm("Are you sure you want to delete this "+entity+"?")) {
		this.location="delete.html?entity="+entity+"&id="+id;
	}
}
  
  function displaySelectedOptionsFromSelectList(objectId, where) {
  	var items = '';
  	object = document.getElementById(objectId);
	for(i = 0; i < object.options.length; i++) {
		var option = object.options[i];
		if (option.selected==true) {
			if (items!='') items += '<br/>';
			items += option.text;
		}
	}					  	
	document.getElementById(where).innerHTML = items;
  }
// Makes layer visible/invisible
function toggleLayer(whichLayer) {
  if (document.getElementById) {
    // this is the way the standards work
    var style2 = document.getElementById(whichLayer).style;
    style2.display = style2.display? "":"block";
  } else if (document.all) {
    // this is the way old msie versions work
    var style2 = document.all[whichLayer].style;
    style2.display = style2.display? "":"block";
  } else if (document.layers) {
    // this is the way nn4 works
    var style2 = document.layers[whichLayer].style;
    style2.display = style2.display? "":"block";
  }
} 

function determineElementCoordinates(element) {
	var top = 0;
	var left = 0;
	left = element.offsetLeft;
	top = element.offsetTop;
	var currentElement = element;
	while(currentElement.offsetParent != null) {
 		currentElement = currentElement.offsetParent;
		left = left + currentElement.offsetLeft;
 		top = top + currentElement.offsetTop;
	}
	return {"top": top, "left": left};
};

function trim(str)
{
  s = str.replace(/^(\s)*/, '');
  s = s.replace(/(\s)*$/, '');
  return s;
}