function clearText(thefield){
  if(!thefield.getAttribute("changed") && thefield.defaultValue==thefield.value ){
      thefield.value="";
      thefield.setAttribute("changed", "true");
  }
}

/*
 * Centre is optional
 */
function openPopup(url, width, height, centre){
	/*
	Notes:
	(assuming this function is called from the onclick in a <a> tag.
	
	return true/false... 
		- false stops execution, pop up is shown but contents of href not
		- true carries on with execution so href is shown
	*/

	/* Parameters not supplied, return true. */
	if (url == null || width == null || height == null){
		return true;
	}
	
	var options = "toolbar=no, location=yes, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=" + width + ", height=" + height;
	
	if (centre){
		//Centre the window
		var w = 800, h = 600;
		if (screen && screen.availWidth && screen.availHeight){
			w = screen.availWidth;
			h = screen.availHeight;
		}
		var leftPos = (w-width)/2;
		var topPos = (h-height)/2;
		options +=  ",left=" + leftPos + ",top=" + topPos;
	}

	var popup = window.open(url,"_blank", options);
	
	if(popup==null || typeof(popup)=="undefined"){
		alert("Popup window has been blocked. \nPlease enable popups for this web site or disable your popup blocker.");		
		return true;
	}
	
	//Everything went ok, show popup
	return false;
}