//<![CDATA[
//
// controle des formulaires 
// @author Carole Grondein et Caroline Isautier Rougeot - sanfranciscoconsult.com
// $root = '../';
// $fichier='valider.js';

// alert("on entre dans valider.js");
 

// script d'attente d'affichage a l'onload d'une page de traitement de form
 
function afficheAttente() {

		
 		//  alert("on entre ds afficheattente simple");
 		
 		/* if(type=="attente") {
 		var bulle=window.open('jss/bulle_aide_attente.html',"bulle_attente","width=240, height=130,top=150, left=150"); 		
 		setTimeout("enleveAttente()",5000 );
 		 }
		*/
		
 		//if(type=="invite") {
 		var bulle=window.open('jss/bulle_aide_invitation.html',"bulle_invitation","width=240, height=130,top=150, left=150"); 		
 		setTimeout("enleveAttente()",5000 );
 		// }
 		 		
 	
}	

// deux fonctions pour gerer l'ouverture et la fermeture d'une pop up message d'attente ou autre a 150 et 150 de l'ecran
function afficheAttente2(type) {

 		 // alert("le type passe est:     "); 
 		
		
 		if(type=='attente') {
 		var bulle=window.open('/beta/jss/bulle_aide_attente.html',"bulle_attente","width=240, height=130,top=150, left=150"); 		
 		// setTimeout("enleveAttente()",2000 );
 		 
 		}
 		
 		else {
 		var bulle=window.open('/beta/jss/bulle_aide_invitation.html',"bulle_invitation","width=240, height=130,top=170, left=170"); 		
 		//  setTimeout("enleveAttente()",2000 );
 		//bulle.close();

 	
 		}
 		
 	
}	


// deux fonctions pr version anglaise pour gerer l'ouverture et la fermeture d'une pop up message d'attente ou autre a 150 et 150 de l'ecran
function afficheAttente2Eng(type) {

 		 // alert("le type passe est:     "); 
 		
		
 		if(type=='attente') {
 		var bulle=window.open('/beta/jss/bulle_aide_attente_en.html',"bulle_attente","width=240, height=130,top=150, left=150"); 		
 		// setTimeout("enleveAttente()",2000 );
 		 
 		}
 		
 		else {
 		var bulle=window.open('/beta/jss/bulle_aide_invitation_en.html',"bulle_invitation","width=240, height=130,top=170, left=170"); 		
 		//  setTimeout("enleveAttente()",2000 );
 		//bulle.close();

 	
 		}
 		
 	
}	


// affiche info bulle dans une div cree sur demande dans les forms pour expliquer d'attendre chargement

function creeBulle() {
  if (document.getElementById) {

 		document.write("<div id=\"infoBulle\"></div>"); 
 	
 		
 	}	
 }		
 		
function infoBulle(text) {

   if (document.getElementById) {
 		
		var bulle= document.getElementById("infoBulle");
		bulle.innerHTML=text;
		bulle.style.visibility= "visible";
		var X=posX;
		if(X<0) X=0;
		var Y=posY+20;
		bulle.style.top= Y +"px";
		bulle.style.left= X +"px";
			
		}
}
		
		
function cacheBulle() {

   if (document.getElementById) {
 
 		  document.getElementById("infoBulle").style.visibility="hidden";		
		}
}	

// utilise pour montrer ou cacher box recherche en haut des pages adherent
function cacheRecherche() {

   if (document.getElementById) {
 
 		  document.getElementById("recherche").style.visibility="hidden";	
 		  rechercheFermee.style.display='';
 		  
		}
}	

function afficheRecherche() {

   if (document.getElementById) {
 
 		  document.getElementById("rechercheFermee").style.visibility="hidden";	
 		  recherche.style.display='';
 		  
		}
}	


// scripts Caroline pour form inviter



function afficheChampsInvites() {

	var nbreInvites = document.getElementById("invitations");



	var InvitesDeux = document.getElementById("inputInvitesDeux");

	var InvitesCinq = document.getElementById("inputInvitesCinq");

	var InvitesDix = document.getElementById("inputInvitesDix");

	

	if ( nbreInvites.value == 2 ) {

		//InvitesDeux.style.display = '';

		InvitesCinq.style.display = 'none';

		InvitesDix.style.display = 'none';

	}

	

	if ( nbreInvites.value == 5 ) {

		//InvitesDeux.style.display = 'none';

		InvitesCinq.style.display = '';

		InvitesDix.style.display = 'none';

	}

	

	if ( nbreInvites.value == 10 ) {

		// InvitesDeux.style.display = 'none';

		InvitesCinq.style.display = '';

		InvitesDix.style.display = '';

	}

}



