<!--

//if (navigator.userAgent.indexOf("Opera") != -1) $('content').style.fontSize = 10;
var IE = /*@cc_on!@*/false;

/**
* Event handling
**/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

/**
* Get element by ID
**/
function $(id) {
	return document.getElementById(id);
}

/**
* Fade
**/
function fade(id, from) {
  if (typeof from == 'undefined') var from = 100;
  if (from != 0) {
    from -= 5;
    setOpacity($('content'), from);
    window.setTimeout("fade('"+id+"', "+from+")", 20);
  }
  else {
    changeContent(id);
    setOpacity($('content'), 100);
    if (IE) $('content').style.removeAttribute('filter');
  }
}

function setOpacity(el, opacity) {
	el.style.opacity = opacity/100;
	el.style.filter = 'alpha(opacity = '+opacity+');';
}

var images = new Array('gfx/pic1.jpg', 'gfx/pic5.jpg', 'gfx/pic8.jpg', 'gfx/pic2.jpg', 'gfx/pic4.jpg', 'gfx/pic9.jpg', 'gfx/pic3.jpg', 'gfx/pic6.jpg', 'gfx/pic10.jpg', 'gfx/pic7.jpg', 'gfx/pic11.jpg');

function fadeImage(el, currentOpacity) {
	currentOpacity += 5;
	if (currentOpacity > 100) {
		setOpacity(el, 100);
		var prevEl = el.previousSibling ? el.previousSibling : el.parentNode.lastChild;
		prevEl.style.visibility = 'hidden';
		el.style.zIndex = 1;
		window.setTimeout(startFading, 5000);
	}
	else {
		setOpacity(el, currentOpacity);
		window.setTimeout(function() {fadeImage(el, currentOpacity);}, 50);
	}
}

var nextImage = 1;

function startFading() {
	var el = $('contentLeft').childNodes[nextImage];
	el.style.visibility = 'visible';
	el.style.zIndex = 2;
	setOpacity(el, 0);
	fadeImage(el, 0);
	nextImage = (nextImage < images.length-1) ? nextImage + 1 : 0;
}

function pageLoad() {
	var el = $('contentLeft');
	while (el.firstChild) el.removeChild(el.firstChild);
	
	for (var i=0; i<images.length; i++) {
		var t = document.createElement('img');
		t.setAttribute('src', images[i]);
		el.appendChild(t);
	}
	el.firstChild.style.visibility = 'visible';
	window.setTimeout(startFading, 5000);
	
  if (location.href.match("gclid=") != null) changeContent('google');
}

menuItems = ['home', 'what', 'why', 'who', 'references', 'contact'];

function selectMenu(content) {
  for (var i=0; i<menuItems.length; i++) {
    $(menuItems[i]+'Link').className = '';
  }
  $(content).className = 'current';
}

function changeContent(content) {
  if ($(content+'Link') || content == 'google') {
    location.hash = content;
    $('content').innerHTML = $(content+'Content').innerHTML;
    content = content == 'google' ? 'home' : content;
    selectMenu(content+'Link');
    if (content == 'home') document.title = 'Mobil cocktail-service og de dygtigste bartendere FLOÖID';
    else if (content == 'what') document.title = 'Hemingway og andre klassiske cocktail-helte hos FLOÖID';
    else if (content == 'why') document.title = 'FLOÖID er erfarne bartendere og cocktail-entusiaster';
    else if (content == 'who') document.title = 'Vores cocktail-service gør forskellen – FLOÖID mod rov';
    else if (content == 'references') document.title = 'Referencer';
    else if (content == 'contact') document.title = 'Lad os ringe dig op med et uimodståeligt og uforpligtende tilbud';
  }
}

var lastHash = '';

function checkHash() {
  if (lastHash !== location.hash) {
    lastHash = location.hash;
    changeContent(lastHash.substring(1));
  }
}
setInterval(checkHash, 200);

addLoadEvent(pageLoad);

-->