var pong;
function makeArray(n){
  this.length = n;
  for (i=1;i<=n;i++){
    this[i]=0;
  }
  return this;
}

// standard date display function with y2k compatibility
function displayDate() {
  var this_month = new makeArray(12);
  this_month[0]  = "Janvier";
  this_month[1]  = "Février";
  this_month[2]  = "Mars";
  this_month[3]  = "Avril";
  this_month[4]  = "Mai";
  this_month[5]  = "Juin";
  this_month[6]  = "Juillet";
  this_month[7]  = "Août";
  this_month[8]  = "Septembre";
  this_month[9]  = "Octobre";
  this_month[10] = "Novembre";
  this_month[11] = "Décembre";

  var this_day_e = new makeArray(7);
  this_day_e[0]  = "Dimanche";
  this_day_e[1]  = "Lundi";
  this_day_e[2]  = "Mardi";
  this_day_e[3]  = "Mercredi";
  this_day_e[4]  = "Jeudi";
  this_day_e[5]  = "Vendredi";
  this_day_e[6]  = "Samedi";

  var today = new Date();
  var day   = today.getDate();
  var month = today.getMonth();
  var year  = today.getYear();
  var dia = today.getDay();
    if (year < 1000) {
       year += 1900; }
  return( " " + this_day_e[dia] + ", " + day + " " + this_month[month] + " " + year);
}



// JavaScript Document
//Funciones usadas en el formulario
function esInteger(e) {
var charCode
if (navigator.appName == "Netscape") // Veo si es Netscape o Explorer (mas adelante lo explicamos)
charCode = e.which // leo la tecla que ingreso
else
charCode = e.keyCode // leo la tecla que ingreso
status = charCode 
if (charCode > 31 && (charCode < 48 || charCode > 57)) { // Chequeamos que sea un numero comparandolo con los valores ASCII
alert("Ce champ ne permet que l’introduction de chiffres");
return false;
}
return true;
}


//para controlar tamaño del texto del campo de texto

function textolargo(texto,actual,maxim) {
if (texto.value.length>maxim){
 event.keyCode=0;
 texto.value=texto.value.substring(0,maxim);
 alert("Vous avez déjà introduit  "+maxim+" caractères");
 return false;
}
 return true;
}


//apartado Recomendar
function comprobar() {
vacio = "";
if (document.form.tunombre.value == "") {
vacio += "\n     -  Il manque votre nom";
}
if (document.form.nombredestinatario.value == "") {
vacio += "\n     -  Il manque le nom du destinataire";
}
if (document.form.tuemail.value == "") {
//vacio += "\n     -  Falta tu dirección de correo"; no hacemos nada
}
else if ((document.form.tuemail.value.indexOf('@') == -1) || 
(document.form.tuemail.value.indexOf('.') == -1)) {
vacio += "\n     -  Adresse de messagerie incorrecte";
}
if (document.form.emaildestinatario.value == "") {
vacio += "\n     -  Il manque l’adresse e-mail du destinataire";
}
else if ((document.form.emaildestinatario.value.indexOf('@') == -1) || 
(document.form.emaildestinatario.value.indexOf('.') == -1)) {
vacio += "\n     -  L’adresse e-mail du destinataire est incorrecte";
}
if (vacio != "") {
vacio ="_____________________________________________\n" +
"Certaines informations sont incorrectes ou incomplètes:\n" +
vacio + "\n_____________________________________________" +
"\nVeuillez corriger ou compléter les informations indiquées";
alert(vacio);
return false;
}
else {
return true;//document.forms[0].submit();//form.submit();
}
}

//Formulario envio solo telefono
function checkFieldstelefono() {
vacio = "";
if (document.form2.nombre2.value == "") {
vacio += "\n     -  Vous devez indiquer le nom d’une personne de contact";
}
if (document.form2.telefonofijo.value == "") {
vacio += "\n     -  Vous devez introduire un numéro de téléphone";
}
if (vacio != "") {
vacio ="_____________________________________________\n" +
"Certaines informations sont incorrectes ou incomplètes:\n" +
vacio + "\n_____________________________________________" +
"\nVeuillez corriger ou compléter les informations indiquées";
alert(vacio);
return false;
}
else {
return true;//document.forms[0].submit();//form.submit();
}
}

//Formularios
function checkFields() {
vacio = "";
if (document.form.nombre.value == "") {
vacio += "\n     -  Vous devez indiquer le nom d’une personne de contact";
}
if (document.form.email.value == "" && document.form.telefono.value == "" && document.form.otrotelefono.value == "") {
vacio += "\n     -  Indiquez-nous votre e-mail ou un numéro de téléphone de contact";
}
if (document.form.telefono.value == "") {
//vacio += "\n     -  Escriba un teléfono de contacto";
}
if (document.form.email.value == ""){
//de momento no hacemos nada
}
else if ((document.form.email.value.indexOf('@') == -1) || 
(document.form.email.value.indexOf('.') == -1)) {
vacio += "\n     -  Adresse de messagerie incorrecte";
}
if(document.form.consulta.value == "") {
vacio += "\n     -  Vous devez préciser l’information que vous souhaitez obtenir (commentaires)";
}
if (vacio != "") {
vacio ="_____________________________________________\n" +
"Certaines informations sont incorrectes ou incomplètes:\n" +
vacio + "\n_____________________________________________" +
"\nVeuillez corriger ou compléter les informations indiquées";
alert(vacio);
return false;
}

else {
if(document.form.empresa.value == "") {
document.form.empresa.value = "Non spécifié";
}
if(document.form.email.value == "") {
document.form.email.value = "No@indicado.com";
}
if(document.form.telefono.value == "") {
document.form.telefono.value = "Non spécifié";
}
if(document.form.otrotelefono.value == "") {
document.form.otrotelefono.value = "Non spécifié";
}
if(document.form.website.value == "") {
document.form.website.value = "Non spécifié";
}
//if(document.form.tipo.value == "") {
//document.form.tipo.value = "No indicado";
//}
if(document.forms.length > 9){
if(document.form.palabras.value == "") {
document.form.palabras.value = "Non spécifié";
}
if(document.form.plazo.value == "") {
document.form.plazo.value = "Non spécifié";
}
if (document.form.idiomas.value == ""){
document.form.idiomas.value = "Non spécifié";
}
}
return true;//document.forms[0].submit();//form.submit();
}
}

