function RemplacerHtmlCode(iText)
{
	iText = iText.replace(/&egrave;/g, "è") ;
	iText = iText.replace(/&eacute;/g, "é") ;
	iText = iText.replace(/&oelig;/g, "œ") ;
	iText = iText.replace(/&ocirc;/g, "ô") ;
	iText = iText.replace(/&uuml;/g, "ü") ;
	return iText ;
}

function RemplacerVirgule(ioField)
{
	var a, tmp;
	tmp = "";
	a = ioField.value;
	for(var i = 0; i < a.length; i++) {
		tmp = tmp + a.charAt(i);
		if (a.charAt(i) == ",") {
			tmp = tmp.replace(",",".");
		}
	}
	ioField.value = tmp;
}	

function GetXmlTag(iText, iTag)
{
	var startTag = "<" + iTag + ">" ;
	var endTag = "</" + iTag + ">" ;
	var startIndex = iText.indexOf(startTag) ;
	var endIndex = iText.indexOf(endTag) ;
	if ( (endIndex > startIndex) && (startIndex >= 0) && (endIndex >= 0) ) {
		return iText.substring(startIndex + startTag.length, endIndex) ;
	}
	return "" ;		
} 	

function GetXmlTags(iText, iTag)
{
	var startTag = "<" + iTag + ">" ;
	var endTag = "</" + iTag + ">" ;
	
	var resultArray = new Array(0) ;
	
	var xmlText = iText ;
	var tagValue ;
	var startIndex = xmlText.indexOf(startTag) ;
	var endIndex = xmlText.indexOf(endTag) ;
	while ( (endIndex > startIndex) && (startIndex >= 0) && (endIndex >= 0) ) {
		tagValue = xmlText.substring(startIndex + startTag.length, endIndex) ;
		resultArray.push(tagValue) ;
		xmlText = xmlText.substring(endIndex + endTag.length, xmlText.length) ;		
		startIndex = xmlText.indexOf(startTag);
		endIndex = xmlText.indexOf(endTag) ;			
	}
	
	return resultArray ;
}

function ShowPopup(iDivId, iFrame, iTitleCell, iUrl, iTitle, iWidth, iHeight) 
{
	var vDoc = document ;
	if ( (window.parent !== null) && (window.parent.document !== null) ) {
		vDoc = window.parent.document;
	} 
	
	var vDiv = vDoc.getElementById(iDivId);
	vDiv.style.display = "" ;
	if (iHeight > 0) {
		var clientHeight = vDoc.body.clientHeight;
		var heightRatio = Math.round(100 * (iHeight/clientHeight) );
		vDiv.style.top =  Math.round((100-heightRatio)/2) + "%" ;
		vDiv.style.height = heightRatio + "%" ;
	} else {
		vDiv.style.top = "10%" ;
		vDiv.style.height = "80%" ;
	}
	if (iWidth > 0) {
		var clientWidth = vDoc.body.clientWidth;	
		var widthRatio = Math.round(100 * (iWidth/clientWidth) );
		vDiv.style.left = Math.round((100-widthRatio)/2) + "%" ;
		vDiv.style.width = widthRatio + "%" ;
	} else {
		vDiv.style.left = "10%" ;
		vDiv.style.width = "80%" ;
	}
	
	var vTitleCellId = vDoc.getElementById(iTitleCell);
	vTitleCellId.innerHTML = iTitle ;
	
	var vFrame = vDoc.getElementById(iFrame);
	vFrame.src = iUrl ;	
}

function ShowDiv(iDivId, iFrame, iUrl, iTitle) 
{
	ShowPopup(iDivId, iFrame, "PopupTitle", iUrl, iTitle, -1, -1) ;
}

function HideDiv(iDivId, iFrame)
{
	var vDoc = document ;
	if (window.parent.document !== null) {
		vDoc = window.parent.document;
	} 
	var vFrame = vDoc.getElementById(iFrame);
	vFrame.src = "" ;		
	var vDiv = vDoc.getElementById(iDivId);
	vDiv.style.display = "none";
}


