document.jsdebug = 0;
var infoFrame = parent.frames[1];
// shows text in the secondary frame
function ShowInfo(infotext,bgcol,fgcol){
  infoFrame.document.open("text/html")
  infoFrame.document.writeln('<body bgcolor="'+bgcol+'" text="'+fgcol+'">')
  infoFrame.document.writeln("<b>",infotext,"</b>")
   for (var i=3; i<arguments.length; i++) {
     infoFrame.document.writeln(arguments[i])
   }
  infoFrame.document.writeln("</body>")
//  infoFrame.document.bgColor=bgcol
//  infoFrame.document.fgColor="navy"
  infoFrame.document.close()
// this prevents any action on the window
  return undefined;
}
//ptr=document.coureursPhoto
function SetScale(x,y,ptr){
    if (document.jsdebug) {
	document.write("This document is ",document.width," pixels wide <br>");
    }
    ptr.fullwidth  = x;
    ptr.fullheight = y;
    ptr.xscale = 
	ptr.width / ptr.fullwidth ;
    ptr.yscale = ptr.xscale; 
//	ptr.height / ptr.fullheight ;
    if (document.jsdebug) {
	document.write("the image is ",ptr.width,
		       "x",ptr.height," pixels ",
		       "compared to the original ",ptr.fullwidth,
		       "x",ptr.fullheight," pixels <br>");
	document.write("so the scaling factors are ",
		       ptr.xscale,",",
		       ptr.yscale,"<p>");
	document.write(ScaleArea(490,208,549,276));
    }
}
// rescales area on the map
function ScaleArea(x0,y0,x1,y1,ptr){
 with (Math) {
   return floor(x0*ptr.xscale) + ","
        + floor(y0*ptr.yscale) + ","
        +  ceil(x1*ptr.xscale) + ","
        +  ceil(y1*ptr.yscale) ;
 }
}
// define an area on the image map
function SetArea(x0,y0,x1,y1,name,catFFC,info){
    var bc = 'black';
    var fc = 'yellow';
    var cat = ''; 
    switch (catFFC) {
    case 1:
	cat = 'Départamentale';
	bc = '204040';
	fc = 'yellow';
	break;
    case 2:
	cat = 'Régionale';
	bc = 'navy';
	fc = 'yellow';
	break;
    case 3:
	cat = 'Nationale';
	bc = 'purple';
	fc = 'yellow';
	break;
    case 10:
	cat = 'Junior';
	bc = '204040';
	fc = 'yellow';
	break;
    case 11:
	cat = 'Départamentale, Junior';
	bc = '204040';
	fc = 'yellow';
	break;
    case 12:
	cat = 'Régionale, Junior';
	bc = 'navy';
	fc = 'yellow';
	break;
    case 20:
	cat = 'section ciclosportive';
	bc = 'black';
	fc = 'yellow';
	break;
    case 0:
    }
    document.write('<AREA href="javascript:ShowInfo(',
		   "'"+name+"'"+",'"+bc+"'"+",'"+fc+"'"+",' "+cat+"'",
		   ",' "+info+"'", ')"');
    document.write('onmouseover="ShowInfo(',
		   "'"+name+"'"+",'"+bc+"'"+",'"+fc+"'"+",' "+cat+"'",
		   ",' "+info+"'", ')"');
    document.write('alt=','"'+name+' '+cat+'"');
    document.write('COORDS=',ScaleArea(x0,y0,x1,y1),'">');
}
