/*=====================================================*/
/*  Fonctions javascript pour Anais                    */
/*  Projet refonte mise ? disposition Sirene           */
/*=====================================================*/

/*=== Fonction permettant de cacher un element ===*/
function cache(id) {
	if (document.getElementById(id)) {
		document.getElementById(id).style.visibility="hidden";
	}
}

/*=== Fonction permettant de montrer un element ===*/
function montre(id) {
	if (document.getElementById(id)) {
		document.getElementById(id).style.visibility="visible";
	}
}

/*=== Fonction permettant d'enlever la valeur d'un element ===*/
function vide(id) {
	if (document.getElementById(id)) {
		document.getElementById(id).value="";
	}
}

/*=== Fonction permettant de cocher un element ===*/
function coche(id) {
	if (document.getElementById(id)) {
		document.getElementById(id).checked=true;
	}
}

/*=== Fonction permettant de decocher un element ===*/
function decoche(id) {
	if (document.getElementById(id)) {
		document.getElementById(id).checked=false;
	}
}

/*=== Fonction permettant de positionner le curseur sur un element ===*/
function active(id) {
	if (document.getElementById(id)) {
		document.getElementById(id).focus();
	}
}

/*=== Fonction Editeur Avis de situation ===*/
function editeur() {
	mafenetre = window.open(" ","InfoEditeur","location=no,status=no,toolbars=no,menubar=no,width=400,height=500");
	mafenetre.document.open();
	mafenetre.document.write("<html>");
	mafenetre.document.write("<head><title>Informations &eacute;diteur</title>");
	mafenetre.document.write("<style type='text/css'>");
	mafenetre.document.write("* {font-family: 'MS Sans Serif', Geneva, sans-serif;font-size: 14px;}");
	mafenetre.document.write("body {background-color: #F9F9F9;}");
	mafenetre.document.write("dt {font-weight: bold;padding-top: 10px;}");
	mafenetre.document.write("h3 {font-size: 18px;text-align: center;}");
	mafenetre.document.write("</style>");
	mafenetre.document.write("</head>");
	mafenetre.document.write("<body><dl>");
	mafenetre.document.write("<h3>Informations &eacute;diteurs</h3>");
	mafenetre.document.write("<dt>Editeur</dt>");
	mafenetre.document.write("<dd>INSEE (Institut national de la statistique et des Etudes Economiques)<br>");
	mafenetre.document.write("18 Bld Adolphe Pinard<br>");
	mafenetre.document.write("75675 PARIS Cedex 14<br>");
	mafenetre.document.write("T&eacute;l&eacute;phone : 09.72.72.60.00</dd>");
	mafenetre.document.write("<dt>Directeur de la publication </dt>");
	mafenetre.document.write("<dd>Jean-Philippe COTIS</dd>");
	mafenetre.document.write("<dt>R&eacute;dacteur en chef</dt>");
	mafenetre.document.write("<dd>Pierrette SCHUHL</dd>");
	mafenetre.document.write("<dt>Administrateur</dt>");
	mafenetre.document.write("<dd>Dounia Boudour</dd>");
	mafenetre.document.write("<dt>Conception graphique</dt>");
	mafenetre.document.write("<dd>INSEE - Centre National Informatique de Nantes</dd>");
	mafenetre.document.write("<dt>Contact technique</dt>");
	mafenetre.document.write("<dd><a href='mailto:ci44-point-focal@insee.fr'>ci44-point-focal@insee.fr</a></dd>");
	mafenetre.document.write("<dd>(+33) 2 40 99 90 65</dd>");
	mafenetre.document.write("</dl>");
	mafenetre.document.write("<a href='javascript:parent.close()'>Fermer</a>");
	mafenetre.document.write("</body>");
	mafenetre.document.write("</html>");
	mafenetre.document.close();
}

