function toggle(show) {
  var galerie = document.getElementById('galerie-foto');
  var mijloc = document.getElementById('mijloc');
  var jos = document.getElementById('jos');

  if (show){
    mijloc.style.display = "none";
    galerie.style.display = "block";
    
    // lame mozilla fix
    // cititorule, daca ai o solutie mai interesanta, da-mi si mie un mail la tudor.b@web-spot.ro

    jos.style.display = "none";
    jos.style.display = "block";
  }
  else {
    mijloc.style.display = "block";
    galerie.style.display = "none";

    // idem...

    jos.style.display = "none";
    jos.style.display = "block";

  }
}

var pic;
var repeatInterval;

function show() {
  var poza = document.getElementById('imagine-mare');
  if (pic.complete) {
    poza.style.display = "block";
    var mesaj = document.getElementById('mesaj-asteptare');
    mesaj.style.display = "none";
    poza.src = pic.src;
    clearInterval(repeatInterval);
  }
}

function openImage(img) {
  if (!img)
    return null;

  var mesaj = document.getElementById('mesaj-asteptare');
  mesaj.style.display = "block";
  var poza = document.getElementById('imagine-mare');
  poza.style.display = "none";

  if (pic)
    pic = null;

  pic = new Image();
  pic.src = img;

  repeatInterval = setInterval("show()", 500);
}

function setBackground() {
  var x = document.getElementById('afterbusiness');
  if (!x)
    return null;
  var windowWidth = getHeight();
  if (windowWidth < 928)
    x.style.background = "transparent";
  else
    x.style.background = "transparent url('/img/site/logo.jpg') right center fixed no-repeat";
}

function getHeight() {
  if (document.body) {
    return document.body.clientWidth;
  }
  if (document.documentElement) {
    return document.documentElement.offsetWidth;
  }
  if (typeof(window.innerWidth) == "number") {
    return window.innerWidth;
  }
}


function init() {
  window.onLoad = setBackground();
  window.onresize = setBackground;
  
}

function noSpam(user, domain)
{
    document.location = 'mailto:' + user + '@' + domain;
}