function changeInvite(title, text)  {
    	if(text)   {
    	 
    	 window.document.inviter.sujet.value= title;
    	 window.document.inviter.message.value= text;
    	 
    	 // document.write (text + " <br />");
    	  }
    
   }
      
      
 
   
// tentative 1

function getLangue(champs)  {

	//alert("on entre dans getlangue");
	
	var titreAnglais= "I invite you to join me on a unique parents' network ";

	var texteAnglais= "  Please join my circle of friends on the International Parents network, a unique club to help us get in touch with families just like ours near home - and far away if need be.  ";
	texteAnglais +="                                     Why? To exchange practical everyday advice when relocating or traveling, especially with kids,";
	texteAnglais += " or to find host families for our teenagers who wish to spend some time abroad.  \nNavigation is in French and in English, but all nationalities are present.";
	
	//alert("texteAnglais defini");
	
	var titreFrancais= " Rejoindre avec moi le club International Parents";
	
	var texteFrancais= " Je t'invite \340 rejoindre mon cercle d'ami(e)s sur International Parents, un club unique en son genre qui permet d'entrer en contact avec des familles qui nous ressemblent pr\350s de chez nous - ou \340 l'autre bout du monde.  ";
	texteFrancais+=	"\n Pourquoi? Pour y \351changer des conseils de vie pratique au moment d'expatriations ou de voyages, ou encore contacter des familles ";
	texteFrancais+= "d'accueil potentielles pour nos enfants dans le cadre d'\351changes  \340 l'\351tranger.";
	
	
	
	//alert("textefrancais defini"); : ä: &#228; ou \344 &auml;  et &auml;  o special: &#246; ou \366  ;u special &uuml ou \374; à: &#340; ou plutot \340 é: \351 ; è: \350 ;

	var titreAllemand= "Ich lade dich ein, meinen Freundeskreis auf International Parents zu treffen";
	
	var texteAllemand= "  Ich lade dich ein in meinen Freundschaftskreis auf International Parents einzutreten. Das ist ein einzigartiger Club der es erm\366glicht mit gleichgesinnten Familien von Nebenan, oder am anderen Ende der Welt, Kontakt aufzunehmen.";
	texteAllemand+= "                                       \nWarum? Um praktische Ratschl\344ge zum Zeitpunkt der Auswanderung oder der Reise auszutauschen oder auch um potentielle Familien f\374r unsere Kinder im Rahmen des Auslandsaustausches zu kontaktieren.";
	texteAllemand+= " Die Navigation ist momentan nur in Franz\366sisch. \nDie englische Navigation wird bald eingef\374hrt und du kannst dich sogar auf Deutsch oder in einer anderen Sprachen ausdr\374cken.";
	//texteAllemand=escape(texteAllemand);
			
	if(champs.options[champs.selectedIndex].value=="1") {
		var titre= titreFrancais;
		var texte= texteFrancais;
	//	alert("le texte est francais");
		
		} 
				  
			  
	if(champs.options[champs.selectedIndex].value=="2") {
		var titre=titreAnglais;
		 var texte= texteAnglais;
	//	 alert("le texte est anglais");
		  
			}   
			
	if(champs.options[champs.selectedIndex].value=="3") {
		  var titre= titreAllemand ;
		  var texte= texteAllemand;
		 //alert("le texte est allemand, excusez nous pour les caracteres speciaux et le titre, a traduire...");
			} 
		
	//	return texte;
			
	  changeInvite(titre,texte);
							
    }
    

// variante pour reinvitation - textes modifies

