//Carry out tasks when page is loaded
$(document).ready(function(){					   
	
	/*
	$('li#servicesMenu').hover(
		function(){
			$('li#servicesMenu > ul').removeClass('hide').addClass('show');
		},
		function(){
			$('li#servicesMenu > ul').removeClass('show').addClass('hide');
		}	
	);*/
	
	$('li#firmMenu').hover(
		function(){
			$('li#firmMenu > ul').removeClass('hide').addClass('show');
		},
		function(){
			$('li#firmMenu > ul').removeClass('show').addClass('hide');
		}	
	);
	
	$('li#ourPeopleMenu').hover(
		function(){
			$('li#ourPeopleMenu > ul').removeClass('hide').addClass('show');
		},
		function(){
			$('li#ourPeopleMenu > ul').removeClass('show').addClass('hide');
		}	
	);
	
	$('#hearAbout').change( function(){
		choice = $('#hearAbout option:selected').val();
		if( choice == 'Other (please specify)' ){
			$('#otherContainer').removeClass('hide').addClass('show');
		}
		else{
			$('#otherContainer').removeClass('show').addClass('hide');
		}
		
	})
	
	
	$('.contactform').submit(function(){					
		errors = false;
		$('.contactform :input').each(function(){	
			if( $(this).attr('id') != 'other'){									   
				if( $(this).val() == '' ){
					errors = true;	
				}
			}
		});//closing foreach loop of text mandatory fields
				
		if(errors == true){
			alert('Mandatory field left empty! Please input all required information');
			return false;
		}
	});
	
	
	
	
	$('.sidebar-contactform').submit(function(){					
		errors = false;
		$('.sidebar-contactform :input').each(function(){	
			if( $(this).attr('id') != 'other'){									   
				if( $(this).val() == '' ){
					errors = true;	
				}
			}
		});//closing foreach loop of text mandatory fields
				
		if(errors == true){
			alert('Mandatory field left empty! Please input all required information');
			return false;
		}
	});
	
	
	/*
	//OLD left subnav pop out code
	$('ul#leftServicesSubnav > li > a').click( function(){
			if( $('ul#leftServicesSubnav > li > ul.show').parent('li').index() == $(this).parent('li').index() ){
				$('ul#leftServicesSubnav > li > ul.show').removeClass('show').addClass('hide');
			}
			else{
				$('ul#leftServicesSubnav > li > ul').each(function(index){
					$(this).removeClass('show').addClass('hide');	
				});
				var listIndex = $(this).parent('li').index();
				$('ul#leftServicesSubnav > li:eq(' +listIndex+ ') > ul').removeClass('hide').addClass('show');		
			}
	});
	*/
	
	
	
	$('ul#leftServicesSubnav > li > a').click( function(){
			$('ul#leftServicesSubnav > li').children('ul').removeClass('show').addClass('hide');
			$(this).parent().children('ul').addClass('show');		
	});
	
	
	
});//CLOSING DOCUMENT READY




/**
*	GENERAL FUNCTIONS TO USE IN DOCUMENT.READY ABOVE
**/






