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]  = "Januar";
  this_month[1]  = "Februar";
  this_month[2]  = "März";
  this_month[3]  = "April";
  this_month[4]  = "Mai";
  this_month[5]  = "Juni";
  this_month[6]  = "Juli";
  this_month[7]  = "August";
  this_month[8]  = "September";
  this_month[9]  = "Oktober";
  this_month[10] = "November";
  this_month[11] = "Dezember";

  var this_day_e = new makeArray(7);
  this_day_e[0]  = "Soontag";
  this_day_e[1]  = "Montag";
  this_day_e[2]  = "Dienstag";
  this_day_e[3]  = "Mittwoch";
  this_day_e[4]  = "Donnerstag";
  this_day_e[5]  = "Freitag";
  this_day_e[6]  = "Samstag";

  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] + ", " + this_month[month] + " " + day + ", " + 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("Dieses Feld erlaubt nur Zahlen");
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("Sie haben "+maxim+" Zeichen geschrieben"); 
 return false;
}
 return true;
}


//apartado Recomendar
function comprobar() {
vacio = "";
if (document.form.tunombre.value == "") {
vacio += "\n     -  Es fehlt Ihr Name";
}
if (document.form.nombredestinatario.value == "") {
vacio += "\n     -  Es fehlt der Name des Empfängers";
}
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     -  Es fehlt Ihre E-Mail-Adresse";
}
if (document.form.emaildestinatario.value == "") {
vacio += "\n     -  Es fehlt die E-Mail-Adresse des Empfängers";
}
else if ((document.form.emaildestinatario.value.indexOf('@') == -1) || 
(document.form.emaildestinatario.value.indexOf('.') == -1)) {
vacio += "\n     -  Die E-Mail-Adresse des Empfängers ist nicht korrekt";
}
if (vacio != "") {
vacio ="_____________________________________________\n" +
"Einige Daten sind nicht korrekt oder unvollständig:\n" +
vacio + "\n_____________________________________________" +
"\nBitte ändern oder vervollständigen Sie die angegebenen Daten";
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     -  Bitte den Namen eines Ansprechpartners eingeben";
}
if (document.form2.telefonofijo.value == "") {
vacio += "\n     -  Sie müssen eine Telefonnummer eingeben";
}
if (vacio != "") {
vacio ="_____________________________________________\n" +
"Einige Daten sind nicht korrekt oder unvollständig:\n" +
vacio + "\n_____________________________________________" +
"\nBitte ändern oder vervollständigen Sie die angegebenen Daten";
alert(vacio);
return false;
}
else {
return true;//document.forms[0].submit();//form.submit();
}
}

//Formularios
function checkFields() {
vacio = "";
if (document.form.nombre.value == "") {
vacio += "\n     -  Bitte den Namen eines Ansprechpartners eingeben";
}
if (document.form.email.value == "" && document.form.telefono.value == "" && document.form.otrotelefono.value == "") {
vacio += "\n     -  Schreiben Sie bitte Ihre E-Mail-Adresse oder eine Telefonnummer";
}
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     -  Die angegebene E-Mail-Adresse ist nicht korrekt";
}
if(document.form.consulta.value == "") {
vacio += "\n     -  Bitte geben Sie die gewünschte Information an (Bemerkungen)";
}
if (vacio != "") {
vacio ="_____________________________________________\n" +
"Einige Daten sind nicht korrekt oder unvollständig:\n" +
vacio + "\n_____________________________________________" +
"\nBitte ändern oder vervollständigen Sie die angegebenen Daten";
alert(vacio);
return false;
}

else {
if(document.form.empresa.value == "") {
document.form.empresa.value = "Nicht angegeben";
}
if(document.form.email.value == "") {
document.form.email.value = "No@indicado.com";
}
if(document.form.telefono.value == "") {
document.form.telefono.value = "Nicht angegeben";
}
if(document.form.otrotelefono.value == "") {
document.form.otrotelefono.value = "Nicht angegeben";
}
if(document.form.website.value == "") {
document.form.website.value = "Nicht angegeben";
}
//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 = "Nicht angegeben";
}
if(document.form.plazo.value == "") {
document.form.plazo.value = "Nicht angegeben";
}
if (document.form.idiomas.value == ""){
document.form.idiomas.value = "Nicht angegeben";
}
}
return true;//document.forms[0].submit();//form.submit();
}
}

