

function addContent(text, form, element) {
	var content = document.forms[form][element].value;
	var temp    = content +''+ text;

	document.forms[form][element].value = temp;
}




function addHref(form, element, displayValue, defaultValue) {
	var linkURL  = prompt('Enter the '+ displayValue +' in full', defaultValue);
	var linkText = prompt('Enter the name of the link [this is how it will appear on the page]');

	var target   = '';

	if ( displayValue == 'URL' ) {
		var check = confirm('Should this open in a new window?');
		if ( check == true ) {
			target = ' target="new"';
		}
	}

	var linkCode = '<a href="'+linkURL+'"'+ target +'>'+linkText+'</a>';

	addContent(linkCode, form, element)
}




function addEmail(form, element) {
	addHref(form, element, 'email address', 'mailto:')
}




function addURL(form, element) {
	addHref(form, element, 'URL', 'http://')
}



function confirmDelete(url, name) {
	var check = confirm('Are you sure you want to delete ['+ name +']?');
	if (check == true) {
		this.location = url;
	}
}
