// require the datepicker file
var head = document.getElementsByTagName('head')[0];
	
	script = document.createElement('script');
	script.src = 'phpConForm/datepicker.js.php';
	script.type = 'text/javascript';
	
	head.appendChild(script)
// the function to show/add new field when useroptions are enabled
function addUserOption(){
}

// show the help option
var pcfHelpBox;
var pcfMouseX = 0
var pcfMouseY = 0
function pcf_helpShow(text,e){
	pcfHelpBox = document.createElement('div');
	pcfHelpBox.setAttribute('id','pcfHelpBox');
	pcfHelpBox.innerHTML = text;
	e.appendChild(pcfHelpBox);
	document.onmousemove = pcf_helpPlacement;
}
function pcf_helpHide(){
	pcfHelpBox.parentNode.removeChild(pcfHelpBox);
}
function pcf_helpPlacement(e){
		pcfMouseX = e.pageX
		pcfMouseY = e.pageY
	  // catch possible negative values in NS4
	  if (pcfMouseX < 0){pcfMouseX = 0}
	  if (pcfMouseY < 0){pcfMouseY = 0}  
	  // show the position values in the form named Show
	  // in the text fields named MouseX and MouseY
	pcfHelpBox.setAttribute('style','position:absolute;left:'+pcfMouseX+'px;top:'+pcfMouseY+'px;');
	  return true
}

// require the datepicker file
var head = document.getElementsByTagName('head')[0];
	
	script = document.createElement('script');
	script.src = 'phpConForm/datepicker.js.php';
	script.type = 'text/javascript';
	
	head.appendChild(script)
// the function to show/add new field when useroptions are enabled
function addUserOption(){
}

// show the help option
var pcfHelpBox;
var pcfMouseX = 0
var pcfMouseY = 0
function pcf_helpShow(text,e){
	pcfHelpBox = document.createElement('div');
	pcfHelpBox.setAttribute('id','pcfHelpBox');
	pcfHelpBox.innerHTML = text;
	e.appendChild(pcfHelpBox);
	document.onmousemove = pcf_helpPlacement;
}
function pcf_helpHide(){
	pcfHelpBox.parentNode.removeChild(pcfHelpBox);
}
function pcf_helpPlacement(e){
		pcfMouseX = e.pageX
		pcfMouseY = e.pageY
	  // catch possible negative values in NS4
	  if (pcfMouseX < 0){pcfMouseX = 0}
	  if (pcfMouseY < 0){pcfMouseY = 0}  
	  // show the position values in the form named Show
	  // in the text fields named MouseX and MouseY
	pcfHelpBox.setAttribute('style','position:absolute;left:'+pcfMouseX+'px;top:'+pcfMouseY+'px;');
	  return true
}

function pcf_addUserOption(itemId){
	extraBox = document.getElementById('pcfUserOptions'+itemId);
	// add the containing div
	pcfUserOption = document.createElement('div');
	pcfUserOption.setAttribute('class','pcfUserOption');
	// create the input field
	pcfUserInput = document.createElement('input');
	pcfUserInput.setAttribute('class','pcfUserInput');
	pcfUserInput.setAttribute('name','pcfUserOption['+itemId+'][]');
	pcfUserInput.setAttribute('type','text');
	// delete button
	pcfUserDel = document.createElement('img');
	pcfUserDel.setAttribute('class','pcfUserDelete');
	pcfUserDel.setAttribute('src','phpConForm/mail-mark-not-junk.png');
	pcfUserDel.setAttribute('onclick','pcf_delUserOption(this)');
	pcfUserDel.innerHTML = 'Delete item';
	//add the items
	pcfUserOption.appendChild(pcfUserInput);
	pcfUserOption.appendChild(pcfUserDel);
	extraBox.appendChild(pcfUserOption);
}

function pcf_delUserOption(el){
	extraBox = el.parentNode;
	extraBox.parentNode.removeChild(extraBox)
}