function getLangue2(champs)  {

	//alert("on entre dans getlangue");
	
	var titreAnglais= "Haven't yet joined me on a unique parents network ?";

	var texteAnglais= "  I realize you haven't had time to respond.  Yet I encourage you to join my circle of friends on the International Parents network, a unique club to help us get in touch with families just like ours near home - and far away if need be.  ";
	texteAnglais +="                                     Why? To exchange practical everyday advice when relocating or traveling, especially with kids,";
	texteAnglais += " or to find host families for our teenagers who wish to spend some time abroad.  \nNavigation is in French and in English but all nationalities are present.";
	
	//alert("texteAnglais defini");
	
	var titreFrancais= " Pas encore inscrit(e) au club des familles futees ?";
	
	var texteFrancais= " Tu n'as pas encore eu le temps de t'inscrire.  Pourtant je t'invite vraiment \340 rejoindre mon cercle d'ami(e)s sur International Parents, un club unique en son genre qui permet d'entrer en contact avec des familles qui nous ressemblent pr\350s de chez nous - ou \340 l'autre bout du monde.  ";
	texteFrancais+=	"\n Pourquoi? Pour y \351changer des conseils de vie pratique au moment d'expatriations ou de voyages, ou encore contacter des familles ";
	texteFrancais+= "d'accueil potentielles pour nos enfants dans le cadre d'\351changes  \340 l'\351tranger.";
	
	
	
	//alert("textefrancais defini"); : ä: &#228; ou \344 &auml;  et &auml;  o special: &#246; ou \366  ;u special &uuml ou \374; à: &#340; ou plutot \340 é: \351 ; è: \350 ;

	var titreAllemand= "Haven't yet joined me on a unique parents network ?";
	
	var texteAllemand= "  Ich lade dich ein in meinen Freundschaftskreis auf International Parents einzutreten. Das ist ein einzigartiger Club der es erm\366glicht mit gleichgesinnten Familien von Nebenan, oder am anderen Ende der Welt, Kontakt aufzunehmen.";
	texteAllemand+= "                                       \nWarum? Um praktische Ratschl\344ge zum Zeitpunkt der Auswanderung oder der Reise auszutauschen oder auch um potentielle Familien f\374r unsere Kinder im Rahmen des Auslandsaustausches zu kontaktieren.";
	texteAllemand+= " Die Navigation ist momentan nur in Franz\366sisch. \nDie englische Navigation wird bald eingef\374hrt und du kannst dich sogar auf Deutsch oder in einer anderen Sprachen ausdr\374cken.";
	//texteAllemand=escape(texteAllemand);
			
	if(champs.options[champs.selectedIndex].value=="1") {
		var titre= titreFrancais;
		var texte= texteFrancais;
	//	alert("le texte est francais");
		
		} 
				  
			  
	if(champs.options[champs.selectedIndex].value=="2") {
		var titre=titreAnglais;
		 var texte= texteAnglais;
	//	 alert("le texte est anglais");
		  
			}   
			
	if(champs.options[champs.selectedIndex].value=="3") {
		  var titre= titreAllemand ;
		  var texte= texteAllemand;
		 //alert("le texte est allemand, excusez nous pour les caracteres speciaux et le titre, a traduire...");
			} 
		
	//	return texte;
			
	  changeInvite(titre,texte);
							
    } 
 





// fonction utilisee ds mise a jour du profil sur pages Inscription et sur pages de nav

function validerMAJ() 
{
	  err="";
	   
	 
	 if (err == "") 
	 {
	 document.forms[0].submit();
	 }
	 
}

// fonction utilisee ds envoi Recherche sur pages Adherents


function validerMAJ2(form) 
{
	  err="";
	   
	 
	 if (err == "") 
	 {
	 document.forms["form"].submit();
	 }
	 
}




function gotoUrl(url) {
  if (url == "")
    return;
  location.href = url;
}



/*function OpenPopUp(MyFile,MyWindow,MyWidth,MyHeight)

//MyFile :	  nom du fichier contenant le code HTML du pop-up
//MyWindow :	  nom de la fenêtre (ne pas mettre d'espace)
//MyWidth :	  entier indiquant la largeur de la fenêtre en pixels
//MyHeight :	  entier indiquant la hauteur de la fenêtre en pixels

{	  
var ns4 = (document.layers)? true:false; 	  //NS 4
var ie4 = (document.all)? true:false;	  //IE 4
var dom = (document.getElementById)? true:false;	  //DOM
var xMax, yMax, xOffset, yOffset;;	  

    if (ie4 || dom)
        {
        xMax = screen.width;
        yMax = screen.height;
        }
    else if (ns4)
        {
        xMax = window.outerWidth;
        yMax = window.outerHeight;
        }
    else
        {
        xMax = 800;
        yMax = 600;
        }
    xOffset = (xMax - MyWidth)/2;
    yOffset = (yMax - MyHeight)/2;
    window.open(MyFile,MyWindow,'width='+MyWidth
+',height='+MyHeight
+',screenX='+xOffset
+',screenY='+yOffset
+',top='+yOffset
+',left='+xOffset
+',scrollbars=yes,resizable=yes');
    }
    
*/    

