/* Partager sur Facebook */
function facebook(ind) {
	lien = window.location.pathname + window.location.search;
	updateFacebook(lien, ind);
	u = location.href;
	t = document.title;
	window.open("http://www.facebook.com/sharer.php?u=" + encodeURIComponent(u) + "&t=" + encodeURIComponent(t), "sharer", "toolbar=0,status=0,width=626,height=436");
	return false;
}

function myspace(ind, T, C, U, L) {
	lien = window.location.pathname + window.location.search;
	updateFacebook(lien, ind);
	targetUrl = 'http://www.myspace.com/index.cfm?fuseaction=postto&' + 't=' + encodeURIComponent(T)
			+ '&c=' + encodeURIComponent(C) + '&u=' + encodeURIComponent(U) + '&l=' + L;
	window.open(targetUrl);
}


function updateFacebook(lien, ind) {
	var httpRequest = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		httpRequest = new XMLHttpRequest();
		if (httpRequest.overrideMimeType) {
			httpRequest.overrideMimeType('text/html');
		}
	}
	else {
		if (window.ActiveXObject) { // IE
			try {
				httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e) {
				try {
					httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e) {}
			}
		}
	}
	if (!httpRequest) {
		return false;
	}
	if (ind == "")
		page = "../";
	else
		page = "";
	httpRequest.open('GET', page + "data/ajax/ajax_facebook.php?lien=" + lien, true);
	httpRequest.send(null);
}