var result = "";
function RunAJAX(file, vars) 
{
   $.ajax({
   url: file,
   type: 'POST',
   dataType: 'html',
   data: vars,
   timeout: 5000,
   async:false,
   error: function(){
    RunAJAX(file, vars);
   },
   success: function(html){
	   result = html;
   }
  });
}

function alphenumericPlate(plate){
	
	plate = plate.replace(/[^a-zA-Z0-9]/g, "");
	return plate.toUpperCase();

}

$(document).ready(function(){
						   

// ----searchPlate----
$('#plate_search').click(function()
{
	$('#Plate').val(alphenumericPlate($('#Plate').val()));
	var platestate = $('#Plate').val()+'-'+$('#State').val();
	RunAJAX('modules/actions/search.php','platestate='+platestate);
	if(result == 'no') 
	{
		$('#leave_message').attr('href',base+'send/'+platestate);
		$('#search_box').fadeOut(250,function(){ $('#search_box2').fadeIn(250,function(){ $('#member_not_found').fadeIn(125);} );});
	}
	else
	{
		location.href=base+'profile/'+platestate;	
	}
});
// ----searchPlate----



});