	var objectinit=0;

	function initcountyobject()   {
		var szInfo, arryInfo, subarray, maxElements, i, doc;
		doc = document.forms.theform;
		szInfo = doc.countylist.value;
		objcountylist = new Object();
		arryInfo = szInfo.split("|");
		maxElements = arryInfo.length;
		objcountylist.regioncode= new Array();
		objcountylist.countyname= new Array();
		objcountylist.countycode = new Array();
		i = 0;
		while ( i < maxElements ) {
			subarray=arryInfo[i].split("-");
			objcountylist.countycode[i] = subarray[0];
			objcountylist.countyname[i] = subarray[1];
			objcountylist.regioncode[i] = subarray[2];
			i++;
			}
		return;
		}

	function popup_noreturn(URL,winwidth,winheight,doscroll)  {
		day = new Date();
		id = day.getTime();
		pleft=(screen.width-winwidth)/2;
		ptop=(screen.height-winheight)/2;
		eval("page" + id + " = window.open('"+URL+"', '" + id + "', 'toolbar=0,scrollbars="+doscroll+",location=0,statusbar=0,menubar=0,resizable=1,width="+winwidth+",height="+winheight+",left="+pleft+",top="+ptop+"');");
		}

	function showhidenext()  {
		doc=document.theform;
		psel=doc.positiontype.selectedIndex;
		positiontype=doc.positiontype.options[psel].value;
		switch (positiontype)   { 
			case "1": doc.hourlyrate.style.visibility="visible";  
					doc.hourlyrate.style.width="90px";
					doc.salary.style.visibility="hidden";  
					break;
			case "2": doc.hourlyrate.style.visibility="hidden";  
					doc.hourlyrate.style.width="0px";
					doc.salary.style.visibility="visible";  
					break;
			default: doc.hourlyrate.style.visibility="visible";  
					doc.hourlyrate.style.width="90px";
					doc.salary.style.visibility="visible";  
					break;
			}
		}
	
	function showcounties(regioncode) 	{
		var doc, countyselect, objcounty, maxcounties, i;
		if (objectinit==0)  initcountyobject(); 
		doc = document.forms.theform;
		countyselect = doc.prefcounty;
		
		// clear any current option entries
		countyselect.length = 0;
		// if any region
		if (regioncode==11) { countyselect.options[countyselect.options.length] = new Option("Select region..", "0"); }
		else   {
			maxcounties = objcountylist.regioncode.length
			countyselect.options[countyselect.options.length] = new Option("WHOLE REGION", "0");
			for (i = 0; i < maxcounties; i++) {
				if  (objcountylist.regioncode[i] == regioncode) {
					countyselect.options[countyselect.options.length] = new Option(objcountylist.countyname[i], objcountylist.countycode[i]);
					}
				}
			}
		return;
		}

	function CheckForm()   {
		var msg="";
		doc=document.theform;
		if (trim(doc.title.value)=="")  { msg=msg+"Your Title is missing..\n";doc.title.focus(); }
		if (trim(doc.firstname.value)=="")  { msg=msg+"Your First Name(s) are missing..\n";doc.firstname.focus(); }
		if (trim(doc.surname.value)=="")  { msg=msg+"Your Surname is missing..\n";doc.surname.focus(); }
		if (trim(doc.postcode.value)=="")  { msg=msg+"Your Postcode is missing..\n";doc.postcode.focus(); }
		if (trim(doc.position.value)=="")  { msg=msg+"The details of the Position you are looking for are missing..\n";doc.position.focus(); }
		if (trim(doc.skillsets.value)=="")  { msg=msg+"Your Skillsets are missing..\n";doc.skillsets.focus(); }
		email=doc.email.value;	
		if (email==""||email.indexOf("@")<1||email.indexOf(".")<1)  { msg=msg+"Your E-mail address is either missing or in an invalid format..\n";doc.email.focus(); }
		psel=doc.positiontype.selectedIndex;
		ptype=doc.positiontype.options[psel].value;
		switch (ptype)   {
			case "1":if (doc.hourlyrate.selectedIndex==0)   { msg=msg+"Please select an Hourly rate..\n";doc.hourlyrate.focus(); }
					break;
			case "2":if (doc.salary.selectedIndex==0)   { msg=msg+"Please select a Salary..\n";doc.salary.focus(); }
					break;
			default:if (doc.hourlyrate.selectedIndex==0)   { msg=msg+"Please select an Hourly rate..\n";doc.hourlyrate.focus(); }
					if (doc.salary.selectedIndex==0)   { msg=msg+"Please select a Salary..\n";doc.salary.focus(); }
					break;
			}
		if (trim(doc.username.value)=="")  { msg=msg+"Your Username is missing..\n";doc.username.focus(); }
		password=trim(doc.password.value);
		password1=trim(doc.password1.value);
		if (password!=password1) { msg=msg+"The 2 Passwords do not match..\n";doc.password1.focus(); }
		else { if (password=="") { msg=msg+"Your Password is missing..\n";doc.password.focus(); } }	
		if (msg!="")  { alert("ABORTED.\n\n"+msg+"\n"); return false; }  
		else  { doc.submit(); return true; }
		}


