$(document).ready(function(){
	
	$('#container').corner('20px');

	if($(".section-head").length > 0){

		$('.section-head').corner('bevel tl br');
	
	}
	if($("#staff-profiles").length > 0){

		$('.staff').hide();
	
	}	
	if($("#staff-list").length > 0){
	
		$.getScript("/_jscript/jquery.lightbox_me.js");
		$('#staff-list').corner('tl bl');
		$('.show').click(function() {
			var name = $(this).attr('name');
			$("#" + name).lightbox_me({
				centered: true
			});
			return false;
		});	
		
	}		
	if($("#contact-us-form").length > 0){
		
		$('#enqtype').change(function(){
		var enq = $(this).val();
		if(enq == 'other'){
			$('p#other_nature').slideDown('slow');
		} else {
			$('p#other_nature').slideUp('slow');		
		}
		return false;
		});
		
		$("#subenq").click(function() {
	
			$('#subenq').attr('disabled','disabled').attr('value','Submitting...');

			var text = $("textarea#enquiry").val();
			var enq = $("select#enqtype").val();
			var email = $("input#email").val();
			var name = $("input#name").val();
			if($("#other_nature").is(':visible')){
				var other_enq = $("input#other_enq").val();
				var dataString = 'name='+ name + '&email=' + email + '&text=' + text + '&enq=' + enq + '&oe=' + other_enq;
			} else {
				var dataString = 'name='+ name + '&email=' + email + '&text=' + text + '&enq=' + enq;
			}
			
			$.ajax({
				type: "POST",
				url: "/incl/process_contact_form.php",
				data: dataString,
				success: function(data) {
					if(data == 'err'){
						$('div#cform-err').html('There has been an error submitting your form!  Try again.');
						$('#subenq').attr('disabled','').attr('value','Submit Enquiry');
						return false;
					} else if (data == 'err2') {
						$('div#cform-err').html('You chose "Other" nature of enquiry but provided no details!  Try again.');
						$('#subenq').attr('disabled','').attr('value','Submit Enquiry');
						return false;						
					} else {
						$('div#cform-status').html('Thanks!  Your enquiry has been sent!<br /><a href="/contact-us/index.php">Click here to enquire again.</a>');
						return false;
					}
				}  
			});
		
		});

	}

	if($("div.legal-services-content-box").length > 0){

		$("div.legal-services-content-box").hide();
		$('#legal-services-list li a').click(function (e) {
			e.preventDefault();											   
			$("div.legal-services-content-box").hide().filter(this.hash).fadeIn("slow");			
			return false;
		}).filter(':first').click();
		
	}
	
});
