function data_check(id,type,country_span)
{
	var value =  $(id).val();
	if (country_span != undefined )
	{
		var country = $(country_span+' [name=country]').val();	
		if (country != 'Canada' && country != 'USA' && type == 'phone')
		{
			return; // skip number check
		}
	}
	
	if (value != '')
	{
		$.getJSON("/ajax/core/data_check.html",
		{type: type, value:value},
	        function(data){
				  if (data.status == true)
				  {
					  $(id).val(data.value);
				  }
				  else
				  {
				  	var type_desc = 'value';
				  	if (type == 'phone')
				  	{
				  		type_desc = 'phone number';
				  	}
				  	else 
				  	{
				  		type_desc = type;
				  	}
				  	$('#'+id).focus();
				  	alert('Please enter a valid '+type_desc+'.');
				  }
	        });
	 }
}
