function swapImgRestore() {
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() {
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage() {
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function preloadImg() {
}

function ow(filename,windowname,width,height,resizable) {
  var options = "width="+width+",height="+height+",location=no,menubar=no,resizable='+resizeable+',scrollbars='+resizeable+',status=no,toolbar=no";
  win = window.open(filename,windowname,options);
  win.focus();
}

function checkContactForm(lang) {
  errorlist_de = new Array();
  errorlist_en = new Array();
  errorlist_fr = new Array();
  errorlist_it = new Array();
  error = false;
  if(!document.contact.firstname.value) { error = true; errorlist_de.push('Vorname'); errorlist_en.push('Firstname'); errorlist_fr.push('prénom'); errorlist_it.push('nome'); }
  if(!document.contact.lastname.value) { error = true; errorlist_de.push('Nachname'); errorlist_en.push('Lastname'); errorlist_fr.push('nom'); errorlist_it.push('cognome'); }
  if(!document.contact.street.value) { error = true; errorlist_de.push('Straße'); errorlist_en.push('Street'); errorlist_fr.push('rue'); errorlist_it.push('strada'); }
  if(!document.contact.zip.value) { error = true; errorlist_de.push('PLZ'); errorlist_en.push('Zip'); errorlist_fr.push('postal code'); errorlist_it.push('codice postale'); }
  if(!document.contact.city.value) { error = true; errorlist_de.push('Ort'); errorlist_en.push('City'); errorlist_fr.push('ville'); errorlist_it.push('cittá'); }
  if(!document.contact.country.value) { error = true; errorlist_de.push('Land'); errorlist_en.push('Country'); errorlist_fr.push('pays'); errorlist_it.push('nazione'); }
  if(!document.contact.arrival.value) { error = true; errorlist_de.push('Anreisedatum'); errorlist_en.push('Arrival'); errorlist_fr.push('arrivée'); errorlist_it.push('arrivo'); }
  if(!document.contact.departure.value) { error = true; errorlist_de.push('Abreisedatum'); errorlist_en.push('Departure'); errorlist_fr.push('depart'); errorlist_it.push('partenza'); }
  if(error) {
    if(lang=='de') {
      message = "Bitte füllen Sie folgende Felder korrekt aus:\n\n";
      for(counter=0;counter<errorlist_de.length;counter++) {
        message = message + errorlist_de[counter] + '\n';
      }
    }
    if(lang=='en') {
      message = "Please fill out the following fields:\n\n";
      for(counter=0;counter<errorlist_en.length;counter++) {
        message = message + errorlist_en[counter] + '\n';
      }
    }
    if(lang=='fr') {
      message = "Remplissez les lacunes s´il vous plaît:\n\n";
      for(counter=0;counter<errorlist_fr.length;counter++) {
        message = message + errorlist_fr[counter] + '\n';
      }
    }
    if(lang=='it') {
      message = "Compilate il modulo per favore:\n\n";
      for(counter=0;counter<errorlist_it.length;counter++) {
        message = message + errorlist_it[counter] + '\n';
      }
    }
    alert(message);
    return false;
  } else {
    return true;
  }
}
