function vAgency(frm){
	if(frm.txtCompanyName.value == ""){alert("Please enter the company name.");frm.txtCompanyName.focus();return false;}
	if(frm.txtFName.value == ""){alert("Please enter the first name of the contact.");frm.txtFName.focus();return false;}
	if(frm.txtLName.value == ""){alert("Please enter the last name of the contact.");frm.txtLName.focus();return false;}
	if(frm.txtEmail.value == ""){alert("Please enter the email address of the contact.");frm.txtEmail.focus();return false;}
	if(frm.txtUsername.value == ""){alert("Please enter a username for the contact.");frm.txtUsername.focus();return false;}
	if(frm.txtPassword.value == ""){alert("Please enter a password for the contact.");frm.txtPassword.focus();return false;}
}
function vLogin(frm){
	if(frm.txtUsername.value == ""){alert("Please enter your username.");frm.txtUsername.focus();return false;}
	if(frm.txtPassword.value == ""){alert("Please enter your password.");frm.txtPassword.focus();return false;}
}
function vJob(frm){
	if(frm.csvClientContacts.value == ""){alert("Please select the contact(s) for the job.");frm.csvClientContacts.focus();return false;}
	if(frm.txtJobRef.value == ""){alert("Please enter the job reference number.");frm.txtJobRef.focus();return false;}
	if(frm.txtJobTitle.value == ""){alert("Please enter the job title.");frm.txtJobTitle.focus();return false;}
	if(frm.txtLocation.value == ""){alert("Please enter the job location.");frm.txtLocation.focus();return false;}
	if(frm.txtBriefDesc.value == ""){alert("Please enter a brief job description.");frm.txtBriefDesc.focus();return false;}
	if(frm.txtAgencies.value == ""){alert("Please select the agencies dealing with this job.");frm.txtAgencies.focus();return false;}
	if(frm.txtCSEndDateDay.value == "" || frm.txtCSEndDateMonth.value == "" || frm.txtCSEndDateYear.value == ""){alert("Please select a closing date for this job.");frm.txtJobTitle.focus();return false;}
}
function vJobAcceptanceStep1(frm){
	if(frm.candidate_id.value == ""){alert("Please select the candidate for the job.");frm.candidate_id.focus();return false;}
	if(frm.agency_id.value == ""){alert("Please select the Agency for the job.");frm.agency_id.focus();return false;}
	if(frm.client_contact_id.value == ""){alert("Please select the Hiring Manager/Client Contact for the job.");frm.client_contact_id.focus();return false;}
}
function vJobAcceptanceRecordEditor(frm){
	if(frm.accepted_salary.value == ""){alert("Please enter a salary/pay rate.");frm.candidate_id.focus();return false;}
}
function vClient(frm){
	if(frm.txtCompanyName.value == ""){alert("Please enter the company name.");frm.txtCompanyName.focus();return false;}
	if(frm.txtWebAddr.value == ""){alert("Please enter the website address of the client.");frm.txtWebAddr.focus();return false;}
}
function vContact(frm){
	if(frm.txtClient.value == ""){alert("Please select a client for the new contact.");frm.txtClient.focus();return false;}
	if(frm.txtUsername.value == ""){alert("Please enter a username for the new contact.");frm.txtUsername.focus();return false;}
	if(frm.txtPassword.value == ""){alert("Please enter a password for the new contact.");frm.txtPassword.focus();return false;}
	if(frm.txtFName.value == ""){alert("Please enter the first name of the new contact.");frm.txtFName.focus();return false;}
	if(frm.txtLName.value == ""){alert("Please enter the last name of the new contact.");frm.txtLName.focus();return false;}
	if(frm.txtEmail.value == ""){alert("Please enter the email address of the new contact.");frm.txtEmail.focus();return false;}
}
function vCompetency(frm){
	if(frm.competency_title.value == ""){alert("Please enter a competency title.");frm.competency_title.focus();return false;}
	if(frm.competency_definition.value == ""){alert("Please enter a competency definition.");frm.competency_definition.focus();return false;}
}
function vCandidate(frm){
	if(frm.txtFName.value == ""){alert("Please enter the first name.");frm.txtFName.focus();return false;}
	if(frm.txtLName.value == ""){alert("Please enter the last name.");frm.txtLName.focus();return false;}
	if(frm.txtEmail.value == ""){alert("Please enter the email.");frm.txtEmail.focus();return false;}
	if(frm.txtTelephone.value == ""){alert("Please enter the telephone.");frm.txtTelephone.focus();return false;}
}
function vRecruitmentArea(frm){
	if(frm.recruitment_area_name.value == ""){alert("Please enter the recruitment area name.");frm.recruitment_area_name.focus();return false;}
	if(frm.recruitment_area_list_weight.value == ""){alert("Please select the recruitment area list weight.");frm.recruitment_area_list_weight.focus();return false;}
}
function getObj(id){
	if(document.all)
		return document.all[id];
	else
		return document.getElementById(id);
}
function showHideElement(tdId, aId, ShowText, HideText){
	var aLink = getObj(aId);
	var td = getObj(tdId);
	if(td.style.display == "none"){
		td.style.display = "";
		aLink.innerHTML = "<b>" + HideText + "</b>";
	}else{
		td.style.display = "none";
		aLink.innerHTML = "<b>" + ShowText + "</b>";
	}
}
function vClientInfo(frm){
	if(frm.txtClientID.value == ""){alert("Please select the client.");frm.txtClientID.focus();return false;}
	if(frm.txtTitle.value == ""){alert("Please enter a title.");frm.txtTitle.focus();return false;}
	if(frm.txtDesc.value == ""){alert("Please enter a description.");frm.txtDesc.focus();return false;}
	if(frm.txtDocument.value != "")
		if(frm.txtDocumentTitle.value == ""){alert("Please enter a document title.");frm.txtDocumentTitle.focus();return false;}
}
function vMasterAgency(frm){
	if(frm.txtCompanyName.value == ""){alert("Please enter the company name.");frm.txtCompanyName.focus();return false;}
	if(frm.txtFName.value == ""){alert("Please enter the first name of the contact.");frm.txtFName.focus();return false;}
	if(frm.txtLName.value == ""){alert("Please enter the last name of the contact.");frm.txtLName.focus();return false;}
	if(frm.txtEmail.value == ""){alert("Please enter the email address of the contact.");frm.txtEmail.focus();return false;}
//	if(frm.txtUsername.value == ""){alert("Please enter a username for the contact.");frm.txtUsername.focus();return false;}
	if(frm.txtPassword.value == ""){alert("Please enter a password for the contact.");frm.txtPassword.focus();return false;}
}

function vJobAdvert(frm){
	if(frm.advert_type.value == ""){alert("Please select the advert type.");frm.advert_type.focus();return false;}
	if(frm.advert_recipients.value == ""){alert("Please enter the advert recipients");frm.advert_recipients.focus();return false;}
	if(frm.target_url.value == ""){alert("Please enter the target URL for the advert");frm.target_url.focus();return false;}
}

function vUpload(frm){
	if(frm.txtFileGroup.value == ""){alert("Please select the type of file you are uploading.");frm.txtFileGroup.focus();return false;}
	frm.action += "&filegroup=" + frm.txtFileGroup.value
}

function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

function checkSelectAll(callingField, applyField)
{
	If(callingField.Checked == true)
	{
		for (i = 0; i < applyField.length; i++)
			applyField[i].checked = false ;
		callingField.Checked = false;
	}
	Else
	{	
		for (i = 0; i < applyField.length; i++)
			applyField[i].checked = true ;
		callingField.Checked = true;
	}
}

