function checkMe(id) {

	$.getJSON("json.php", {
		email : $("#" + id).val()
	}, function(tweets) {
		$.res = tweets.resultat;
		if (tweets.email_tab.length != '0')
			$.res2 = tweets.email_tab[0].dns;
		else
			$.res2 = "";
		alertEmailShow($.res, id, $.res2);
	});
	return false;
}

function alertEmailShow(mavar, id, dns) {
	// console.log("ok c est good2 : "+mavar );
	switch (mavar) {
	case 0:
		$('#choices').html(WS_NOTUSER);
		$('#choices').addClass('choices');
		$('#choices').removeClass('nodisplay');
		$('#choicesFrame').addClass('choicesFrame');
		$('#' + id).addClass('red2');
		$('#checkWS').val('0');
		break;
	case 1:
		$('#choices').html(WS_NOTDOMAIN);
		$('#choices').addClass('choices');
		$('#choices').removeClass('nodisplay');
		$('#choicesFrame').addClass('choicesFrame');
		$('#' + id).addClass('red2');
		$('#checkWS').val('0');
		break;
	case 2:
		$('#checkWS').val('0');
		$('#choices').addClass('choices');
		var email = $('#' + id).val();
		var host = email.split('@');
		var text = WS_CHOICES;
		var text2 = text.replace(/\{prop\}/g, host[0] + "@" + dns);
		var text2 = text2.replace(/\{mail\}/g, email);
		var text2 = text2.replace(/\{idJS\}/g, id);
		$('#choices').html(text2);
		$('#choices').removeClass('nodisplay');
		break;
	case 3:
		var res = 0;
		$('#' + id).removeClass('red2');
		$(":input").each(
			function(i) {
				if (($(this).attr("class") == "red2"
					|| $(this).attr("class") == " red2")) {
					res = 1;
				}
				if($(this).val()=="") $(this).removeClass('red2');
			});
		if (res == 0) {
			$('#checkWS').val('1');
			$('#choices').addClass('nodisplay');
		}
		break;
	}
	return false;
};

function SelectMailJS(mail, id) {
	$('#' + id).val(mail);
	closePop();
	checkMe(id);
	return false;
}
