// nouvelle gestion du formulaire
if(opener==null && self.location==top.location){
	top.location="formframe.htm";}
var Prixfrance=488;
var Portfrance=2.44*12;
//Prixfrance+=Portfrance;
var Porteurope=5.03 * 12;
var navy = navigator.appName;
var SiteAgence=-1;
var TaxEngland = 1.45; // par chèque en €
var TaxPortos = 5.18;  // par chèque en €
var TaxEurope = 15.63; // ???
var memoire=0;


//---------------------------------------------------
var monaide =new Array(); 
monaide[0]= "Seulement si vous avez suivi le premier cycle"; 
monaide[1]= "Option déconseillée !\n Nous prenons en charge les frais bancaires\n si vous payez en une fois\nsoit 27,79 € pour 1 chèque"; 
monaide[2]= "La Grande Bretagne et le Portugal\n appliquent une taxe bancaire supplémentaire qui vous sera facturée";
monaide[3]="Seulement si vous avez suivi le premier et le second cycle"; 
 
/* fin du tableau aide*/ 
var Helpwin = "WH";
//---------------------------------------------------
//sur opener.
/* objet membre */
//var cee=confirm("Vous résidez en France Métropolitaine ou  dans un pays d'Europe Occidentale en CEE, Suisse, en Andore... :cliquez OK. Sinon cliquez sur Annuler pour accéder au formulaire qui vous concerne");
//-------------------------------------------------------
// structure membre

var lieu=null; var s;// variables pour sockage.
if(self.opener!=null){lieu=self.opener.madh;}
if(parent.leftFrame !=null) { lieu=parent.leftFrame.madh;}

function stok(){
	var s="ici";
   if(lieu==null)return;
   ecrit("cycle",getCycle());
   var a=getReglement();
   ecrit("reglement",a);
   a  =document.forms[0].Gprix.value;
   ecrit("tarif",a);
   a  =document.forms[0].Prenom.value;
   ecrit("prenom",a);
    a  =document.forms[0].NOM2.value;
   ecrit("nom",a);
   a  =document.forms[0].NOM6.value;
   ecrit("adresse",a);
   a  =document.forms[0].NOM.value;
   ecrit("codpost",a);
   a  =document.forms[0].NOM3.value;
   ecrit("ville",a);
   a  =document.forms[0].NOM4.value;
   ecrit("complement",a);
   a  =document.forms[0].EMAIL.value;
   ecrit("mail",a);
   a  =document.forms[0].telephone.value;
   ecrit("tel",a);
   a  =getPays();
   ecrit("pays",a);
   a  =getTitre();
   ecrit("titre",a);  
   a=document.forms[0].JJ.value;
   ecrit("Jn",a);
   a=document.forms[0].MM.value;
   ecrit("Mm",a);
   a=document.forms[0].AAAA.value;
   ecrit("An",a);
   document.forms[0].Heure.value;
   ecrit("Hn",a);
   document.forms[0].MINUTES.value;
   ecrit("Mn",a);
   document.forms[0].LNaissance.value;
   ecrit("Vn",a);
   document.forms[0].NOM52.value;
   ecrit("Dn",a);
   a="Pn";
   document.forms[0].NOM5.value;
   ecrit("Pn",a);

}
function ecrit(v,x){
		with(lieu){
			if(v=="cycle")cycle=x;
			if(v=="reglement")reglement=x;
			if(v=="tarif")tarif=x;
			if(v=="titre")titre=x;
			if(v=="prenom")prenom=x;
			if(v=="nom")nom=x;
			if(v=="adresse")adresse=x;
			if(v=="codpost")codpost=x;
			if(v=="ville")ville=x;
			if(v=="complement")complement=x;
			if(v=="mail")mail=x;
			if(v=="tel")tel=x;
			if(v=="pays")pays=x;
			if(v=="Jn")Jn=x;
			if(v=="Mm")Mn=x;
			if(v=="An")An=x;
			if(v=="Hn")Hn=x;
			if(v=="mn")Mn=x;
			if(v=="Vn")Vn=x;
			if(v=="Dn")Dn=x;
			if(v=="Pn")Pn=x;
		}
			return;
}
// Récupération des données
function getTitre(){
		var r=document.forms[0].Titre.selectedIndex;
	return r;
} 
 
