function displayExtra(thisField)  {

  var id = thisField.name;
  // so far only how heard and country select options... jsut bundled together for ease
  var reqExtraFields = new Array("Sales Person","Search Engine","Other","GBR","AUT","BEL","BGR","CYP","CZE","DNK","EST","FIN","FRA","DEU","GRC","HUN","IRL","ITA","LVA","LTU","LUX","MLT","NLD","POL","PRT","ROU","SVK","SVN","ESP","SWE");
  var found = false;

  for(k=0; k<reqExtraFields.length; k++) {
    if (thisField.value == reqExtraFields[k]) {
      document.getElementById(id+'2').value = '';
      if (document.getElementById(id+'Text')) 
        document.getElementById(id+'Text').innerHTML = thisField.value;
      document.getElementById(id+'2Row').className = '';
      found = true;
    }
  }
  if (!found) {
    document.getElementById(id+'2Row').className = 'hide';
    document.getElementById(id+'2').value = 'n/a';
  }
  
}

function radioCheck(banner) {
  document.getElementById('bannerSelected').value = banner;
}

function updateBannerHtml() {
  var af_code = document.getElementById('affiliateCode').value;
  var banner = document.getElementById('bannerSelected').value;
  var reg = new RegExp("[0-9]{6}");

  if (!reg.test(af_code)) {
    alert('Your Affiliate Code is not valid');
    return false;
  }
  
  if (banner=='') {
    alert('Please select a banner');
    return false;
  }
  
  var found = 0;
  while (found != -1) {
    found = banner.indexOf("%%affiliate_code%%", found)
    if (found >-1) {
      banner = banner.replace("%%affiliate_code%%", af_code);
      found++;
    }
    found-1;
  }

  document.getElementById('bannerHtml').value = banner.replace(/%%affiliate_code%%/, af_code);
  
}

function display_banner(id) {
  
  var html = document.getElementById(id).value;

  var bannerView = window.open("","banner","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=500px height=70px");

  bannerView.document.open();
  bannerView.document.write(html);
  bannerView.document.close();
  
  return false;

}