var ns4,ie4;
			
ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
			
function layerWrite(id,nestref,text) 
{
	if (ns4) {
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document;
		lyr.open();
		lyr.write(text);
		lyr.close();
	}
	else if (ie4) document.all[id].innerHTML = text;
}

function popup(pURL,pNom) {
	var vsOptions
	vsOptions = "dependent=1,location=0,menubar=0,toolbar=0,scrollbars=1,resizable=1";
	return window.open(pURL,pNom,vsOptions);
}

function popupMenu(pURL,pNom) {
	var vsOptions
	vsOptions = "dependent=1,location=0,menubar=1,toolbar=1,scrollbars=1,resizable=1";
	return window.open(pURL,pNom,vsOptions);
}

function putAntiSlash(pStr) {
	var vsTemp, vi, vsChar
	vsTemp='';
	for (vi=0;vi<pStr.length;vi++) {
		vsChar = pStr.substr(vi,1)
		if (vsChar=="'") {
			vsChar = "\\'";
		}
		vsTemp += vsChar;
	}
	return vsTemp
}

function writeDate() {
	var now = new Date();
	var yr = now.getYear();
	var mName = now.getMonth() + 1;
	var dName = now.getDay() + 1;
	var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate();
	if(dName==1) Day = "Dimanche";
	if(dName==2) Day = "Lundi";
	if(dName==3) Day = "Mardi";
	if(dName==4) Day = "Mercredi";
	if(dName==5) Day = "Jeudi";
	if(dName==6) Day = "Vendredi";
	if(dName==7) Day = "Samedi";
	if(mName==1) Month="Janvier";
	if(mName==2) Month="Février";
	if(mName==3) Month="Mars";
	if(mName==4) Month="Avril";
	if(mName==5) Month="Mai";
	if(mName==6) Month="Juin";
	if(mName==7) Month="Juillet";
	if(mName==8) Month="Août";
	if(mName==9) Month="Septembre";
	if(mName==10) Month="Octobre";
	if(mName==11) Month="Novembre";
	if(mName==12) Month="Décembre";
	// String to display current date.
	var todaysDate =(" " + Day + " " + dayNr + " " + Month + "<br>");
	// Write date to page.
	document.write('<font face="Verdana,Arial,Tahoma" size="1" color="#FFFFFF"><b>' + todaysDate + '</b></font>');
}




function openFichePratique (piGNRid)
{				
	popupMenu('/p_detail_fiche_pratique.asp?GnrId=' + piGNRid, 'wFPR')
}

function Comma2Point(pNb)
{
	var vsCh = new String(pNb);
	vsCh = vsCh.replace(',', '.')
	return vsCh; 
}

function FormatNumber(pNb, pDecimal)
{
	var vsNb, viIndex, vsDecimal, i;
	vsNb = new String(pNb)
	vsNb = Comma2Point(Trim(vsNb));
	viIndex = vsNb.indexOf(".");
	if (viIndex == -1)
		vsNb += '.00';
	else
	{
		vsDecimal = vsNb.substring(viIndex+1);
		for(i=0; i<(pDecimal- vsDecimal.length); i++)
			vsDecimal += '0';
		vsNb = vsNb.substring(0,viIndex+1);
		vsNb += vsDecimal.substring(0,pDecimal);
	}
	
	return vsNb;
}