﻿function loadSpecific() {
}

function choice() {
  var url = top.location.href.split('/');

  if(url[url.length-1] == 'countryselector-en.html')
  {
    getChoice();
  }
  if(url[url.length-1] == 'countryselector-en.html?newchoice')
  {
    eraseCookie('Flex-i-Trans');
  }  
}

function saveChoice(url)
{
  if(url)
  {
    createCookie('Flex-i-Trans', url, 999);

    top.location.href = url;
  }
}

function getChoice()
{
  url = readCookie('Flex-i-Trans');
  if(url)
  {
    top.location.href = url;
  }
}

function downloadFile(elem) {
  window.open(elem.href);
  return;

  switch (top.location.pathname.split('/')[1]) {
    case 'nl':
      if(confirm('Wilt u op de hoogte blijven van aanbiedingen en acties van Flex-i-Trans?'))
      {
        informationYes(elem.href);
      }
      else
      {
        informationNo(elem.href);
      }
      break;
    case 'en':
      if(confirm('Would you be informed about actions of Flex-i-Trans?'))
      {
        informationYes(elem.href);
      }
      else
      {
        informationNo(elem.href);
      }
      break;
  }
}

function informationYes(file) {
  switch (top.location.pathname.split('/')[1]) {
    case 'nl':
      top.location.href = '/nl/contact/contact.html?file=' + file;
      break;
    case 'en':
      top.location.href = '/en/contact/contact-en.html?file=' + file;
      break;
  }
}

function informationNo(file) {
  window.open(file);
}

function checkDownload() {
  var download = top.location.search.substr(6, top.location.search.lenght);

  if (download != '') {
    window.open(download);
  }
}