i1 = new Image;
i1.src = "images/croix2.jpg";
var IE5=(document.getElementById && document.all)? true : false;
var W3C=(document.getElementById)? true: false;
var currIDb=null, currIDs=null, xoff=0, yoff=0; zctr=0; totz=0;

function trackmouse(evt){
if((currIDb!=null) && (currIDs!=null)){
var x=(IE5)? event.clientX+document.body.scrollLeft : evt.pageX;
var y=(IE5)? event.clientY+document.body.scrollTop : evt.pageY;
currIDb.style.left=x+xoff+'px';
currIDs.style.left=x+xoff+3+'px';
currIDb.style.top=y+yoff+'px';
currIDs.style.top=y+yoff+3+'px';
return false;
}}

function stopdrag(){
currIDb=null;
currIDs=null;
NS6bugfix();
}

function grab_id(evt){
xoff=parseInt(this.IDb.style.left)-((IE5)? event.clientX+document.body.scrollLeft : evt.pageX);
yoff=parseInt(this.IDb.style.top)-((IE5)? event.clientY+document.body.scrollTop : evt.pageY);
currIDb=this.IDb;
currIDs=this.IDs;
}

function NS6bugfix(){
if(!IE5){
self.resizeBy(0,1);
self.resizeBy(0,-1);
}}

function incrzindex(){
zctr=zctr+2;
this.subb.style.zIndex=zctr;
this.subs.style.zIndex=zctr-1;
}

function createPopup(id, title, width, height, x , y , isdraggable, boxcolor, barcolor, shadowcolor, text, textcolor, textptsize, textfamily, titlecolor ){
if(W3C){
zctr+=2;
totz=zctr;
var txt='';

txt+='<div id="'+id+'_s" style="position:absolute; left:'+(x+3)+'px; top:'+(y+3)+'px; width:'+width+'px; height:'+height+'px; background-color:'+shadowcolor+'; filter:alpha(opacity=50); visibility:visible"> </div>';
txt+='<div id="'+id+'_b" style="border:outset '+barcolor+' 2px; position:absolute; left:'+x+'px; top:'+y+'px; width:'+width+'px; overflow:hidden; height:'+height+'px; background-color:'+boxcolor+'; visibility:visible">';
txt+='<div style="width:'+width+'px; height:16px; background-color:'+barcolor+'; padding:0px; border:1px"><table cellpadding="0" cellspacing="0" border="0" width="'+(IE5? width-4 : width)+'"><tr><td width="'+(width-20)+'" style=cursor:hand><div id="'+id+'_h" style="width:'+(width-20)+'px; height:14px; font: bold 12px Arial; color:'+titlecolor+'" align=center> ~ '+title+' ~</div></td><td align="center" style="cursor:hand"><a onmousedown="document.getElementById(\''+id+'_s\').style.display=\'none\'; document.getElementById(\''+id+'_b\').style.display=\'none\';return false" onMouseOver="nomimage1.src=i1.src" onMouseOut="nomimage1.src=\'images/croix1.jpg\'"><IMG SRC="images/croix1.jpg" BORDER=0 WIDTH=19 HEIGHT=18 NAME="nomimage1" alt="Fermer"></a></td></tr></table></div>';
txt+='<div id="'+id+'_ov" style="margin:2px;">'+text+'</div></div>';
document.all.carte.innerHTML=txt;

this.IDh=document.getElementById(id+'_h');
this.IDh.IDb=document.getElementById(id+'_b');
this.IDh.IDs=document.getElementById(id+'_s');
this.IDh.IDb.subs=this.IDh.IDs;
this.IDh.IDb.subb=this.IDh.IDb;
this.IDh.IDb.IDov=document.getElementById(id+'_ov');
if(IE5){
this.IDh.IDb.IDov.style.width=width-6;
this.IDh.IDb.IDov.style.height=height-22;
this.IDh.IDb.IDov.style.scrollbarBaseColor=boxcolor;
this.IDh.IDb.IDov.style.overflow="auto";
}else{
this.IDh.IDs.style.MozOpacity=.5;
}
this.IDh.IDb.onmousedown=incrzindex;
if(isdraggable){
this.IDh.onmousedown=grab_id;
this.IDh.onmouseup=stopdrag;
}}}

