var aLoc = new Array(
"Avon",
"Bedfordshire",
"Berkshire",
"Bristol",
"Buckinghamshire",
"Cambridgeshire",
"Cheshire",
"Cleveland",
"Cornwall",
"Cumbria",
"Derbyshire",
"Devon",
"Dorset",
"Durham",
"East Riding of Yorkshire",
"East Sussex",
"Essex",
"Gloucestershire",
"Greater Manchester",
"Hampshire",
"Herefordshire",
"Hertfordshire",
"Humberside",
"Isle of Wight",
"Isles of Scilly",
"Kent",
"Lancashire",
"Leicestershire",
"Lincolnshire",
"London",
"Merseyside",
"Middlesex",
"Norfolk",
"North Yorkshire",
"Northamptonshire",
"Northumberland",
"Nottinghamshire",
"Oxfordshire",
"Rutland",
"Shropshire",
"Somerset",
"South Yorkshire",
"Staffordshire",
"Suffolk",
"Surrey",
"Tyne and Wear",
"Warwickshire",
"West Midlands",
"West Sussex",
"West Yorkshire",
"Wiltshire",
"Worcestershire",

"Antrim",
"Armagh",
"Down",
"Fermanagh",
"Londonderry",
"Tyrone",

"Aberdeen City",
"Aberdeenshire",
"Angus",
"Argyll and Bute",
"Borders",
"Clackmannan",
"Dumfries and Galloway",
"East Ayrshire",
"East Dunbartonshire",
"East Lothian",
"East Renfrewshire",
"Edinburgh City",
"Falkirk",
"Fife",
"Glasgow (City of)",
"Highland",
"Inverclyde",
"Midlothian",
"Moray",
"North Ayrshire",
"North Lanarkshire",
"Orkney",
"Perthshire and Kinross",
"Renfrewshire",
"Roxburghshire",
"Shetland",
"South Ayrshire",
"South Lanarkshire",
"Stirling",
"West Dunbartonshire",
"West Lothian",
"Western Isles",

"Blaenau Gwent",
"Bridgend",
"Caerphilly",
"Cardiff",
"Carmarthenshire",
"Ceredigion",
"Conwy",
"Denbighshire",
"Flintshire",
"Gwynedd",
"Isle of Anglesey",
"Merthyr Tydfil",
"Monmouthshire",
"Neath Port Talbot",
"Newport",
"Pembrokeshire",
"Powys",
"Rhondda Cynon Taff",
"Swansea",
"Torfaen",
"The Vale of Glamorgan",
"Wrexham",

"Channel Islands",
"Isle of Man",

"Aberystwyth University",
"American Intercontinental University",
"Anglia Ruskin University",
"Aston University",
"Bangor University",
"Bath Spa University",
"Birmingham City University (UCE)",
"Bishop Grosseteste University College",
"Boston University",
"Bournemouth University",
"Brunel University",
"Buckinghamshire New University",
"Canterbury Christ Church University",
"Canterbury College",
"Cardiff University",
"City University",
"Coventry University",
"Cranfield University",
"Crichton University Campus",
"De Montfort University",
"Durham University",
"Edge Hill University",
"Glasgow Caledonian University",
"Glyndwr University (NEWI)",
"Guildford College",
"Harper Adams University College",
"Henley Business School",
"Heriot-Watt University",
"Huron University USA in London",
"Imperial College London",
"Keele University",
"Kingston University",
"Lancaster University",
"Leeds Metropolitan University",
"Liverpool Hope University",
"Liverpool John Moores University",
"London Metropolitan University",
"London South Bank University",
"Loughborough University",
"Manchester Business School",
"Manchester Metropolitan University",
"Middlesex University",
"Moray House School of Education",
"Napier University",
"Newcastle University",
"Newman University College",
"Northumbria University",
"Norwich University College of the Arts",
"Nottingham Trent University",
"Oxford Brookes University",
"Queen Margaret University",
"Queen's University Belfast",
"Ravensbourne College of Design and Communication",
"Richmond, The American International University in London",
"Robert Gordon University",
"Roehampton University",
"Schiller International University",
"Sheffield Hallam University",
"Southampton Solent University",
"St Mary's University College (Twickenham)",
"St.Mary's University College (Belfast)",
"Staffordshire University",
"Stranmillis University College",
"Swansea Metropolitan University",
"Swansea University",
"Thames Valley University",
"University Campus Suffolk",
"University College Birmingham",
"University College Falmouth",
"University College London Eastman Dental Institute",
"University College Plymouth St Mark &amp; St John",
"University of Aberdeen",
"University of Abertay",
"University of Bath",
"University of Bedfordshire",
"University of Birmingham",
"University of Bolton",
"University of Bradford",
"University of Brighton",
"University of Bristol",
"University of Buckingham",
"University of Cambridge",
"University of Central Lancashire",
"University of Chester",
"University of Chichester",
"University of Cumbria",
"University of Delaware",
"University of Derby",
"University of Dundee",
"University of East Anglia",
"University of East London",
"University of Edinburgh",
"University of Essex",
"University of Exeter",
"University of Glamorgan",
"University of Glasgow",
"University of Gloucestershire",
"University of Greenwich",
"University of Hertfordshire",
"University of Huddersfield",
"University of Hull",
"University of Kent",
"University of Leeds",
"University of Leicester",
"University of Lincoln",
"University of Liverpool",
"University of London",
"University of Manchester",
"University of Northampton",
"University of Notre Dame",
"University of Nottingham",
"University of Oxford",
"University of Plymouth",
"University of Portsmouth",
"University of Reading",
"University of Salford",
"University of Sheffield",
"University of Southampton",
"University of St Andrews",
"University of Stirling",
"University of Strathclyde",
"University of Sunderland",
"University of Surrey",
"University of Sussex",
"University of Teesside",
"University of the Arts London",
"University of the West of England (UWE Bristol)",
"University of the West of Scotland",
"University of Ulster",
"University of Wales",
"University of Wales College of Medicine Cardiff",
"University of Wales Institute",
"University of Wales, Lampeter",
"University of Wales, Newport",
"University of Warwick",
"University of Westminster",
"University of Winchester",
"University of Wolverhampton",
"University of Worcester",
"University of York",
"York St. John University");

