
<!--

var IE = document.all

//	START OF DROP-DOWN LIST EDITING //

	function AddUserEntry(object, title, mess) {
	//	Decides if we need to add a new option!
		if(object.selectedIndex == (object.length - 1)) {
			
			var newEntry = prompt(mess, '');
			
			if(newEntry && newEntry != '') { //add this option to the box.
				updateSelection(object, newEntry)
			}
		}
	}

	function updateSelection(object, name) {
	//	Asks the user for their chosen option, and then dumps this at the bottom of the list.
		var insertSpacer = true;
		var destField = object;
		var allOptions = destField.length;
		var newSpacer = new Option('------------------------------');
		var newOption = new Option(name);
		var addOption = destField.options[allOptions - 1];

		for(i=(allOptions-1); i>0 && insertSpacer; i--) {
			// start @ the bottom and work our way up!!!
			if(destField.options[i].text == newSpacer.text)
				insertSpacer = false;
		}
		if(insertSpacer) {
			destField.options[allOptions - 1] = newSpacer;
			allOptions++;
		}
		destField.options[allOptions - 1] = newOption;
		destField.options[allOptions] = addOption;
		destField.selectedIndex = allOptions - 1;
	}

//	END OF DROP-DOWN LIST EDITING //


function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);
}


function AddressLookup(prefix, index) {
	if(!prefix) prefix = '';
	var thisForm = document.getElementById(prefix + 'Postcode');

	if(!isNaN(parseInt(index))) {
		var postcode = thisForm[index].value.toUpperCase()
	} else {
		var postcode = thisForm.value.toUpperCase();
		index = '';
	}

	MM_openBrWindow('address_lookup.asp?pre=' + prefix + '&ind=' + index + '&post=' + postcode,
		'adLookup','status=yes,scrollbars=yes,width=500,height=250')
}

function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);
}



// Validate Email Addy

function test(src){

	var emailReg = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	var test = emailReg.test(src)
	return test;


}


function checkboxSelected(id)
{
    var ctrl = document.getElementsByName(id);

    for(i=0; i<ctrl.length; i++){
	
		if(ctrl[i].checked) {
			return true; 
		}
	}
	
	return false;
}

function radioSelected(id)
{
    var ctrl = document.getElementsByName(id);

    for(i=0; i<ctrl.length; i++){
	
		if(ctrl[i].checked) {
			return true; 
		}
	}
	
	return false;
}

// -->