if(W3C)document.onmousemove=trackmouse;
if(!IE5 && W3C)window.onload=NS6bugfix;
function open_carte() {
createPopup( 'Carte', 'Carte de Visite' , 261, 190, 100, 100, true,  '#FFFFFF' , '#D17070' , 'black' ,  '<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"><tr><td align="center" valign="middle"><table background="http://pagesperso.org/images/background.jpg" bordercolor="#000000" bordercolordark="#FFFFFF" border="1" cellpadding="0" cellspacing="0" width="241" height="163" align="center" valign="middle"><tr><td align="center" valign="top"><span style="font-size:13pt;font-family:Tahoma"><b><font color="#7F0000">&lt;? </font><font color="red">echo </font><font color="#FF00FF">"Loup_iotte"</font><font color="#7F0000">; ?></b></font><br><center><span style="font-size:7pt;color:#7F0000">Concepteur & Développeur de Services Internet</span></center></span><table border="0" cellpadding="0" cellspacing="0" width="100%" height="60" align="center"><tr><td width="96" valign=top><br><div style="font-size:7pt;font-family:Tahoma;" align="center">Mr Roussel Julien<br>20 bd Oscar Leroux<br>35 200 Rennes<br><font face="Wingdings">(</font> 06 64 80 00 42</div></td><td width="49">&nbsp;</td><td width="96" align="center" valign=top><br><span style="font-size:7pt;font-family:Tahoma;"><B>Sites Web & Wap</B><br><br><U>www.pagesperso.org</U><br><U>wap.pagesperso.org</U><br></span></tr></table><center><span style="font-size:7pt;font-family:Tahoma;"><br><br><font color="#7F0000">Qu\'importe le temps passé, seul le résultat compte...</font><br><br>E-mail : Loup_iotte@pagesperso.org<br></span><span style="font-size:7pt;font-family:Tahoma;"><font color="#FF00FF">Num&eacute;ro de Siren &nbsp;: <font color="red">&nbsp;&nbsp;447 752 734</font> <font color="#7F0000">&nbsp;&nbsp;Code APE&nbsp;:&nbsp;721Z&nbsp;</font></span></td></tr></table></td></tr></table></div></div>' , '#000000'  , 6 , 'Arial','#FFFFFF');
}
function open_carte_bzh() {
createPopup( 'Carte', 'Carte de Visite' , 261, 190, 100, 100, true,  '#FFFFFF' , '#D17070' , 'black' ,  '<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"><tr><td align="center" valign="middle"><table background="http://pagesperso.org/images/background.jpg" bordercolor="#000000" bordercolordark="#FFFFFF" border="1" cellpadding="0" cellspacing="0" width="241" height="163" align="center" valign="middle"><tr><td align="center" valign="top"><span style="font-size:13pt;font-family:Tahoma"><b><font color="#7F0000">&lt;? </font><font color="red">echo </font><font color="#FF00FF">"Loup_iotte"</font><font color="#7F0000">; ?></b></font><br><center><span style="font-size:7pt;color:#7F0000">Ergrafer & Diorroer Servijoù ar Genrouedad</span></center></span><table border="0" cellpadding="0" cellspacing="0" width="100%" height="60" align="center"><tr><td width="96" valign=top><br><div style="font-size:7pt;font-family:Tahoma;" align="center">Mr Roussel Julien<br>20 bd Oscar Leroux<br>35 200 Roazhon<br><font face="Wingdings">(</font> 06 64 80 00 42</div></td><td width="49">&nbsp;</td><td width="96" align="center" valign=top><br><span style="font-size:7pt;font-family:Tahoma;"><B>Sites Web & Wap</B><br><br><U>www.pagesperso.org</U><br><U>wap.pagesperso.org</U><br></span></tr></table><center><span style="font-size:7pt;font-family:Tahoma;"><br><font color="#7F0000">Ne vern an amzer aet hebiou,<br>an disoc\'h an hini nemeta&ntilde; a gont.</font><br><br>Chomlec\'h postel : Loup_iotte@pagesperso.org<br></span><span style="font-size:7pt;font-family:Tahoma;"><font color="#FF00FF">Niverenn Siren &nbsp;: <font color="red">&nbsp;&nbsp;447 752 734</font> <font color="#7F0000">&nbsp;&nbsp;Kod APE&nbsp;:&nbsp;721Z&nbsp;</font></span></td></tr></table></td></tr></table></div></div>' , '#000000'  , 6 , 'Arial','#FFFFFF');
}
// Convertisseur euro
var test="1";
function Conversion(form,choix) {
var point1 = form.francs.value.indexOf('.');
var point2 = form.euros.value.indexOf('.');
if (test==1)
{
  if (choix == "non")
    {
        Montant_Francs = new String(form.euros.value * 6.55957);
        point = Montant_Francs.lastIndexOf('.', Montant_Francs.length);
        if (point == -1)
        {
            form.francs.value = Montant_Francs + '.00';
        } else {
            dec = new String(Montant_Francs.substring(point+1, Montant_Francs.length));
            if (dec.length == 1)
            {
                form.francs.value = Montant_Francs + '0';
            }
            else
            {
                if (dec.length == 2)
                {
                    form.francs.value = Montant_Francs;
                }
                else
                {
                    dec3 = new String(dec.substring(2, 3));
                    if (dec3 < 5)
                    {
                        form.francs.value = Montant_Francs.substring(0, point+1) + dec.substring(0, 2);
                    }
                    else
                    {
                        deux_dernieres_dec = new String(dec.substring(0, 2));
                        plusun = new String((1 * deux_dernieres_dec) + 1);
                        if (plusun == 100)
                        {
                            form.francs.value = new String((1 * Montant_Francs.substring(0, point))+ 1 ) + '.00';
                        }
                        else
                        {
                            if (plusun.length == 1)
                            {
                                form.francs.value = Montant_Francs.substring(0, point+1) + '0' + plusun;
                            }
                            else
                            {
                                form.francs.value = Montant_Francs.substring(0, point+1) + plusun;
                            }
                        }
                    }
                }
            }
        }
    } else {  if (choix == "oui"){
        Montant_Euros = new String(form.francs.value / 6.55957);
        point = Montant_Euros.lastIndexOf('.', Montant_Euros.length);
        if (point == -1)
        {
            form.euros.value = Montant_Euros + '.00';
        } else {
            dec = new String(Montant_Euros.substring(point+1, Montant_Euros.length));
            if (dec.length == 1)
            {
                form.euros.value = Montant_Euros + '0';
            }
            else
            {
                if (dec.length == 2)
                {
                    form.euros.value = Montant_Euros;
                }
                else
                {
                    dec3 = new String(dec.substring(2, 3));
                    if (dec3 < 5)
                    {
                        form.euros.value = Montant_Euros.substring(0, point+1) + dec.substring(0, 2);
                    }
                    else
                    {
                        deux_dernieres_dec = new String(dec.substring(0, 2));
                        plusun = new String((1 * deux_dernieres_dec) + 1);
                        if (plusun == 100)
                        {
                            form.euros.value = new String((1 * Montant_Euros.substring(0, point))+ 1 ) + '.00';
                        }
                        else
                        {
                            if (plusun.length == 1)
                            {
                                form.euros.value = Montant_Euros.substring(0, point+1) + '0' + plusun;
                            }
                            else
                            {
                                form.euros.value = Montant_Euros.substring(0, point+1) + plusun;
                            }
                        }}
                    }
                }
            }
        }
    } 
}else{test=0;}

}

function valid(montant,form1,form2)
{test=1;

		if (isNaN(montant))
		{

			document.forms[0].elements[form2].value='';
			document.forms[0].elements[form1].value='';test=0;
	
		}

}
function action1(){
valid(document.form1.francs.value,'0','1');
//if (test==1){document.form1.euros.value=0};
Conversion(document.form1,'oui');
if (document.layers){
document.forms[0].elements[0].blur();
document.forms[0].elements[0].focus();
}
}

function action2(){
valid(document.form1.euros.value,'1','0');
//if (test==1){document.form1.francs.value=0};
Conversion(document.form1,'non');
if (document.layers){
document.forms[0].elements[1].blur();
document.forms[0].elements[1].focus();
}
}