/*== Fonction Insee Avis Situation == */
function insee() {
	mafenetre = window.open(" ","CopyRightInsee","location=no,status=no,toolbars=no,menubar=no,width=600,height=600");
	mafenetre.document.open();
	mafenetre.document.write("<html>");
	mafenetre.document.write("<head><title>&copy; INSEE</title>");
	mafenetre.document.write("<style type='text/css'>");
	mafenetre.document.write("* {font-family: 'MS Sans Serif', Geneva, sans-serif;font-size: 14px;}");
	mafenetre.document.write("body {background-color: #F9F9F9;}");
	mafenetre.document.write("dt {font-weight: bold;padding-top: 10px;}");
	mafenetre.document.write("h3 {font-size: 18px;text-align: center;}");
	mafenetre.document.write("li {padding-left: -40px;}");
	mafenetre.document.write("</style>");
	mafenetre.document.write("</head>");
	mafenetre.document.write("<body><dl>");
	mafenetre.document.write("<dt>Conform&eacute;ment &agrave; la r&eacute;glementation les d&eacute;clarations n&eacute;cessaires ont &eacute;t&eacute; effectu&eacute;es :</dt>");
	mafenetre.document.write("<dd>");
	mafenetre.document.write("<ul>");
	mafenetre.document.write("<li>aupr&egrave;s du Tribunal de Grande Instance de Paris</li>");
	mafenetre.document.write("<li>aupr&egrave;s de la Commission Nationale de l'Informatique et des Libert&eacute;s</li>");
	mafenetre.document.write("<li>aupr&egrave;s du Conseil Sup&eacute;rieur de l'Audiovisuel</li>");
	mafenetre.document.write("</ul>");
	mafenetre.document.write("</dd>");
	mafenetre.document.write("<dt>Source des donn&eacute;es</dt>");
	mafenetre.document.write("<dd>Les donn&eacute;es sont issues du r&eacute;pertoire national des entreprises et des &eacute;tablissements g&eacute;r&eacute; par l'INSEE (18 bld Adolphe Pinard - 75675 PARIS Cedex 14) conform&eacute;ment au d&eacute;cret n&deg;73-314 du 14 mars 1973 modifi&eacute; repris par les articles R.123-220 &agrave; R.123-234 du code de commerce..</dd>");
	mafenetre.document.write("<dt>Conditions d'usage et limites de responsabilit&eacute;</dt>");
	mafenetre.document.write("<dd>");
	mafenetre.document.write("<ul>");
	mafenetre.document.write("<li>L'article R.123-231 du d&eacute;cret sus-mentionn&eacute; stipule que &laquo;Aucun effet juridique ne s'attache &agrave; l'identification ou &agrave; la non-identification d'une personne inscrite au r&eacute;pertoire. Celle-ci demeure soumise &agrave; toute obligation l&eacute;gislative, r&eacute;glementaire ou contractuelle aff&eacute;rente &agrave; l'exercice de son activit&eacute;&raquo;.</li>");
	mafenetre.document.write("<li>L'INSEE d&eacute;cline toute responsabilit&eacute; quant &agrave; la pertinence des informations fournies au regard des besoins particuliers des internautes et, a fortiori, quant aux utilisations qu'ils sont susceptibles d'en faire.</li>");
	mafenetre.document.write("<li>L'INSEE d&eacute;tient l'ensemble des droits de propri&eacute;t&eacute; intellectuelle des &eacute;l&eacute;ments figurant sur ce site. La r&eacute;utilisation des donn&eacute;es qui s'affichent &agrave; l'&eacute;cran est soumise &agrave; la mention de la source sous la forme &laquo;INSEE - Base de Donn&eacute;es SIRENE&raquo;</li>");
	mafenetre.document.write("</ul>");
	mafenetre.document.write("</dd>");
	mafenetre.document.write("</dl>");
	mafenetre.document.write("Cette autorisation ne couvre pas les &eacute;crans de navigation, les logos et les images pour lesquels toute reproduction, totale ou partielle, ou imitation, est interdite, sans l'accord expr&egrave;s, pr&eacute;alable et &eacute;crit de l'INSEE.<br><br>");
	mafenetre.document.write("<a href='javascript:parent.close()'>Fermer</a>");
	mafenetre.document.write("</body>");
	mafenetre.document.write("</html>");
	mafenetre.document.close();
}

/*== Fonction Insee Web DGI == */
function inseeDGI() {
	mafenetre = window.open(" ","CopyRightInsee","location=no,status=no,toolbars=no,menubar=no,width=600,height=600");
	mafenetre.document.open();
	mafenetre.document.write("<html>");
	mafenetre.document.write("<head><title>&copy; INSEE</title>");
	mafenetre.document.write("<style type='text/css'>");
	mafenetre.document.write("* {font-family: 'MS Sans Serif', Geneva, sans-serif;font-size: 14px;}");
	mafenetre.document.write("body {background-color: #F9F9F9;}");
	mafenetre.document.write("dt {font-weight: bold;padding-top: 10px;}");
	mafenetre.document.write("h3 {font-size: 18px;text-align: center;}");
	mafenetre.document.write("li {padding-left: -40px;}");
	mafenetre.document.write("</style>");
	mafenetre.document.write("</head>");
	mafenetre.document.write("<body><dl>");
	mafenetre.document.write("<dt>Conform?ment ? la r?glementation les d?clarations n?cessaires ont ?t? effectu?es :</dt>");
	mafenetre.document.write("<dd>");
	mafenetre.document.write("<ul>");
	mafenetre.document.write("<li>aupr?s de la Commission Nationale de l'Informatique et des Libert?s</li>");
	mafenetre.document.write("</ul>");
	mafenetre.document.write("</dd>");
	mafenetre.document.write("<dt>Source des donn?es</dt>");
	mafenetre.document.write("<dd>Les donn?es sont issues du r?pertoire national des entreprises et des ?tablissements g?r? par l?INSEE (18 bld Adolphe Pinard - 75675 PARIS Cedex 14) conform?ment au d?cret n? 73-314 du 14 mars 1973 modifi?.</dd>");
	mafenetre.document.write("<dt>Conditions d?usage et limites de responsabilit?</dt>");
	mafenetre.document.write("<dd>");
	mafenetre.document.write("<ul>");
	mafenetre.document.write("<li>L?article 13 du d?cret sus-mentionn? stipule que ? Aucun effet juridique ne s'attache ? l'identification ou ? la non-identification d'une personne inscrite au r?pertoire. Celle-ci demeure soumise ? toute obligation l?gislative, r?glementaire ou contractuelle aff?rente ? l'exercice de son activit? ?</li>");
	mafenetre.document.write("<li>L'INSEE d?cline toute responsabilit? quant ? la pertinence des informations fournies au regard des besoins particuliers des internautes et, a fortiori, quant aux utilisations qu?ils sont susceptibles d?en faire.</li>");
	mafenetre.document.write("<li>L'utilisation des donn?es qui s?affichent ? l??cran est soumise ? la mention de la source sous la forme : ? source : INSEE - R?pertoire des entreprises et des ?tablissements (Sirene) ?</li>");
	mafenetre.document.write("</ul>");
	mafenetre.document.write("</dd>");
	mafenetre.document.write("<dt>Contact technique</dt>");
	mafenetre.document.write("<dd><a href='mailto:ci44-point-focal@insee.fr'>ci44-point-focal@insee.fr</a></dd>");
	mafenetre.document.write("</dl>");
	mafenetre.document.write("<a href='javascript:parent.close()'>Fermer</a>");
	mafenetre.document.write("</body>");
	mafenetre.document.write("</html>");
	mafenetre.document.close();
}

