
var osX=0;var osY=0;var agt=navigator.userAgent.toLowerCase();function myVMLGraphBar(width,height,values,nams)
{var strGraph="";var strTemp="";var chaine=new String();var bars=new String();var color=new Array();color[0]="green";color[1]="blue";color[2]="red";var i,n,vmin,vmax,v0;var str,str2,str3,xl,yl,yyl,txty,txt,txt_unit,leg,txt_eg;n=values.length;w=width/n;vmin=values[0];vmax=vmin;xl="";yl="";txty="";txty="";yyl="";for(i=1;i<n;i++)
{v=values[i];if(v<vmin)vmin=v;if(v>vmax)vmax=v;}
for(i=1;i<=n;i++)
{xl=xl+" M "+Math.ceil(i*w)+","+height+" L "+Math.ceil(i*w)+","+(height+4)+" X"}
vdiff=Math.abs(vmax-vmin);var limite=new Array();var coef;var nd;limite[0]=0;limite[1]=1000;limite[2]=2000;limite[3]=10000;limite[4]=20000;limite[5]=100000;limite[6]=200000;limite[7]=1000000;limite[8]=2000000;limite[9]=10000000;limite[10]=20000000;limite[11]=100000000;limite[12]=200000000;limite[13]=1000000000;limite[14]=2000000000;limite[15]=10000000000;limite[16]=20000000000;limite[17]=100000000000;limite[18]=200000000000;limite[19]=1000000000000;limite[20]=2000000000000;limite[21]=10000000000000;for(i=0;i<21;i=i+2)
{if(vdiff<=limite[i+1]&&vdiff>limite[i])
{coef=1;nd=Math.ceil(Math.log(vmax-vmin)/Math.log(10))-1;}}
for(i=1;i<21;i=i+2)
{if(vdiff<=limite[i+1]&&vdiff>limite[i])
{coef=5;nd=Math.ceil(Math.log(vmax-vmin)/Math.log(10))-2;}}
dy=Math.pow(10,nd);yl="";for(i=0;i<=vmax;i=i+15*dy)
{y=Math.ceil(height-((i)/(vmax)*height));yl=yl+" M 0,"+y+" L 4,"+y+" X";yyl=yyl+" M 0,"+y+" L "+width+","+y+" X";if(nd>=3&&nd<6)
{txt=""+(Math.ceil(i/100))/10;txt_unit="K\u20AC";}
else if(nd>=6&&nd<9)
{txt=""+(Math.ceil(i/100))/10000;txt_unit="M\u20AC";}
else if(nd>=9)
{txt=""+(Math.ceil(i/100))/10000000;txt_unit="MD\u20AC";}
else
{txt=i;txt_unit="\u20AC";}
txty=txty+"<p style='position:absolute;left:5;top:"+(y+2);if(!(agt.indexOf("opera")!=-1))
txty=txty+";text-align=center;FONT-FAMILY: Tahoma; FONT-SIZE: xx-small; COLOR: black;'>"+txt+"</p>";}
bars=""
for(i=0;i<n;i++)
{bars=bars+"<v:shape style='HEIGHT: "+(height*values[i]/vmax)+" px; left: "+(35+(width/n)*i)+"px; top: "
bars=bars+((height-height*values[i]/vmax+5))+" px; position:relative; width: ";bars=bars+(width/n-10)+" px'  coordsize  = '200,200' fillcolor = '"+color[i]+"'  strokecolor = '"+color[i]+"' path = 'm1,1l1,200,200,200,200,1 xe' title='"+values[i]+" F'>";bars=bars+"<v:fill type = 'gradient' color2 = 'black' angle = '45'></v:fill></v:shape>";}
txt_leg="<v:rect style=\"position:relative;top="+(height+25)+"; width="+(width+10+30)+"; height="+(n*16+2)+";\" fillcolor=\"#FFFFFF\">";txt_leg=txt_leg+"<v:shadow on=\"true\" offset=\"4pt,3pt\" color=\"gray\"/></v:rect>";for(i=0;i<n;i++)
{txt_leg=txt_leg+"<v:shape style=\"HEIGHT: 10px; LEFT: 10px; TOP:"+((height+25)+(4+i*16))+"px; position:relative; WIDTH: "+10+";\" coordsize  = \"200,200\" fillcolor = \""+color[i]+"\"  strokecolor = \""+color[i]+"\" path = \"m1,1l1,200,200,200,200,1xe\"></v:shape>";txt_leg=txt_leg+"<v:fill type = 'gradient' color2 = 'black' angle = '45'></v:fill></v:shape>";if(!(agt.indexOf("opera")!=-1))
txt_leg=txt_leg+"<p style='position:absolute;left:"+25+";top:"+((height+25)+(4+i*16))+"; text-align=center;FONT-FAMILY: Tahoma; FONT-SIZE: xx-small; COLOR: black;'>"+nams[i]+" ("+txt_unit+")"+"</p>";}
intGraphHeight=(height+25+(n*16+2));GetBodyOffsetsRelative("graphe");chaine=""
+"<v:group style=\"position:absolute; top:"+osY+"px; left:"+(osX+((442-(width+10+30+20))/2))+"px; width:"+width+"px; height: "+height+"px; z-index: 999\" coordsize=\""+width+","+height+"\">"
+"<v:rect style=\"position:relative; width="+(width+10+30)+"; height="+(height+15)+";\" fillcolor=\"#FFFFFF\">"
+"<v:shadow on=\"true\" offset=\"4pt,3pt\" color=\"gray\"/></v:rect>"
+"<v:shape style=\"left=30;top=5;position:relative; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor=\"gray\">"
+"<v:path v=\""+xl+"\" /></v:shape>"
+"<v:shape style=\"left=25;top=5;position:relative; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor=\"gray\">"
+"<v:path v=\""+yl+"\" /></v:shape>"
+"<v:shape style=\"left=30;top=5;position:relative; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor=\"silver\">"
+"<v:path v=\""+yyl+"\" /></v:shape>"
+bars
+"<v:polyline style=\"left=30;top=5;position:relative;\" strokecolor=\"gray\" points=\"0,"+(height+4)+",0,0\" strokeweight=2px><v:stroke joinstyle=round endcap=round /><v:fill on=\"false\" /></v:polyline>"
+"<v:polyline style=\"left=30;top=5;position:relative;\" strokecolor=\"gray\" points=\"-4,"+height+","+width+","+height+"\" strokeweight=2px><v:stroke joinstyle=round endcap=round /><v:fill on=\"false\" /></v:polyline>"
+txty
+txt_leg
+"</v:group>";return(chaine);}
function GetBodyOffsetsRelative(strElementName)
{var obj=document.getElementById(strElementName);osX=0;osY=0;while(obj.offsetParent)
{if(obj==document.getElementsByTagName('body')[0])
{break;}
else
{osX=osX+obj.offsetParent.offsetLeft;osY=osY+obj.offsetParent.offsetTop;obj=obj.offsetParent;}}}