/* adds hints to to the text fields */
function add_hints(node) {
  if (node != null) {
	if(node.type == "password")
		node.type = "text";
	
    node.value = node.id;
    node.style.color = "#aaaaaa";
    node.onmousedown = clear_input;
    node.onkeypress  = clear_input;
	node.onblur = refresh_hints;
  }
}

function refresh_hints(event) {
  if(xget_event(event).value == "")
	add_hints(xget_event(event));
}

/* removes hint and function from node */
function clear_node(node) {
  node.value       = "";
  node.style.color = "#000000";
  node.onmousedown = "";
  node.onkeypress  = "";
  
  if(node.name == "pwd") {
    node.type = "password";
  }

  node.focus();  
}

/* clear_node for events (if input field gets clicked) */
function clear_input (event) {
  clear_node(xget_event(event));
}

/* returns the node of an event */
function xget_event (event) {
  if (!event) event = window.event;
  if (event.srcElement) {
    // Internet Explorer1
	return event.srcElement;
  } else if (event.target) {
	// Netscape and Firefox
	return event.target;
  }
}