/*=== Fonction Aide du menu ===*/
function aide() {
	mafenetre = window.open(" ","Aide","location=no,status=no,toolbars=no,menubar=no,width=400,height=500");
	mafenetre.document.open();
	mafenetre.document.write("<html>");
	mafenetre.document.write("<head><title>Aide</title>");
	mafenetre.document.write("<style type='text/css'>");
	mafenetre.document.write("* {font-family: 'MS Sans Serif', Geneva, sans-serif;font-size: 14px;}");
	mafenetre.document.write("body {background-color: #F9F9F9;}");
	mafenetre.document.write("p {padding: 5px;}");
	mafenetre.document.write("#lien {text-align: center;letter-spacing: 50px;}");
	mafenetre.document.write("img {border: none;}");
	mafenetre.document.write("h3 {font-size: 18px;text-align: center;}");
	mafenetre.document.write("</style>");
	mafenetre.document.write("</head>");
	mafenetre.document.write("<body><dl>");
	mafenetre.document.write("<h3>Environnement technique</h3>");
	mafenetre.document.write("<p>Ce site est con&ccedil;u et optimis&eacute; pour un affichage en 1024 * 768 et les versions 4 et suivantes du navigateur Microsoft Internet Explorer ou les versions 1.0 et suivantes du navigateur FireFox.</p>");
	mafenetre.document.write("<p>Vous pouvez les t&eacute;l&eacute;charger en cliquant sur une des ic&ocirc;nes ci-dessous :</p>");
	mafenetre.document.write("<p id='lien'>");
	mafenetre.document.write("<a href='http://www.microsoft.com/downloads/details.aspx?displaylang=fr&FamilyID=1E1550CB-5E5D-48F5-B02B-20B602228DE6' title='T&eacute;l&eacute;charger Internet Explorer (nouvelle fen&ecirc;tre)' target='_blank'><img src='/avisitu/css/logo/ie-logo-29x32.png' alt=''></a>");
	mafenetre.document.write("&nbsp;");
	mafenetre.document.write("<a href='http://www.mozilla-europe.org/fr/products/firefox/' title='T&eacute;l&eacute;charger FireFox (nouvelle fen&ecirc;tre)' target='_blank'><img src='/avisitu/css/logo/firefox-logo-32x32.png' alt=''></a>");
	mafenetre.document.write("</p>");
	mafenetre.document.write("<a href='javascript:parent.close()'>Fermer</a>");
	mafenetre.document.write("</body>");
	mafenetre.document.write("</html>");
	mafenetre.document.close();
}

/***************************************************************************
 * Function: sireneKeyUp
 * Description: Formatage d' un siren
 * @Author VGA
 *
 * @param champs champs en cours de modification
 *
 ***************************************************************************/
function sireneKeyUp(champs) {
  keyValue = window.event.keyCode;
  if (keyValue == 13) {
    champs.blur();
  }
  else if (keyValue != 46) { // Autre touche que la touche entrée et la touche suppr
    if (keyValue!=8) { // Cas différent d'une suppression (delete)
      if (champs.value.length==9) {
        var tmp = champs.value.substring(0,3) + ' ' +
                  champs.value.substring(3,6) + ' ' +
                  champs.value.substring(6,9);
        champs.value = tmp;
        champs.blur();
      }
      else if (champs.value.length==11) {
        champs.blur();
      }
    }
  }
}

