var timer;
var h = -600;	// set this to the same value of the top property for the pa div in the style sheet
var w = 368;	// set this to the same value of the width property for the pa div in the style sheet, smaller to move it to the right, larger to move it to the left
var t = 160;	// set this to the actual pixel distance from the top where you want the pa div to be at the end of the descent

function startAp() {
	if (document.getElementById) document.getElementById("pg").style.visibility = 'visible';
	else if (document.layers) document.layers.page.visibility = 'show';
	else if (document.all) document.all.page.style.visibility = 'visible';
	setLeft();
	showAp();
}

function hideAp() { 
	if (document.getElementById) document.getElementById("pg").style.visibility = 'hidden';
	else if (document.layers) document.layers.page.visibility = 'hide';
	else if (document.all) document.all.page.style.visibility = 'hidden';
}

function showAp() { 
	state=typeof tPos;
	if(state=='undefined') tPos = h;
	if(tPos < t) { 
		tPos+=25;
		if (document.layers) document.layers.page.top = tPos+"px";
		else if (document.all) document.all.page.style.top = tPos+"px";
		else if (document.getElementById) document.getElementById("pg").style.top = tPos+"px";
	}

	if(timer!=null) clearInterval(timer);
	timer = setTimeout("showAp()",100);
}

function getoPos() {
	if (document.getElementById) alert(document.getElementById("pg").style.top);
	else if (document.layers) alert(document.layers.page.top);
	else if (document.all) alert(document.all.page.style.top);
}

function setLeft() {
	if (document.getElementById) document.getElementById("pg").style.left = ((window.innerWidth / 2) - (w / 2))+"px";
	else if (document.layers) document.layers.page.left = ((window.innerWidth / 2) - (w / 2))+"px";
	else if (document.all) document.all.page.style.left = ((document.body.offsetWidth / 2) - (w / 2))+"px";
}


function valider(){
var form = document.amis;
		form.method='POST';
		form.target='amis';
		form.action='amis.php';
		form.submit();
		hideAp();
}

function OpenNewWindow(mypage, myname, w, h, scroll) { 
	var winl = (screen.width - w) / 2; 
	var wint = (screen.height - h) / 2; 
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',' ;
	win = window.open(mypage, myname, winprops) ;
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } 
}

function valide(){
var form = document.insc;
if(form.nom.value&&form.prenom.value&&verifEmail(form.email.value)){
	form.method='POST';
	form.target='_self';
	form.action='inscription.php';
	form.submit();
	}
else{
	alert("Vous n’avez pas rempli correctement tous les champs obligatoires.");
	}
}

function valid(){
var form = document.fin;
if(form.nom.value&&form.prenom.value&&form.rue.value&&form.ville.value&&form.cp.value&&form.pays.value&&verifEmail(form.email.value)){
	document.location.href="http://hebraica.org:8080/payment/RequestServlet?nom="+form.nom.value+"&prenom="+form.prenom.value+"&rue="+form.rue.value+"&ville="+form.ville.value+"&cp="+form.cp.value+"&pays="+form.pays.value+"&email="+form.email.value+"&montant="+form.montant.value+"&domaine=loi-contre-antisionisme.org&retour=index.php";
	}
else{
	alert("Vous n’avez pas rempli correctement tous les champs obligatoires.");
	}
}

function verifEmail(mail){
    //returns false if email is uncorrect
    //returns true if email is correct
     var flag=false;
     var  okA;
     var okP;
     var longueur=mail.length;
    var saisie1 = mail.indexOf("@");
	 if(saisie1>0){
      var temp = mail.substring(saisie1+1,longueur);
      var okA="ok";
     }
      var okB="ok";
     if (okB=="ok" && okA=="ok"){
      flag=true;
    }
   return flag;
    }
