/************************************************************************************************************/
/*    Fonctions de controle de fomulaire sur la fiche de renseignements                                   */
/************************************************************************************************************/


		/*  Affichage de la liste des pays */
		
		function test_valeur(objet,min,max)
		{
		  with (objet)
		  {
		    valeur=parseInt(value);    /* Lit la valeur et compare avec les limites*/
			if (value >= 'a')
				{ valeur = '' }
		    if ((parseInt(min)!=min || valeur<min || parseInt(max)!=max
		      || valeur>max || value!=valeur) && (value!=='') )
		    {
		    	strSALTRA = prompt('<%=strPhrase%>', valeur);
		      	if (strSALTRA==null) { 
		      		document.FORMULAIRE.SALTRA.value = valeur;
		      		}
		      	else {
		      		document.FORMULAIRE.SALTRA.value = strSALTRA;
		      	}
		    }
		    else /* Si elle est dans les limites*/
		    {
		      return true;
		    }
		  }
		}
 
		
		
		function Pays_lst(i) {
		
		msg=window.open('/my_esp/my_fiche_choix_pays.asp?vpays='+i,'Choisissez_votre_pays', 'width=600,height=500,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
		msg.focus();
		return (true);
		}
		
		function Payspri() {
		
		if (document.FORMULAIRE.PAYSPRI.value==""){
			msg = window.open('/my_esp/my_fiche_choix_pays.asp?vpays=1','Choisissez_votre_pays', 'width=400,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			msg.focus();
			return (true);
		}
		}
		
		function ecrirePayspri(parametre){
		
		tablo=parametre.split("|");
		param=tablo[0];
		if (param == "NOPAYS") {
			document.FORMULAIRE.PAYSPRI.value=" ";
			return(true);
		}else{
			document.FORMULAIRE.PAYSPRI.value=unescape(param);
			return(true);
		}
		}
		
		
		function Paysprib() {
		
		if (document.FORMULAIRE.PAYSPRIB.value=="") {
			msg=window.open('/my_esp/my_fiche_choix_pays.asp?vpays=2','Choisissez_votre_pays', 'width=400,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			msg.focus();
			return (true);
		}
		}
		
		function ecrirePaysprib(parametre){
		
		tablo=parametre.split("|");
		param=tablo[0];
		if (param == "NOPAYS") {
			document.FORMULAIRE.PAYSPRIB.value=" ";
			return(true);
		}else{
			document.FORMULAIRE.PAYSPRIB.value=unescape(param);
			return(true);
		}
		}
		
		
		function Paystra() {
		
		if (document.FORMULAIRE.PAYSTRA.value=="") {
			msg=window.open('/my_esp/my_fiche_choix_pays.asp?vpays=3','Choisissez_votre_pays', 'width=400,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			msg.focus();
			return (true);
		}
		}
		
		function ecrirePaystra(parametre){
		
		tablo=parametre.split("|");
		param=tablo[0];
		if (param == "NOPAYS") {
			document.FORMULAIRE.PAYSTRA.value=" ";
			return(true);
		}else{
			document.FORMULAIRE.PAYSTRA.value=unescape(param);
			return(true);
		}
		}
		
		
		function Paystrab() {
		
		if (document.FORMULAIRE.PAYSTRAB.value=="") {
			msg=window.open('/my_esp/my_fiche_choix_pays.asp?vpays=4','Choisissez_votre_pays', 'width=400,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			msg.focus();
			return (true);
		}
		}
		
		function ecrirePaystrab(parametre){
		
		tablo=parametre.split("|");
		param=tablo[0];
		if (param == "NOPAYS") {
			document.FORMULAIRE.PAYSTRAB.value=" ";
			return(true);
		}else{
			document.FORMULAIRE.PAYSTRAB.value=unescape(param);
			return(true);
		}
		}
		
		
		
		/*// Affichage de la liste des codes naf APE et APEB */
		
		function Ape() {
		
		if ((document.FORMULAIRE.APE.value=="") && (document.FORMULAIRE.SOCIETE.value>"")) {
			msg=window.open('/my_esp/my_fiche_choix_codenaf.asp?vnaf=1','Choisissez_votre_code_naf', 'width=600,height=500,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			msg.focus();
			return (true);
		}
		}
		
		function Ape_lst() {
		
		if (document.FORMULAIRE.SOCIETE.value>"") {
			msg=window.open('/my_esp/my_fiche_choix_codenaf.asp?vnaf=1','Choisissez_votre_code_naf', 'width=600,height=500,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			msg.focus();
			return (true);
		}
		}
		
		function ecrireApe(parametre){
		
		tablo=parametre.split("|");
		param=tablo[0];
		if (param == "NOAPE") {
			document.FORMULAIRE.APE.value=" ";
			return(true);
		}else{
			document.FORMULAIRE.APE.value=unescape(param);
			return(true);
		}
		}
		
		
		function Apeb() {
		
		if ((document.FORMULAIRE.APEB.value=="") && (document.FORMULAIRE.SOCIETEB.value>"")) {
			msg=window.open('/my_esp/my_fiche_choix_codenaf.asp?vnaf=2','Choisissez_votre_code_naf', 'width=600,height=500,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			msg.focus();
			return (true);
		}
		}
		
		function Apeb_lst() {
		
		if (document.FORMULAIRE.SOCIETEB.value>"") {
			msg=window.open('/my_esp/my_fiche_choix_codenaf.asp?vnaf=2','Choisissez_votre_code_naf', 'width=600,height=500,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			msg.focus();
			return (true);
		}
		}
		
		function ecrireApeb(parametre){
		
		tablo=parametre.split("|");
		param=tablo[0];
		if (param == "NOAPE") {
			document.FORMULAIRE.APEB.value=" ";
			return(true);
		}else{
			document.FORMULAIRE.APEB.value=unescape(param);
			return(true);
		}
		}
		
		
		/*// Affichage de la liste des Fonctions CD_FONCT et CD_FONCTB -----------*/
		function Fonct() {
		
		if ((document.FORMULAIRE.CD_FONCT.value=="") && (document.FORMULAIRE.FONCTION.value>"")) {
			msg=window.open('/my_esp/my_fiche_choix_codefct.asp?vfct=1','Choisissez_votre_fonction', 'width=500,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			msg.focus();
			return (true);
		}
		}
		
		function Fonct_lst() {
		
		if (document.FORMULAIRE.FONCTION.value>"") {
			msg=window.open('/my_esp/my_fiche_choix_codefct.asp?vfct=1','Choisissez_votre_fonction', 'width=500,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			msg.focus();
			return (true);
		}
		}
		
		
		function ecrireFonct(parametre){
		
		tablo=parametre.split("|");
		param=tablo[0];
		if (param == "NOFONCT") {
			document.FORMULAIRE.CD_FONCT.value=" ";
			return(true);
		}else{
			document.FORMULAIRE.CD_FONCT.value=unescape(param);
			return(true);
		}
		}
		
		
		function Fonctb() {
		
		if ((document.FORMULAIRE.CD_FONCTB.value=="") && (document.FORMULAIRE.FONCTIONB.value>"")) {
			msg=window.open('/my_esp/my_fiche_choix_codefct.asp?vfct=2','Choisissez_votre_fonction', 'width=500,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			msg.focus();
			return (true);
		}
		}
		
		function Fonctb_lst() {
		
		if (document.FORMULAIRE.FONCTIONB.value>"") {
			msg=window.open('/my_esp/my_fiche_choix_codefct.asp?vfct=2','Choisissez_votre_fonction', 'width=500,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
			msg.focus();
			return (true);
		}
		}
		
		
		function ecrireFonctb(parametre){
		
		tablo=parametre.split("|");
		param=tablo[0];
		if (param == "NOFONCT") {
			document.FORMULAIRE.CD_FONCTB.value=" ";
			return(true);
		}else{
			document.FORMULAIRE.CD_FONCTB.value=unescape(param);
			return(true);
		}
		}
		
		/*// Test de l'adresse email personnelle 1 et 2 --------------------------------------------*/
		function emailpri(FORMULAIRE) {
		  if (FORMULAIRE.EMAILPRI.value == "")
				;
		  		else if ((FORMULAIRE.EMAILPRI.value.indexOf('@', 1) == -1) || (FORMULAIRE.EMAILPRI.value.lastIndexOf('.', 49) == -1))
						{
						alert("Adresse Email (coordonnées postale) non valide!");
		    			FORMULAIRE.EMAILPRI.focus();
		  				}
					else if ((FORMULAIRE.EMAILPRI.value.lastIndexOf('.', 49)) - (FORMULAIRE.EMAILPRI.value.indexOf('@', 0)) < 2)
						{
						alert("Adresse E-mail (coordonnées postale) non valide!");
		    			FORMULAIRE.EMAILPRI.focus();
		  				}
			}
		
		function emailprib(FORMULAIRE) {
		  if (FORMULAIRE.EMAILPRIB.value == "")
				;
		  		else if ((FORMULAIRE.EMAILPRIB.value.indexOf('@', 1) == -1) || (FORMULAIRE.EMAILPRIB.value.lastIndexOf('.', 49) == -1))
						{
						alert("Adresse E-mail (coord. perso. secondaires) non valide!");
		    			FORMULAIRE.EMAILPRIB.focus();
		  				}
					else if ((FORMULAIRE.EMAILPRIB.value.lastIndexOf('.', 49)) - (FORMULAIRE.EMAILPRIB.value.indexOf('@', 0)) < 2)
						{
						alert("Adresse E-mail (coord. perso. secondaires) non valide!");
		    			FORMULAIRE.EMAILPRIB.focus();
		  				}
			}
		
		
		
		/*// Test de l'adresse email pro 1 et 2 --------------------------------------------*/
		function emailtra(FORMULAIRE) {
		  if (FORMULAIRE.EMAILTRA.value == "")
				;
		  		else if ((FORMULAIRE.EMAILTRA.value.indexOf('@', 1) == -1) || (FORMULAIRE.EMAILTRA.value.lastIndexOf('.', 49) == -1))
						{
						alert("Adresse Email (emploi principal) non valide!");
		    			FORMULAIRE.EMAILTRA.focus();
		  				}
					else if ((FORMULAIRE.EMAILTRA.value.lastIndexOf('.', 49)) - (FORMULAIRE.EMAILTRA.value.indexOf('@', 0)) < 2)
						{
						alert("Adresse Email (emploi principal) non valide!");
		    			FORMULAIRE.EMAILTRA.focus();
		  				}
			}
		
		function emailtrab(FORMULAIRE) {
		  if (FORMULAIRE.EMAILTRAB.value == "")
				;
		  		else if ((FORMULAIRE.EMAILTRAB.value.indexOf('@', 1) == -1) || (FORMULAIRE.EMAILTRAB.value.lastIndexOf('.', 49) == -1))
						{
						alert("Adresse E-mail (emploi secondaire) non valide!");
		    			FORMULAIRE.EMAILTRAB.focus();
		  				}
					else if ((FORMULAIRE.EMAILTRAB.value.lastIndexOf('.', 49)) - (FORMULAIRE.EMAILTRAB.value.indexOf('@', 0)) < 2)
						{
						alert("Adresse E-mail (emploi secondaire) non valide!");
		    			FORMULAIRE.EMAILTRAB.focus();
		  				}
			}
		
		
		
		/*// Validation date -----*/
		function ValidateDayMonth(form) {
		if (( form.day.value.length >0 ) || ( form.month.value.length >0 ) || ( form.year.value.length >0 )) {
			if ( form.year.value.length == 4) {
				if ( ( form.day.value < 1) || ( form.day.value > 31 ) ) {
					alert("Date de naissance erronée (jours compris entre 1 et 31) !");
					form.day.focus();}
				else if ( form.month.value == 2 ) {
						if ( form.year.value > 1969 ) {		
				   			if ( (4 * Math.floor( form.year.value / 4 )) == form.year.value ){			
		   	   					if ( form.day.value > 29 ) {
									alert("Date de naissance erronée (29 j maximum en février les années bisextiles) !");
								form.day.focus();}}
		    					else if ( form.day.value > 28 ) {
								alert("Date de naissance erronée (28 j maximum en février les années non-bisextiles) !");
								form.day.focus();}}
				  	else if (form.day.value > 29) { 
							alert("Date de naissance erronée (pas plus de 28 ou 29 jours en février) !");
							form.day.focus();}}
			        else if ( (form.month.value == 4) || (form.month.value == 6) || (form.month.value == 9) || (form.month.value == 11) ) {
						if ( form.day.value > 30 ) {
							alert("Date de naissance erronée (Pas plus de 30 jours sur le mois) !");
							form.day.focus();}}}
			else {
				alert("L'année doit comporter 4 chiffres !");
				form.day.focus() ;}}
		else {
			;}
		;}
		
		
		
		
		/*// Test de l'absence de valeurs dans certains champs et rejet champs obligatoires vides-----*/
		function ValidateBlank(champ) {
		  if (champ.value.length == 0) return true;	
		  else return false;} 
		
		function CheckNotBlank(champ, message) {	
		  if ( ValidateBlank( champ ) )	{		
		    alert( 'La saisie du champ [' + message + '] est obligatoire.' );
		    champ.focus();
		    return false;} 
		   else	{
		    return true;}}


/**************************************************************************************************************/
                   /* banniere photo et texte défilants */
/**************************************************************************************************************/


// WebTicker by Mioplanet
// www.mioplanet.com

TICKER_CONTENT = document.getElementById("TICKER").innerHTML;
 
TICKER_RIGHTTOLEFT = false;
TICKER_SPEED = 1;
TICKER_STYLE = "font-family:Arial; font-size:12px; color:#444444";
TICKER_PAUSED = false;

ticker_start();

function ticker_start() {
	var tickerSupported = false;
	TICKER_WIDTH = document.getElementById("TICKER").style.width;
	var img = "<img src=ticker_space.gif width="+TICKER_WIDTH+" height=0>";

	// Firefox
	if (navigator.userAgent.indexOf("Firefox")!=-1 || navigator.userAgent.indexOf("Safari")!=-1) {
		document.getElementById("TICKER").innerHTML = "<TABLE  cellspacing='0' cellpadding='0' width='100%'><TR><TD nowrap='nowrap'>"+img+"<SPAN style='"+TICKER_STYLE+"' ID='TICKER_BODY' width='100%'>&nbsp;</SPAN>"+img+"</TD></TR></TABLE>";
		tickerSupported = true;
	}
	// IE
	if (navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1) {
		document.getElementById("TICKER").innerHTML = "<DIV nowrap='nowrap' style='width:100%;'>"+img+"<SPAN style='"+TICKER_STYLE+"' ID='TICKER_BODY' width='100%'></SPAN>"+img+"</DIV>";
		tickerSupported = true;
	}
	if(!tickerSupported) document.getElementById("TICKER").outerHTML = ""; else {
		document.getElementById("TICKER").scrollLeft = TICKER_RIGHTTOLEFT ? document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth : 0;
		document.getElementById("TICKER_BODY").innerHTML = TICKER_CONTENT;
		document.getElementById("TICKER").style.display="block";
		TICKER_tick();
	}
}

function TICKER_tick() {
	if(!TICKER_PAUSED) document.getElementById("TICKER").scrollLeft += TICKER_SPEED * (TICKER_RIGHTTOLEFT ? -1 : 1);
	if(TICKER_RIGHTTOLEFT && document.getElementById("TICKER").scrollLeft <= 0) document.getElementById("TICKER").scrollLeft = document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth;
	if(!TICKER_RIGHTTOLEFT && document.getElementById("TICKER").scrollLeft >= document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth) document.getElementById("TICKER").scrollLeft = 0;
	window.setTimeout("TICKER_tick()", 30);
}

/**************************************************************************************************************/
/**************************************************************************************************************/

/**************************************************************************************************************/
                   /* copier coller */
/**************************************************************************************************************/

function CopyPaste(ChampSource, ChampDestination)
/* a ajouter danas  la page HTML */
/* <input type="button" value="==>" onclick="CopyPaste(document.[Nom du Form].[Nom du champ Textarea à copier], document.[Nom du Form].[Nom du champ Textarea de destination]);"> */
{

   ChampSource.focus();

   ChampSource.select(); 

   CopiedTxt = document.selection.createRange();

   CopiedTxt.execCommand("Copy");
   
   ChampDestination.focus();

   PastedText = ChampDestination.createTextRange();

   PastedText.execCommand("Paste");


}




