function confdel (id,event,idlabel)
	{
	if (confirm("Are you sure you wish to delete this item?\nThis is NOT reversible!"))
			{
			self.location="index.cfm?event="+event+"&"+idlabel+"="+id;
			}	
		
	}


function showHide (div)
	{
		elem = document.getElementById(div);
		
		if (elem.style.display == "none")
			{elem.style.display = "block";}
		else
			{elem.style.display = "none";}	
	}

	
//Confirmation scripts:


function checkmail(email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   return reg.test(email);
}


function validateformUser(idlist)
	{	

		var checkedCount = 0;
		var errors = 0;
		iditem=idlist.split(",");	
			
		for (var i = 0;i<iditem.length;i++)
		{	

		    msg=document.getElementById("ERRORMESSAGE");
			elem=document.getElementById("ERR"+iditem[i]);
			msg.innerHTML="";
			elem.innerHTML="";

			
			if (iditem[i].indexOf("MAIL") > -1)
				{				
				if (!checkmail(document.getElementById(iditem[i]).value))
					{
					errors++;
					elem.innerHTML="You must enter a valid email address";
					}
				}
				
				
			//if (iditem[i].indexOf("CHECKBOX") > -1)
				//{				
				//if (!document.getElementById(iditem[i]).checked)
					//{
					//errors++;
					//elem.innerHTML="You must agree to continue";
					//}
				//}
				


			if (iditem[i].indexOf("PASSWORD") > -1)
				{	
				if (document.forms[0].CONFPASSWORD.value != document.forms[0].PASSWORD.value)
					{
					errors++;
					elem.innerHTML="Confirmation Password must be the same as password";
					}
				}	
			if (iditem[i].indexOf("CAPTCHAFIELD") > -1)
				{	
				if (document.forms[0].MATCH.value.toUpperCase() != document.forms[0].CAPTCHAFIELD.value.toUpperCase())
					{
					errors++;
					elem.innerHTML="Please enter the text displayed in the image.";
					}
				}		
			if (iditem[i]=="FKLISTJOBTYPEID")
				{				
				if (document.getElementById(iditem[i]).selectedIndex == 0)
					{
					errors++;
					elem.innerHTML="Please select a Job Type";
					}
				}	
				
			if (iditem[i]=="FKLISTREGIONID")
				{	

				for (var x=0;x<document.forms[0].FKLISTREGIONID.length;x++)
					{
					if (document.forms[0].FKLISTREGIONID[x].checked)
						{checkedCount=checkedCount+1;}
					}
		
				if (checkedCount == 0)
					{
					errors++;
					elem.innerHTML="Please select a Region";
					}
				}					
			
				{

				
				if (iditem[i].indexOf("APPLICATIONFORM") > -1 || iditem[i].indexOf("UPLOADCV") > -1)
				// the field is one of the upload fields
					{	
					
					if (document.getElementById(iditem[i]).value.indexOf(".doc") == -1 && document.getElementById(iditem[i]).value.indexOf(".rtf") == -1 && document.getElementById(iditem[i]).value.indexOf(".txt") == -1 && document.getElementById(iditem[i]).value.indexOf(".pdf") == -1 )
						{
						
						
						if ((document.getElementById(iditem[i]).value!="" && iditem[i].indexOf("UPLOADCV") != -1) || (iditem[i].indexOf("APPLICATIONFORM") != -1))
									{
									errors++;
									document.getElementById(iditem[i]).value="";
									elem.innerHTML="The File to upload must be one of the following formats:<br />-Microsoft Word Document (.doc)<br />-<b>Rich Text Format Document (.rtf)<br />-Text File (.txt)<br />-Adobe acrobat PDF document (.pdf)";
									}
						}
					}	
				else if (document.getElementById(iditem[i]).value=="")
					{
					errors++;
					elem.innerHTML="This is a required field";
					}
				}	
				
		}	

		if (errors==0)
			{
			return true;
			}	
				else
			{
			msg.innerHTML="Sorry, we could not process your details.<br />Please check the messages on the page for details."
			alert("Sorry, we could not process your details.\nPlease check the messages on the page for details.")
return false;}	
	}
 ;








