// //////////////////////////////////////////////////////////////////////////////

// Customer account validation

// //////////////////////////////////////////////////////////////////////////////


function ValidateAccount(f)
	{
	var result = false;

	if ( (f.firstname.value=="") || (f.lastname.value=="") )
			{
			alert('Please enter your first name and last name');
			}

	else if  (f.email.value=="")
			{
			alert('Please enter your email address');
			}


	else if ( (f.password.value=="") || (f.password2.value=="")  )
			{
			alert('Please enter and confirm your password');
			}

	else if  ( f.password.value != f.password2.value )  
			{
			alert('Your password was not confirmed, please enter it again');
			}


	else
		result = true;
		
	return result;		
	}



// //////////////////////////////////////////////////////////////////////////////

// Customer registration validation

// //////////////////////////////////////////////////////////////////////////////


function ValidateRegistration(f)
	{
	var result = false;

	if ( (f.firstname.value=="") || (f.lastname.value=="") )
			{
			alert('Please enter your first name and last name');
			}


	else if  (f.email.value=="")
			{
			alert('Please enter your email address');
			}


	else if ( (f.password.value=="") || (f.password2.value=="")  )
			{
			alert('Please enter and confirm your password');
			}

	else if  ( f.password.value != f.password2.value )  
			{
			alert('Your password was not confirmed, please enter it again');
			}

	else if (f.country.value == "9999")
			{
			alert('Please enter your country');
			}


	else if  (f.address.value=="")
			{
			alert('Please enter your email address');
			}
	else if  (f.city.value=="")
			{
			alert('Please enter your city');
			}
	else if  (f.county.value=="")
			{
			alert('Please enter your state');
			}
	else if  (f.postalcode.value=="")
			{
			alert('Please enter your postal code or zip code');
			}


		else
			result = true;
		
	return result;		
	}





// //////////////////////////////////////////////////////////////////////////////

// Members Directory, CPD, and Job Seekers / Vacant

// //////////////////////////////////////////////////////////////////////////////
function cpdpopup(cpdid,action)
{
	var mywin=window.open('cpdview_popup.aspx?cpdid=' + cpdid + '&action=' + action, 'viewcpd', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=481,height=480' );
	mywin.focus();
}

function jobseekerpopup(jobid,action)
{
	var mywin=window.open('jobseeker_popup.aspx?jobid=' + jobid + '&action=' + action, 'viewjob', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=481,height=580' );
	mywin.focus();
}

function jobvacantpopup(jobid,action)
{
	var mywin=window.open('jobvacant_popup.aspx?jobid=' + jobid + '&action=' + action, 'viewvacancy', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=481,height=599' );
	mywin.focus();
}

function directorypopup(customerid)
{
	var mywin=window.open('directoryview_popup.aspx?customerid=' + customerid, 'viewmember', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=481,height=480' );
	mywin.focus();
}

function ccmailviewer(sendto)
{
	var mywin=window.open('ccmailviewer.aspx?sendto=' + sendto + '&amp;action=2', 'mailcomposer', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=481,height=480' );
	mywin.focus();
}


function ValidateJobVacant(f)
	{
	var result = false;

	if  (f.jobtitle.value=="")
			{
			alert('Please enter the job title');
			}

	else if  (f.positionrequired.value=="")
			{
			alert('Please enter a description of the job');
			}

	else if  (f.contactorganisation.value=="")
			{
			alert('Please enter the name of the organisation or employer');
			}

	else if  (f.location.value=="")
			{
			alert('Please enter the location (city or state) of the job');
			}


	else if  (f.sectorid.value==0)
			{
			alert('Please state the industry sector for this job');
			}



	else if  (f.minsalary.value=="")
			{
			alert('Please enter the salary range for this job');
			}
	else if  (f.qualifications.value=="")
			{
			alert('Please enter details of any qualifications required for this job');
			}
	else if  (f.experience.value=="")
			{
			alert('Please enter details of experience required');
			}
	else if  (f.contactname.value=="")
			{
			alert('Please enter the contact details for this job vacancy');
			}
	else if  (f.contacttel.value=="")
			{
			alert('Please enter a contact telephone number for this job vacancy');
			}
		else
			result = true;
		
	return result;		
	}
