//if($(document).ready and $("a.thickbox").click) {
//
//	 $(document).ready(function() {
//	   $("a.thickbox").click(function() {
//	     window.scrollTo(0,0);
//	   });
//	 });
 //}
function AMConfirmSending()
{
	var AMcomment	= document.getElementById('AMcomment').value;
	var AMverif		= document.getElementById('AMverif').value;
	var AMId		= document.getElementById('idContribution').value;

	AMerror = (AMverif == "") ? 'Word Verification- Field Required !\n' : "";
	if ( AMerror == "" ){
		url = "/screens/blogPage/viewBlog/sw_alertModerator.php?comment=" + encodeURIComponentPerso(AMcomment)
					+ "&verif=" + encodeURIComponentPerso(AMverif) + "&idContribution=" + AMId;
		req = getRequest(url, displayAlertModerator, "GET", true);
		req.send(url);
	}
	else					{ alert(AMerror);	}
}

function displayAlertModerator(req)
{
	var expression = /Parse error/;
 	if ( !expression.exec(req.responseText) )
 	{
		document.getElementById('divAlertModerator').innerHTML = req.responseText;
	}
	else
		alert("Error Loading Page 'New Mail'");
}


function followThisAuthor(id)
{
	setTimeout("followRequest("+id+")", 500);
}
function followRequest(id)
{
	url ="/screens/usersPage/author/sw_followAuthor.php?author="+id;
	req = getRequest(url, followThisAuthorResponse, "GET");
	req.send(url);
}
function followThisAuthorResponse(xmlResponse)
{
	try{
		var response = xmlResponse.getElementsByTagName("response")[0];
		if(response!=null && response.getElementsByTagName("success")[0].firstChild.nodeValue == 1){
			document.getElementById("subscribeToThisAuthor").innerHTML = 
				'<a href="/screens/usersPage/userSummary/sw_userSummary.php?tab=authorTab">'+response.getElementsByTagName("message")[0].firstChild.nodeValue+'</a>';
		}else{
			alert("An error occured while trying to retrieve emails");	
		}
	}catch(e){
		alert("An error occured while trying to retrieve emails: "+ e.message);	
	}
}