$(function() {

	 $('#image img').css('display','block');
    $('#image').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		random: 1,
		speed: 2000
	});

	
	



var currentPath = window.location.pathname;
	var changePath = "<?php echo $path?>";
	var place = currentPath.replace(changePath, "");

	$('ul#list1 li a').each(function(index){

		var target = $(this).attr('href');
		var target = target.replace(changePath, "");

		if(target == place){

			$(this).addClass("current");
			


		}

	});
	
	

	
	
	
	
	$('#property-appraisal').submit(function(){
		
		
		
		//reset the red colour if set and delete all the span texts inittially
		$('label').css('color','#000000');
		
		$('form span').text('');
			
			
		
		
		var allInputs = $(':input.required');
		var error = false;
		
	
		
		
		
		
		allInputs.each(function(){
				
			var inputName = $(this).attr('name');
			
			
			var value = $('[name|="'+inputName+'"]').val();
			
			if(value == ""){
				
				
				$('label[for|="'+inputName+'"]').css('color','#FF0000');
				
				$('label[for="'+inputName+'"]').next('input').next('span').text('please enter the '+inputName);
				
				$('label[for="'+inputName+'"]').next('select').next('span').text('please enter the '+inputName);
				
				error = true;
				

				
			}
			
			

			
		});
		
		if(error == false){
			
			return true;
			
		}else{
			
			return false;	
			
		}
	});//end of form submittion script
	
	
});
