


$(document).ready(function()
{
	$('h5').corner('tl tr 5px');
	$('#page-tag').corner('tl tr 10px cc:#A9ABAE');	
	$('#main-nav li ul').corner('8px');
	$('.rounded-box').corner('bl br 5px');
	
	
	// add tooltips to membership table
	
	$("#membership-table th.membership-info").each(function(i){
	
		var api = $(this).simpletip().simpletip();
		api.load(this.id);
	
	});
	
	// shade membership table (if it exists)
	
	if ( $('#membership-table').length > 0 )
	{
		var _rowShade = false;
		
		$('#membership-table tr').each(function(){

			var tr = $(this);
			
			if ( _rowShade == true && ! tr.hasClass('footer'))
			{
				tr.css('background','#E7E7E7');	
			}
			
			_rowShade = ! _rowShade;
					
		});
		
		// show prices
		currencySelector('GBP');
		$("#currencySelect").val('GBP');
		
		
		
	}
});

function currencySelector(_cur)
{
	$("#membership-table .currency").css('display','none');
	$("#membership-table .cur-"+_cur).fadeIn();
}


function validateMembershipForm()
{
	var _errors = '';
	
	if ( $('#txtFirstname').val() == '' )
		_errors += " * Please enter your firstname\n";
	
	if ( $('#txtLastname').val() == '' )
		_errors += " * Please enter your lastname\n";
			
	if ( $('#txtAddress1').val() < 2 )
		_errors += " * Please enter your address\n";
		
	if ( $('#txtCity').val() < 2 )
		_errors += " * Please enter your city\n";
			
	if ( $('#txtCounty').val() < 2 )
		_errors += " * Please enter your county\n";
	
	if ( $('#txtPostcode').val() < 2 )
		_errors += " * Please enter your postcode\n";

	if ( $('#txtCounty').val() < 2 )
		_errors += " * Please enter your county\n";
			
	if ( $('#txtTelephone').val() < 2 )
		_errors += " * Please enter your telephone number\n";
			
	if ( $('#txtEmail').val() < 2 )
		_errors += " * Please enter your email\n";
		
	if ( ! $('#checkCharter').attr('checked') )
		_errors += " * You must indicate that you accept our charter\n";
	
	if ( ! $('#checkTerms').attr('checked') )
		_errors += " * You must indicate that you have read and accept our terms and conditions\n";
	
			
	if ( _errors == '' )
	{
		return true;
	}
	
	alert("Your request could not be processed due to the following error messages:\n\n"+_errors+"\nPlease correct them and try again");
	return false;
}


function validateContactForm()
{
	var _errors = '';
	
	if ( $('#txtFirstname').val() == '' )
		_errors += " * Please enter your firstname\n";
	
	if ( $('#txtLastname').val() == '' )
		_errors += " * Please enter your lastname\n";
			
	if ( $('#txtTelephone').val() < 2 )
		_errors += " * Please enter your telephone number\n";
			
	if ( $('#txtEmail').val() < 2 )
		_errors += " * Please enter your email\n";
				
	if ( $('#txtMessage').val() < 2 )
		_errors += " * Please enter your message\n";
				
	if ( _errors == '' )
	{
		return true;
	}
	
	alert("Your request could not be processed due to the following error messages:\n\n"+_errors+"\nPlease correct them and try again");
	return false;
}

function validateMailingListForm(_form)
{
	var _errors = '';
	
	if ( _form.firstname.value == '' )
		_errors += " * Please enter your firstname\n";
			
	if ( _form.email.value.length < 2 )
		_errors += " * Please enter your email\n";
				
	if ( _errors == '' )
	{
		return true;
	}
	
	alert("Your request could not be processed due to the following error messages:\n\n"+_errors+"\nPlease correct them and try again");
	return false;
}



function validateVacancyForm()
{
	var _errors = '';
	
	if ( $('#txtFirstname').val() == '' )
		_errors += " * Please enter your firstname\n";
	
	if ( $('#txtLastname').val() == '' )
		_errors += " * Please enter your lastname\n";
			
	if ( $('#txtAddress1').val() < 2 )
		_errors += " * Please enter your address\n";
		
	if ( $('#txtCity').val() < 2 )
		_errors += " * Please enter your city\n";
			
	if ( $('#txtCounty').val() < 2 )
		_errors += " * Please enter your county\n";
	
	if ( $('#txtPostcode').val() < 2 )
		_errors += " * Please enter your postcode\n";

	if ( $('#txtCounty').val() < 2 )
		_errors += " * Please enter your county\n";
			
	if ( $('#txtTelephone').val() < 2 )
		_errors += " * Please enter your telephone number\n";
			
	if ( $('#txtEmail').val() < 2 )
		_errors += " * Please enter your email\n";

	if ( $('#txtVacancyTitle').val() < 2 )
		_errors += " * Please enter your vacancy title\n";

	if ( $('#txtVacancyDescription').val() < 2 )
		_errors += " * Please enter your vacancy description\n";

	if ( $('#txtLocation').val() < 2 )
		_errors += " * Please enter your vacancy location\n";
			
	if ( _errors == '' )
	{
		return true;
	}
	
	alert("Your request could not be processed due to the following error messages:\n\n"+_errors+"\nPlease correct them and try again");
	return false;
}




function validateConsultantForm()
{
	var _errors = '';
	
	if ( $('#txtFirstname').val() == '' )
		_errors += " * Please enter your firstname\n";
	
	if ( $('#txtLastname').val() == '' )
		_errors += " * Please enter your lastname\n";
			
	if ( $('#txtAddress1').val() < 2 )
		_errors += " * Please enter your address\n";
		
	if ( $('#txtCity').val() < 2 )
		_errors += " * Please enter your city\n";
			
	if ( $('#txtCounty').val() < 2 )
		_errors += " * Please enter your county\n";
	
	if ( $('#txtPostcode').val() < 2 )
		_errors += " * Please enter your postcode\n";

	if ( $('#txtCounty').val() < 2 )
		_errors += " * Please enter your county\n";
			
	if ( $('#txtTelephone').val() < 2 )
		_errors += " * Please enter your telephone number\n";
			
	if ( $('#txtEmail').val() < 2 )
		_errors += " * Please enter your email\n";
	
	if ( $('#txtMessage').val() < 2 )
		_errors += " * Please enter your message\n";		
			
	if ( _errors == '' )
	{
		return true;
	}
	
	alert("Your request could not be processed due to the following error messages:\n\n"+_errors+"\nPlease correct them and try again");
	return false;
}