aLoc.sort();

function Complete(obj, evt) {
	 if ((!obj) || (!evt) || (aLoc.length == 0)) {
 	 	return;
  }

  if (obj.value.length == 0) {
  		return;
  }

  var elm = (obj.setSelectionRange) ? evt.which : evt.keyCode;

  if ((elm < 32) || (elm >= 33 && elm <= 46) || (elm >= 112 && elm <= 123)) {
  		return;
  }

  var txt = obj.value.replace(/;/gi, ",");
  elm = txt.split(",");
  txt = elm.pop();
  txt = txt.replace(/^\s*/, "");

  if (txt.length == 0) {
  		return;
  }

  if (obj.createTextRange) {
   	var rng = document.selection.createRange();
  		if (rng.parentElement() == obj) {
   			elm = rng.text;
  	 		var ini = obj.value.lastIndexOf(elm);
  		}
  } else if (obj.setSelectionRange) {
  		var ini = obj.selectionStart;
  }

  for (var i = 0; i < aLoc.length; i++) {
   	elm = aLoc[i].toString();
  		if (elm.toLowerCase().indexOf(txt.toLowerCase()) == 0) {
   			obj.value += elm.substring(txt.length, elm.length);
  	 		break;
  		}
  }

  if (obj.createTextRange) {
  		rng = obj.createTextRange();
  		rng.moveStart("character", ini);
  		rng.moveEnd("character", obj.value.length);
  		rng.select();
  } else if (obj.setSelectionRange) {
  		obj.setSelectionRange(ini, obj.value.length);
  }
}

