
/////////////////////////////////////////////////////////////////////////////
// HELPERS
/////////////////////////////////////////////////////////////////////////////

var ie = document.all? true : false;

function getID(id, doc) {
  return (doc || document).getElementById(id);
};

String.prototype.trim = function() {
  return this.replace(/(^\s*)|(\s*$)/g, "");
};

/////////////////////////////////////////////////////////////////////////////
// LINKS
/////////////////////////////////////////////////////////////////////////////

var web = " V i n s   G r a u ";

function link_refresh(win) {
  var w = win || window;
  for (var x = 0; x < w.document.links.length; x++) {
    w.document.links[x].onmouseover = onmouse_over;
    w.document.links[x].onmouseout = onmouse_out;
  }
  window.defaultStatus = web;

  var m = getID('mapa')
  if (m) m.onclick = function() {
    var x, y;
    var attr="toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,top=0,left=0"
    y= 700;
    x= 815;
    attr= attr + ",width=" + x + ",height=" + y;
    window.open("localizacion_mapa.html", "planol", attr);
    return false
  }
};

function onmouse_over() {
  window.defaultStatus = innerText(this);
  return true;
};

function onmouse_out() {
  window.defaultStatus = web;
  return true;
};

function innerText(tag) {
  var r = '';
  if (ie) r = tag.innerText; // para IE, con this.innerText hay suficiente
  else  {
    if (tag.childNodes.length > 0) {
      for(var x =0; x < tag.childNodes.length; x++) r += tag.childNodes[x].nodeValue || '';
    }
    else r = tag.innerHTML;  // esto es para NS6
  }
  r=r.trim();

  return tag.title || r || web;
};

/////////////////////////////////////////////////////////////////////////////
// EVENTS
/////////////////////////////////////////////////////////////////////////////

if (ie) window.attachEvent('onload',page_onload);
else window.addEventListener("load", page_onload, true);

function page_onload() {
  link_refresh();

  var nb = getID('newsBox')
  if (nb) {
    //var lang = (ie? navigator.userLanguage : navigator.language.substring(0,2)).toUpperCase()
    //if ('EN,FR,DE,CZ,PL,HU,RU,RM'.indexOf(lang) > -1) nb.style.display="none" //nb.href = lang + "/novedades.html"
  }
};
