﻿// JScript File

  function getSearch(site)
  {
  alert(site);
  if (site=='distributornet')
    window.location="/distributornet/Default.aspx?action=search";
  
  else if (site=='distributor')
    window.location="/distributor/Default.aspx?action=search";
  else
    window.location="/Default.aspx?action=search";
  
  
  }


  function ImageBank() { 
    window.open(document.getElementById('hylImageBank').value);
  }
  
  function getSiteMap(site)
  {
  alert(site);
  if (site=='distributornet')
    window.location="/distributornet/Default.aspx?action=sitemap";  
  else if (site=='distributor')
    window.location="/distributor/Default.aspx?action=sitemap";
  else
    window.location="/Default.aspx?action=sitemap";

}

function validateForm(form, lng) {
    returnValue = true;
    returnMessage = '';
    if (form.navn.value.length == 0) {
        returnValue = false;
        returnMessage += '\n- Navn';
    }
    if (form.firma.value.length == 0) {
        returnValue = false;
        returnMessage += '\n- Firma';
    }
    if (form.tlf.value.length == 0) {
        returnValue = false;
        returnMessage += '\n- Tlf.';
    }
    if (form.email.value.length == 0) {
        returnValue = false;
        returnMessage += '\n- E-mail';
    }
    if (form.adresse.value.length == 0) {
        returnValue = false;
        returnMessage += '\n- Adresse';
    }
    if (form.postnr.value.length == 0) {
        returnValue = false;
        returnMessage += '\n- Postnr.';
    }
    if (form.by.value.length == 0) {
        returnValue = false;
        returnMessage += '\n- By';
    }
    if (form.land.value.length == 0) {
        returnValue = false;
        returnMessage += '\n- Land';
    }
    checked = false;
    catalog = "";
    for (i = 0; i < form.produkt.length; i++) {
        if (form.produkt[i].checked) {

            checked = true;
            catalog = form.produkt[i].value;
        }
    }

    noProductMessage = '\n\nVælg venligst mindst én brochure fra listen til venstre.';
    if (!checked) {
        returnValue = false;

        returnMessage += noProductMessage;
    }
    if (!returnValue && returnValue != noProductMessage) {
        alert('Følgende felter mangler at blive udfyldt:' + returnMessage);
    }

    return returnValue;
}


function checkboxControl(checkbox) {
    //alert(checkbox);
    form = document.forms[0];
    if (checkbox.value == 'deko-katalog' && checkbox.checked) {
        for (i = 0; i < 11; i++) {
            form.produkt[i].checked = false;
        }
    } else {
        form.produkt[11].checked = false;
    }
}

