function chooseOption(value){
	/*if (document.getElementById){
		var ctl = document.getElementById("reciprow");
		if (value)
			ctl.style.display = "";
		else
			ctl.style.display = "none";
	}*/
}
function valideConditions(moi){
	if (document.getElementById){
		var ctl = document.getElementById("gogogo");
		ctl.disabled =  !moi.checked;
	}
}
function openMessage(p1,p2) {
	document.location.href = 'mailto:'+p2+'@'+p1;
	return(void(0));
}
$().ready(function() {

	$.get(realpath+"/token.php", function(txt){
		$("#validator").append('<input type="hidden" name="ts" id="ts" value="'+txt+'" />');
		$("#contactform").append('<input type="hidden" name="ts" id="ts" value="'+txt+'" />');
	});

	$("a.hitman").click( function (event){
		event.preventDefault();
		var togo = $(this).attr("href");
		//post en ajax les infos
		$.ajax({
			type: "POST",
			url: realpath+"/cl.php",
			data: "id="+$(this).attr("id").replace("id_", "")+"&ts="+$("#ts").attr("value"),
			timeout: 1000,
			complete: function (XMLHttpRequest, textStatus) {
				document.location = togo;
			}
		});
	});

	$("#grabbsite").click( function (event){
		event.preventDefault();
		$.ajax({
			type: "POST",
			url: realpath+"/grabbsite.php",
			data: "url="+$.trim($("#URL").val()),
			timeout: 10000,
			beforeSend: function(XMLHttpRequest){
				$("#grabbsite").hide();
				$("#waiting").show();
			},
			success: function(data, textStatus){
				var items = data.split("||@||");
				if (items[0]) $("#TITLE").val(items[0].replace("titre=", ""));
				if (items[1]) $("#DESCRIPTION").val(items[1].replace("description=", ""));
				if (items[2]) $("#OWNER_EMAIL").val(items[2].replace("email=", ""));
				if (items[3]) $("#URL").val(items[3].replace("url=", ""));
				//alert(data);
			},
			error: function(XMLHttpRequest, textStatus, errorThrown) {
				$("#waiting").hide();
				$("#grabbsite").show();
			},
			complete: function (XMLHttpRequest, textStatus) {
				$("#waiting").hide();
				$("#grabbsite").show();
			}
		});
	});

});