/* A utiliser dans bloc Recherche page adherents

	echo"<div class=\"heading\">";
					echo "<a href=\"#\" onclick=\"CollapseInterests();return false;\" id=\"CollapseInterests\" >";
					echo "<img src=\"../img/minus_profile.gif\" alt=\"Cacher l'info\" width=\"12\" height=\"12\" align=\"right\" valign=\"middle\" style=\"margin-top:2px;\" /></a>";
					
					echo "<a href=\"#\" onclick=\"ExpandInterests();return false;\" id=\"ExpandInterests\" style=\"display:none;\">"; 
					echo "<img src=\"../img/plus_profile.gif\" alt=\"Plus d'info\" width=\"12\" height=\"12\" align=\"right\" valign=\"middle\" style=\"margin-top:2px;\" /></a>";
							
					echo "<span class=\"bold orange\">Centres d'Int&eacute;r&ecirc;t : </span>";
					echo "<span class=\"int_network\">R&eacute;seau,</span>";
					echo "<span class=\"int_personal\">Perso,</span>";
					echo "<span class=\"int_family\">Famille</span>";
					echo "</div>";
					
					echo "<span id=\"AllInterests\" style=\"display:all;\">";
					echo "<p class=\"bulleted int_network\">";
						
						
						
function ExpandInterests() {
	document.getElementById("ExpandInterests").style.display="none";
	document.getElementById("CollapseInterests").style.display="block";
	document.getElementById("AllInterests").style.display="block";
	};
function CollapseInterests() {
	document.getElementById("ExpandInterests").style.display="block";
	document.getElementById("CollapseInterests").style.display="none";
	document.getElementById("AllInterests").style.display="none";
	}

*/


// cree pour page adherent avec boite de recherche

function ShowSearch() {

alert("on passe par ShowSearch");

	document.getElementById("closedSearch").style.display="none";
	document.getElementById("openSearch").style.display="block";
	
	};
function CollapseSearch() {
alert("on passe par collapseSearch");

	document.getElementById("closedSearch").style.display="block";
	document.getElementById("openSearch").style.display="none";
	
	/*document.getElementById("AllInterests").style.display="none";*/
	
	}


// utilisee ds pages principales pour valider lorsque boutton en image
function valider() 
{
	  err="";	   	 
	 if (err == "") {document.forms[0].submit();}	 
	
}

// marche pas

/*
SCRIPT EDITE SUR L'EDITEUR JAVASCRIPT
http://www.editeurjavascript.com
*/

// a VALIDER!!

/*function verifier_email(champs)
	{
	var adresse = champs.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	if ((place > -1)&&(adresse.length >2)&&(point > 1))
		{
		return(true);
		}
	else
		{
		
		alert('Woops! l\' email indiqu\351 ne semble pas valide \n');		
		//return(false);
			//if(document.getElementById)  {
			// enlevé semble trop occuper serveur
			 // document.getElementById.champs.focus();
		// } 
		}
	}

*/


// pris de page send a test email de Constant contact

/*function doSubmit(v){
    document.forms[0].elements['view'].value = v;
    document.forms[0].submit();
}
function doTest(){

    if (false)
    {
        location.href = 'null';

    }
    else
    {
        document.forms[0].action = 'previewer.jsp';
        doSubmit('test');
    }
}
function doSpamCheck(){
    document.forms[0].action = 'previewer.jsp';
    doSubmit('check');
}

*/


/*function enleveAttente() {

	  if (document.getElementById) {
		  document.getElementById(encadre).style.visibility="hidden";
		} else if (document.all) {
		  document.all[encadre].style.visibility="hidden";
		} else if (document.layers) {
		  document.layers[encadre].visibility="hidden";
		} 
}	

*/

function enleveAttente() {
 		// alert ("on passe par enleveattente");
 
		if(bulle)	{
 			if(!bulle.closed) { bulle.close();} 							
	}
}	



var posX=0, posY=0;
document.onmousemove=getMousePos;

function getMousePos(e){

// if IE
   if (document.all) {
  		  posX=event.x+document.body.scrollLeft;
 		  posY= event.y+document.body.scrollTop;		  
		}
	else   // if others
	{
	  	  posX= e.pageX;
 		  posY= e.pageY;
 		  
	}
}		

/*function getXMLHttpRequest() {
        var xhr = null;
 
        if(window.XMLHttpRequest || window.ActiveXObject) {
                if(window.ActiveXObject) {
                        try {
                                xhr = new ActiveXObject("Msxml2.XMLHTTP");
                        } catch(e) {
                                xhr = new ActiveXObject("Microsoft.XMLHTTP");
                        }
                } else {
                        xhr = new XMLHttpRequest();
                }
        } else {
                alert("Toute l'interactivite souhaitee n'est pas possible.  Il faudrait une version recente de votre navigateur.");
                return null;
        }
 
        return xhr;

  }

*/



//]]>



 