function ajaxreq(type) {
	if (type == '' || (type != 'accountname' && type != 'email' && type != 'referral' && type != 'displayname'))
		return false;
	var string = jQuery('[name="'+type+'"]').val();
	if (string == '' && type != 'referral') {
		changeinputcolor(type, 'red');
		return false
	}	
	jQuery.get('custom/ajax.php?ajax&'+type+'='+string, function (data) {
		if (data == '0') {
			changeinputcolor(type, 'red');
		}
		if (data == '1') {
			changeinputcolor(type, 'green');
		}
		if (data == '2') {
			changeinputcolor(type, 'orange');
		}
	});
}

function changeinputcolor(type, color) {
	var element = jQuery('[name="'+type+'"]');
	if (color == 'red') {
		bordercolor = 'FF0000';
	} else if (color == 'orange') {
		bordercolor = 'FF8040';
	} else if (color == 'green') {
		bordercolor = '00FF00';
	}
	element.attr('style', 'border: 1px solid #'+bordercolor);
}