function getPays(){
		var i=document.forms[0].TARIF.selectedIndex;
		var r=document.forms[0].TARIF.options[i].value;
	return r;
}

function getReglement(){
	var r=(document.forms[0].reglement[0].checked==true)? 0: 1;
	return r;
}
function getCycle(){
	var r=(document.forms[0].cycle[0].checked==true)? 0: 1;
	return r;
}
function avertis(){
	alert("seulement si vous avez suivi le premier cycle");
}
// fonction de fixation des prix
function fixeprix(n){
var gp=Prixfrance;
var taxe =LocAgence()
gp = n>0 ? Prixfrance - Portfrance + Porteurope : Prixfrance;
if(SiteAgence>0 && SiteAgence<3)gp+=taxe
var pp = gp/4; 
pp+=taxe;
var P= document.forms[0].reglement[0].checked == true ? "__.__" : arrondi(pp);
var G= document.forms[0].reglement[1].checked == true ? "___.__" : arrondi(gp);
//window.status=SiteAgence+" "+taxe +" "+TaxEngland;
 
document.forms[0].Gprix.value=""+G;
document.forms[0].Pprix.value= P; 
}

// fin


// date système
function set_Date(){
Queljour();
if(opener !=null){
//	if(opener.madh.omer != "nform1.htm")self.document.location.href="n_outremer.htm";
}

}

//appel de l'aide :
function formHelp(){ 
var Helpwin =window.open('formAide.htm','','scrollbars=yes,status=yes,resizable=yes,width=300,height=300');}

// choix du second cycle
function avertis(n){
		alert(monaide[n]);
}

// situation agence
function setSitagence(){
	if(document.forms[0].AGENCE.selectedIndex==SiteAgence)ChangePrix();
  	SiteAgence=document.forms[0].AGENCE.selectedIndex;
	if(SiteAgence>0 && document.forms[0].reglement[1].checked)avertis(1);
	if((SiteAgence==1 ||SiteAgence==2) && document.forms[0].reglement[0].checked)avertis(2);
	fixeprix(SiteAgence);
	
}
 
// Modification du prix en fonction du lieu de domicile
function ChangePrix(){
	if(document.forms[0].TARIF.options[1].selected){
	stok();
	self.document.location="n_outremer.htm";
	return;} 
if(document.forms[0].TARIF.options[19].selected){
	stok();
	self.document.location="n_outremer.htm";
	return;} 
if(document.forms[0].TARIF.options[0].selected){fixeprix(0); }
else{fixeprix(1);} } 


/*function averti(n){ alert(monaide[n]);
}*/

///////////////////
function Queljour(){ 
today = new Date(); jour =today.getDate(); mois = today.getMonth()+1; 
annee = today.getYear();
if(navy=="Netscape")annee +=1900;
document.forms[0].Date.value=jour +"/"+ mois+"/"+annee;}
//////////////////////
// Fonction de Taxation géographique
function LocAgence(){
var taxe=0; 
if(SiteAgence == 0) return taxe;// France

    if(document.forms[0].reglement[1].checked){ taxe = ((TaxEurope/79.4)*100);}
	if(SiteAgence == 1){taxe+=TaxEngland } 
	if(SiteAgence ==2){taxe+=TaxPortos;} 
	taxe=arrondi(taxe);
	return taxe; 
}
//////////////////////////////
function arrondi(pe){
 var p = (pe+0.005)*100;  
return(p = parseInt(p)/100); } 

function navigue(){
	if(opener!=null)self.close();
	else{
		if(navigator.appName=="Microsoft Internet Explorer"){
		self.document.location.href="../sommaire.htm";}
		else{history.back();}	
	}	
} 


