function ShowSComm()
{
	var ma = getElm('mailcomm');
	ShowHider('hider');
	ma.style.top = parseInt((((typeof(window.innerHeight) != 'undefined') ? window.innerHeight : document.documentElement.clientHeight) / 2)) - parseInt((ma.offsetHeight / 2)) + document.documentElement.scrollTop + 'px'; //style.bottom causes problems in opera :)
	ma.style.left = parseInt((screen.width - 500) / 2) + 'px';
	ma.style.visibility = 'visible';
}
function setTextSize(what)
{
	if(what == '+'){
		if(currentFontSize != 130){
			currentFontSize += 10;
			getElm("exergue").style.fontSize = currentFontSize + "%";
			getElm("contenu").style.fontSize = currentFontSize + "%";
		}
	}else if(what == '-'){
		if(currentFontSize != 80){
			currentFontSize -= 10;
			getElm("exergue").style.fontSize = currentFontSize + "%";
			getElm("contenu").style.fontSize = currentFontSize + "%";
		}
	}
}
function BlankThisLink(thelinkID)
{
	getElm(thelinkID).target = '_blank';
}
function CloseSComm()
{
	getElm('mailcomm').style.visibility = 'hidden';
	RemNod(getElm('hider'));
	if(xHRObjectSC != null) {
		xHRObjectSC = null;
	}
	getElm("nomenv").disabled = false;
	getElm("emailenv").disabled = false;
	getElm("mailartinpt").style.display = 'block';
	getElm("sendmtstatus").style.display = 'none';
	getElm("sendmtresult").style.display = 'none';
}
function CheckSCForm()
{
	if(getElm('nomenv').value == ''){
		BlinkMe('nomenv',5);
		getElm('nomenv').focus();
		return false;
	}
	if(getElm('emailenv').value == ''){
		BlinkMe('emailenv',5);
		getElm('emailenv').focus();
		return false;
	}else{
		var $exp = /\b[\w,-]+@{1}[\w,-]{2,}\.{1}\w{2,}\b/;
		$value = getElm("emailenv").value;
		if(!$exp.test($value)){
			BlinkMe('emailenv',5);
			getElm('emailenv').focus();
			getElm('emailenv').select();
			return false;
		}
	}
	
	return true;
}
function SndCommReq()
{
	if(xHRObjectSC.readyState == 4 && xHRObjectSC.status == 200){
		getElm("sendmtstatus").style.display = 'none';
		var xmlDoc = xHRObjectSC.responseXML;
		var theError = GetElemTxt(xmlDoc,'errorCode',0);
		var theMessage = '';
		if(theError == '0'){
			theMessage = '<span style="color:Blue;">Le communiqué de presse a été envoyé avec succès.</span>';			
		}else{
			theMessage = '<span style="color:Red;">Nous sommes désolé, l\'envoi a échoué; Veuillez réessayer plus tard.</span>';
		}
		getElm("sendmtresult").innerHTML = theMessage
		getElm("sendmtresult").style.display = 'block';
	}
}
function SendComm()
{
	if(CheckSCForm()){
		var urlSC = siteURL + "ajax/mailcomm.xml" + "?id=" + idComm + "&nom=" + escape(getElm("nomenv").value) + "&email=" + escape(getElm("emailenv").value) + "&rand=" + Number(new Date);
		xHRObjectSC = CreatexHRObject();
		xHRObjectSC.open("GET",urlSC,true);
		xHRObjectSC.onreadystatechange = SndCommReq;
		xHRObjectSC.send(null);
		getElm("mailartinpt").style.display = 'none';
		getElm("nomenv").disabled = true;
		getElm("emailenv").disabled = true;		
		getElm("sendmtstatus").style.display = 'block';
	}
}
