function get_tva_value(type, pays){
  var result = 0;
  new Ajax.Request('/get_tva/'+type+'/'+pays+'/', {
    asynchronous: false,
    method: 'get',
    onSuccess: function(response) {
    result = response.responseText;
  }
  });
  if (!result) result = 0;
  return parseFloat(result);
}

function BwindowWidth() {
  // if(self.innerWidth) {
  //   return self.innerWidth;
  // } else {
    return self.document.body.clientWidth;
  // }
}

function display(id) {
  if(document.getElementById("longdescr" + id).style.display == 'none') {
    document.getElementById("longdescr" + id).style.display = '';
    if(document.getElementById("shortdescr" + id))
      document.getElementById("shortdescr" + id).style.display = 'none';
  } else {
    document.getElementById("longdescr" + id).style.display = 'none';
    if(document.getElementById("shortdescr" + id))
      document.getElementById("shortdescr" + id).style.display = '';
  }
}

function mypopup(url, title) {
  window.open(url, title, 'resizable=no,location=no,width=780,height=550,menubar=no,status=no,scrollbars=yes,menubar=no');
}

function mypopup2(url, title, h, w) {
  window.open(url, title, 'resizable=no,location=no,width=' + w + ',height=' + h + ',menubar=no,status=no,scrollbars=yes,menubar=no');
}

Event.observe(window, 'load', function() {
  list = $$('.popupCloser');
  for (i = 0; i < list.length; i++) {
    Event.observe(list[i], 'click', function(event) {
      window.close();
      Event.stop(event);
    }, false);
  }

  $$('.wobook_preview').each(function(el) {
   Event.observe(el, 'click', function(event) {
    var el = Event.element(event);
    Event.stop(event);
    if (el.nodeName != 'A') {
      el = el.up('a');
    }
    var url = el.readAttribute('href');
    var re = new RegExp("^(http://www.wobook.com)/([^/]*)/(.*)$", "g");
    url = url.replace(re, "$1/$2-1-f/$3");
    window.open(url, '', 'fullscreen=yes, scrollbars=auto');
   })
  });
}, false);

