$(document).ready(function(){
	var input = $('#mls_city');
	var originalvalue = input.val();
	input.focus( function(){
		if( $.trim(input.val()) == originalvalue ){
			input.val('');
			input.css('color','#000');
		}
	});
	input.blur( function(){
		if( $.trim(input.val()) == '' ){
			input.val(originalvalue);
			input.css('color','#ccc');
		}
	});
	
	$('#mls_rental').click(function(e){
		if($(this).is(':checked')){
			$('#mls_foreclosure').attr({
			   'checked':false,
			   'disabled':true
			});
			$('#mls_resale').attr({
				'checked':false,
				'disabled':true				  
			});
		}
		else{
			$('#mls_foreclosure').attr({
			   'checked':false,
			   'disabled':false
			});
			$('#mls_resale').attr({
			   'checked':true,
			   'disabled':false
			});
		}
	});
	
	$('#mls_foreclosure').click(function(e){
		if($(this).is(':checked')){
			$('#mls_rental').attr({
			   'checked':false,
			   'disabled':true
			});
		}
		else{
			$('#mls_rental').attr({
			   'checked':false,
			   'disabled':false
			});
		}
	});
	
	$('#mls_city_selector').click(function(e){
		originalvalue = 'Enter City';
		if(input.val()=='Enter Zip Code' || input.val()=='Enter County' || input.val()=='Enter MLS #'){
			input.val('Enter City');
		}
		input.attr('name','city');
		$('#mls_city_selector').attr('class','round_box_selected');
		$('#mls_zip_selector').attr('class','round_box');
		$('#mls_number_selector').attr('class','round_box');
		$('#mls_county_selector').attr('class','round_box');
	});
	
	$('#mls_zip_selector').click(function(e){
		originalvalue = 'Enter Zip Code';
		if(input.val()=='Enter City' || input.val()=='Enter County' || input.val()=='Enter MLS #'){
			input.val('Enter Zip Code');
		}
		input.attr('name','zip');
		$('#mls_city_selector').attr('class','round_box');
		$('#mls_zip_selector').attr('class','round_box_selected');
		$('#mls_number_selector').attr('class','round_box');
		$('#mls_county_selector').attr('class','round_box');
	});
	
	$('#mls_county_selector').click(function(e){
		originalvalue = 'Enter County';
		if(input.val()=='Enter City' || input.val()=='Enter Zip Code' || input.val()=='Enter MLS #'){
			input.val('Enter County');
		}
		input.attr('name','county');
		$('#mls_city_selector').attr('class','round_box');
		$('#mls_zip_selector').attr('class','round_box');
		$('#mls_number_selector').attr('class','round_box');
		$('#mls_county_selector').attr('class','round_box_selected');
	});
	
	$('#mls_number_selector').click(function(e){
		originalvalue = 'Enter MLS #';
		if(input.val()=='Enter City' || input.val()=='Enter Zip Code' || input.val()=='Enter County'){
			input.val('Enter MLS #');
		}
		input.attr('name','number');
		$('#mls_city_selector').attr('class','round_box');
		$('#mls_zip_selector').attr('class','round_box');
		$('#mls_county_selector').attr('class','round_box');
		$('#mls_number_selector').attr('class','round_box_selected');
	});
	
	
	/*if($('#mls_city').length>0){
		$('#mls_city').focus(function(e){
			$('#mls_city').val('');
			$('#mls_city').css('color','#fff');
		});
		$('#mls_city').blur(function(e){
			if($('#mls_city').val()==''){
				$('#mls_city').val('Enter City');
				$('#mls_city').css('color','#ccc');
			}
		});
	}*/
});

function check_mls_search(){
	var div = $('#mls_city').val();
	if(div.indexOf('Enter ') > -1){
		alert('Please enter a city/county/zip code');
		return false;
	}
	return true;
}