// browser sniffer
function Browser(){
  this.iE = navigator.appName.toLowerCase().indexOf('microsoft') != -1 ? 1 : 0;
  this.mac =  navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 1 : 0;
  this.win = navigator.userAgent.toLowerCase().indexOf('windows') != -1 ? 1 : 0;
  this.safari =  navigator.userAgent.toLowerCase().indexOf('safari') != -1 ? 1 : 0;
  this.opera =  navigator.userAgent.toLowerCase().indexOf('opera') != -1 ? 1 : 0;    
  this.mozilla = navigator.appName.toLowerCase().indexOf('netscape') != -1 && !this.safari ? 1 : 0;
  this.winMozilla = this.mozilla && this.win ? 1 : 0;
  this.winIE = this.iE && this.win && !this.opera ? 1 : 0;
  this.macIE = this.iE && this.mac ? 1 : 0;
}
var browser = new Browser();

// framebuster
if (window!= top)top.location.href=location.href;

// getElementById
function getEl(el){
  return document.getElementById(el);
};

// addStyle
function addStyle(selector,properties){
  if (document.styleSheets) {
    var s = document.getElementsByTagName('STYLE');
    if (s.length == 0){
      var sheet = document.createElement('style');
      sheet.setAttribute('type','text/css');
      document.getElementsByTagName('HEAD')[0].appendChild(sheet);}
    if (browser.winIE){
      var lastSheet = document.styleSheets[document.styleSheets.length - 1];
      lastSheet.addRule(selector, properties);}
    else {var lastSheet = s[0];
      lastSheet.appendChild(document.createTextNode(selector + ' { ' + properties + ' }'));}
    }
};


// event on part of element
function eventOnPartOfElement(e,element,to){
  var t;
  if (window.event){
    t = to ? window.event.toElement : window.event.srcElement;}
  else if (e){ t = to ? e.relatedTarget : e.target; } 
  else { return false; }
  if (t == null || (!element)){ return false; }
  while ((t.tagName) && t.tagName != 'BODY'){
    if (t == element){ return true; }
    t = t.parentNode; }
  return false;
};


/* set cookie */
function setCookie(cookieName,cookieValue,nDays) {
  var today = new Date();
  var expire = new Date();
  if (nDays==null || nDays==0) nDays=1;
  expire.setTime(today.getTime() + 3600000*24*nDays);
  document.cookie = cookieName+"="+escape(cookieValue)
  + ";expires="+expire.toGMTString()+";path=/";
};

/* get cookie */
function getCookie(c_name){
  if (document.cookie.length>0){
    c_start=document.cookie.indexOf(c_name + "=")
    if (c_start!=-1){ 
      c_start=c_start + c_name.length+1 
      c_end=document.cookie.indexOf(";",c_start)
      if (c_end==-1) c_end=document.cookie.length
        return unescape(document.cookie.substring(c_start,c_end));
      } 
    }
  return null;
};

var animE;
var animB;
//power animator dev 1.1, MDI, dec 2005
animTimer = [];
animate = function (oArg){
  clearTimeout(animTimer[oArg.timerName]);
  var cD,cS,pS,pD
  cD = !oArg.currDist ? 0 : oArg.currDist;
  cS = !oArg.currSpeed ? 0 : oArg.currSpeed;
  cS = !oArg.currSpeed && !oArg.easeIn ? oArg.speed : cS;
  pS = !oArg.peakSpeed ? oArg.speed : oArg.peakSpeed;
  if (oArg.peakDist){
    pD = oArg.peakDist;
  }
  else { 
    pD = oArg.easeIn && oArg.easeOut ? parseInt((oArg.dist)/(oArg.easeIn+oArg.easeOut)*oArg.easeIn) : 0;
  }
  if (cD >= pD && oArg.easeOut){
    cS = parseInt(((oArg.dist-cD)+((oArg.speed-cS)/2))/(oArg.easeOut+0.5)+1);
    if (cS > pS){
      cS = pS;
    }
  }
  else if (oArg.easeIn){
    cS = parseInt((cD+((oArg.speed-cS)/2))/(oArg.easeIn-0.5)+1);
    if (cS > oArg.speed){
      cS = oArg.speed;
    }
  }
  if (cD+cS > oArg.dist){
    cS = oArg.dist-cD;
  }
  cD += cS;
  for (var i in oArg.elements){
    var o = oArg.elements[i];
    var currPosition = o.negMove ? o.startPos-cD : o.startPos+cD;
    getEl(o.id).style[o.style] = currPosition + 'px';
  }
  if (cD < oArg.dist){
    oArg.currDist = cD;
    oArg.currSpeed = cS;
    oArg.peakDist = pD;
    oArg.peakSpeed = pS;
    animTimer[oArg.timerName] = setTimeout(function(){animate(oArg)},25);
    return;
  }
  if (oArg.afterFunc != ''){
    if (!oArg.obj){
      oArg.obj = 'window';
    }    
    animTimer[oArg.timerName] = setTimeout(oArg.obj + '.' + oArg.afterFunc,0);
  }  
};



/* end stream popup with cookie */







//layout case switcher 
var currentLarge = 1;
function checkWindowWidth() {
var smaller = ((document.documentElement.clientWidth > 0 && document.documentElement.clientWidth < 960) || document.body.clientWidth < 960);
if (smaller) {
  if (currentLarge == 0){return;}currentLarge = 0;
  document.getElementById('framework').className = 'small'; }
else {
  if (currentLarge == 1){return;}currentLarge = 1;
  document.getElementById('framework').className = ''; }
};

var maxH = 0;
var cols = [];

function setupColHeights(){
  var list = getEl('framework').getElementsByTagName('div');
  for (var i = 0; i < list.length; i++){
    var cN = list[i].className;
    if (cN != 'col-one' && cN != 'col-two'){
      continue;
    }
    cols[cols.length] = list[i];
    var h = list[i].offsetHeight;
    if (h > maxH){
      maxH = h;
    }
  }
  //ie 6 hack
  var content = getEl('content');
  if (content){
    var contentPar = content.parentNode;
    contentPar.style.position = 'static';
    var cPH = contentPar.offsetHeight;
    if (maxH < cPH){
      maxH = cPH;
    }
    contentPar.style.position = 'absolute';
  }
  //end hack
  setColHeights();
}

var windowH;
function setColHeights(){
  windowH = getWindowHeight();
  var h = windowH < maxH ? maxH : windowH;
  for (var i = 0; i < cols.length; i++){
    cols[i].style.height = h  + 'px';
  }
  getEl('framework').style.height = h  + 'px';
  if (!getEl('chars')){
    return;
  }  
  var list = getEl('chars').getElementsByTagName('div');
  for (var i = 0; i < list.length; i++){
    list[i].style.height = h  + 'px';
  }
  var wid = getWindowWidth();
  if ((wid) < 996) {
    wid = 996;
  }
  getEl('e-right').style.left = '955px';
  getEl('e-right').style.width = (wid - 955) + 'px';
  getEl('b-right').style.left = '955px';
  getEl('b-right').style.width = (wid - 955) + 'px';
  //getEl('e1').style.height = '2000px';
}
  
window.onresize = setColHeights;

function getWindowHeight(){
  if (document.documentElement.clientHeight){
    //alert('1x' + document.documentElement.clientHeight);
    return document.documentElement.clientHeight;
    
  }
  if(document.body.clientHeight){
    //alert('2x' + document.body.clientHeight);
    return document.body.clientHeight;
  }
  return 0;
  
}

function getWindowWidth(){
  if (document.documentElement.clientWidth){
    //alert('1x' + document.documentElement.clientHeight);
    return document.documentElement.clientWidth;
    
  }
  if(document.body.clientWidth){
    //alert('2x' + document.body.clientHeight);
    return document.body.clientWidth;
  }
  return 0;
  
}

// add event
function addEvent(obj, evType, fn, useCapture){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, useCapture);
    return true;
  }
  else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, function() { fn.apply(obj); });
    return r;
  }
  else {
    alert("Handler could not be attached");
    return null;
  }
};


var InternalClock = function(){
  
  this.functions = [];

  this.setup = function(){
    setInterval('iC.cycle()',40);
  }
  
  this.addFunction = function(oArg){
    oArg.currentCycle = 0;
    this.functions[oArg.id] = oArg;
  }
  
  this.removeFunction = function(id){
    delete(this.functions[id]);
  }
  
  this.cycle = function(){
    var obsoleteFunctions = [];
    for (var i in this.functions){
      var f = this.functions[i];
      f.currentCycle++;
      f.finished = f.currentCycle == f.numCycles ? 1 : 0;
      f.execute(f);
      if (f.finished){
        this.removeFunction(f.id);
      }
    }
    //alert('');
  }
  
}

var iC = new InternalClock();

var Panels = function(oArg){
  this.overNum = false;
  this.panelIds = oArg.panelIds;
  this.bgVertPos = oArg.bgVertPos;
  this.bgHorPos = oArg.bgHorPos;
  this.colors = oArg.colors;
  for (var i = 0; i < this.panelIds.length; i++){
    var c = getCookie(this.panelIds[i]);
    if (c){
      addStyle('#'+this.panelIds[i],'width:' + c + 'px;');
    }
    var cC = getCookie(this.panelIds[i] + 'Colored');
   // if (cC == '1'){
      //alert(cC);
      addStyle('#'+this.panelIds[i],'background-color:' + this.colors[i] + ';');
    //}
    
  }
  var c = getCookie('frameMarginLeft');
  if (c){
    addStyle('#framework','margin-left:' + c + 'px;');
  }
  var c = getCookie('frameMarginLeft');

  
  this.firstB = Math.round(Math.random() * 1) == 1 ? 1 : 0;
  this.overNum = false;
  this.activeNum = false;
  if (!Panels.prototype.instances){
    Panels.prototype.instances = [];
  }
  this.instance = Panels.prototype.instances.length;
  Panels.prototype.instances[this.instance] = this;
  
  this.steps = [];
  this.stepTotal = [];
  this.stepTotal['fast'] = 0;
  this.steps['fast'] = Array(4,5,6,8,12,14,12,10,8,6,4,3,2,1);
  var fast = 0;
  for (var i = 0; i < this.steps['fast'].length; i++){
    this.stepTotal['fast'] += this.steps['fast'][i];
  }
  
  this.stepTotal['slow'] = 0;
  this.steps['slow'] = Array(5,5,6,6,6,6,6,6,6,5,5,5,5,5,5,4,4,4,3,2,1,1);
  for (var i = 0; i < this.steps['slow'].length; i++){
    this.stepTotal['slow'] += this.steps['slow'][i];
  }
  //alert(this.stepTotal['slow']);
  
  this.selected = false;
  
  this.stateToCookie = function(){
    var _this = panels;
    for (var i = 0; i < _this.panels.length; i++){
      var p = _this.panels[i];
      setCookie(p.el.id,p.el.offsetWidth,365);
    }
    
    setCookie('frameMarginLeft',getEl('framework').offsetLeft,365);
    if (_this.activePanel){
      if (_this.activePanel.cols[1] && _this.activePanel.cols[1].className.indexOf('colored') != -1){
        //alert('colored');
        setCookie(_this.activePanel.el.id + 'Colored',1,365);
      }
      else {
        //alert('transparent');
        setCookie(_this.activePanel.el.id + 'Colored',0,365);
      }
    }
  };
    
  this.setup = function(){
  //return;
    this.el = getEl('framework');
    var active = false;
    this.moving = false;
    this.bodyCN = document.body.className;
    var list = this.el.childNodes;
    this.panels = [];
    var iterator = 0;
    for (var i = 0; i < list.length; i++){
      if (list[i].nodeType == 1){
        var panel = {el:list[i]};
        var cols = list[i].childNodes;
        panel.cols = [];
        panel.maxWidth = 0;
        for (var j = 0; j < cols.length; j++){
          if (cols[j].nodeType != 1){
            continue;
          }
          if (cols[j].className != 'col-one' && cols[j].className.indexOf('col-two') == -1){
            continue;
          }
          panel.cols[panel.cols.length] = cols[j];
          panel.maxWidth += cols[j].offsetWidth;
        }
        //alert(panel.maxWidth);
        if (list[i].className == 'col over active'){
          panel.alwaysActive = true;
          this.activePanel = panel;
          this.activeNum = iterator;
          panel.originalWidth = 580;
        }
        else {
          panel.originalWidth = 30;
        }
        var buttonChildNodes = list[i].getElementsByTagName('LI')[0].childNodes;
        panel.button = buttonChildNodes[0].nodeType == 1 ? buttonChildNodes[0] : buttonChildNodes[1];
        panel.button.setAttribute('panelsInstance',this.instance);
        
        panel.el.setAttribute('panelsInstance',this.instance);
        addEvent(panel.el,'click',function(){
          Panels.prototype.instances[this.getAttribute('panelsInstance')].active(this);
        });
        addEvent(panel.el,'mouseover',function(){
          Panels.prototype.instances[this.getAttribute('panelsInstance')].over(this);
        });
        addEvent(panel.el,'mouseout',function(){
          Panels.prototype.instances[this.getAttribute('panelsInstance')].out(this);
        });
        
        window.document.body.setAttribute('panelsInstance',this.instance);
        addEvent(window.document.body,'mouseover',function(e){
           Panels.prototype.instances[this.getAttribute('panelsInstance')].bodyOver(e,this);
        });
        
        window.onbeforeunload = panels.stateToCookie;
        this.panels[this.panels.length] = panel;
        iterator++;
      }  
      
      
    }
    //ff hack mac
    var elC = getEl('content')
      if (elC){
        //alert(elC.parentNode.offsetHeight);
        //elC.parentNode.style.height =  maxH + 'px';
      }
    //end ff hack
    
      if (this.activePanel){
        this.firstActive = true;
        this.active(this.activePanel.el);      
      }
      else {
        this.active();
      }
      
      //setInterval('Panels.prototype.instances[' + this.instance + '].setE();',4000);
      if (this.activeNum !== false){
        //alert('');
        //this.setBG(this.activeNum);
      }
  };
  
  this.bodyOver = function(e,el){
  //alert(getEl('content').parentNode.style.backgroundColor);
    if (eventOnPartOfElement(e,getEl('framework'))){
      var elC = getEl('content');
      if (!elC){
        //status = 'framework';
        return false;
      }
      if (!eventOnPartOfElement(e,getEl('content').parentNode.parentNode)){
        //status = 'framework';
        return false;
      }
    }
    //status = 'body';
    if (this.activePanel){
      this.active(this.activePanel.el);
      if (this.activeNum != this.overNum){
        //this.setBG(this.activeNum);
      }
    }
    else {
      this.active(false);
    }
    //getEl('chars').style.display = 'none';
    //document.body.className = this.bodyCN;
  }
  
  this.active = function(el){
    var els = [];
    if (this.moving){
      if ((this.selectedPanel && this.selectedPanel.el == el) || (!this.selectedPanel && !el)){
        return;
      }
    }
    this.moving = true;
    var maxDistance = 0;
    for (var i = 0; i < this.panels.length; i++){
      var panel = this.panels[i];
      panel.startWidth = panel.el.offsetWidth;
      panel.step = 0;
      if (panel.el == el){
        panel.selected = true;
        panel.distance = panel.maxWidth - panel.startWidth;
        panel.negMove = false;
        this.selectedPanel = panel;
        panel.el.className = 'col active over';
      }
      else {
        panel.selected = false;
        panel.el.className = 'col';
        panel.distance = panel.startWidth - panel.originalWidth;
        panel.negMove = true;
      }
      if (panel.distance > maxDistance){
        maxDistance = panel.distance;
      }
    }
    if (!el){
      this.selectedPanel = false;
    }
    this.stepSpeed = maxDistance > 300 ? 'slow' : 'fast'; 
    if (maxDistance || this.firstActive){
      //getEl('chars').style.display = 'none';
      //alert('');
      clearTimeout(animB);
      clearTimeout(animE);
      getEl('chars').style.display = 'none';
      iC.addFunction({id:'Panels' + this.instance,execute:Panels.prototype.instances[this.instance].move,obj:this,numCycles:this.steps[this.stepSpeed].length});
    }
  };

this.move = function(iC){
    var _this = iC.obj;
    var frameWidth = 0;
    for (var i = 0; i < _this.panels.length; i++){
      var panel = _this.panels[i];
      if (!panel.distance){
        panel.newWidth = panel.startWidth;
      }
      else if (panel.alwaysActive && panel.negMove){
        panel.newWidth = panel.startWidth;
      }
      else {
        if (!panel.step){
          panel.step = panel.distance / _this.stepTotal[_this.stepSpeed];
          panel.currentDistance = 0;
        }
        panel.currentDistance += (_this.steps[_this.stepSpeed][iC.currentCycle-1] * panel.step);
        if (panel.negMove){
          panel.newWidth = panel.startWidth - Math.round(panel.currentDistance);
        }
        else{
          panel.newWidth = panel.startWidth + Math.round(panel.currentDistance);
        }
      }
      frameWidth += panel.newWidth;      
    }
    for (var i = 0; i < _this.panels.length; i++){
      var panel = _this.panels[i];
      if (_this.activePanel == panel && !_this.firstActive){
        panel.el.style.width = panel.newWidth + (670 - frameWidth) + 'px';
        //panel.el.style.width = panel.newWidth + 'px';
        //panel.cols[1].style.left =  (170 - (panel.maxWidth - (panel.newWidth + (660 - frameWidth)))) +  'px';
        frameWidth = 670;
      }
      else {
        panel.el.style.width = panel.newWidth + 'px';
      }
    }
 
    if (iC.finished){
      if (_this.firstActive){
        _this.setBG();
      }
      else {
        _this.setBG();
      }
      
      _this.firstActive = false;
      _this.moving = false;
    }
    //status = (_this.stepSpeed);
    //status = window.offsetWidth;//
    getEl('framework').style.width = frameWidth + 'px';
    getEl('framework').style.marginLeft = Math.round(620 - (frameWidth/2)) + 'px';
    //alert(oArg.currentCycle);
  }
  
  
  this.over = function(el){
    var overNum = false;
    for (var i = 0; i < this.panels.length; i++){
      if (this.panels[i].el == el){
        overNum = i;
        break;
      }
    }
    var els = [];
    var maxDistance = 0;
    if (this.selectedPanel && this.selectedPanel.el == el){
      return;
    }
    //alert(overNum);
    el.className = 'col over';
    //this.setBG(overNum);
  };
  
  this.out = function(el){
    var els = [];
    var overNum = false;
    var maxDistance = 0;
    if (this.selectedPanel && this.selectedPanel.el == el){
      return;
    }
    el.className = 'col';
  };
 
  
  
  this.fadeoutBG = function(){
    if (this.iB >= 0 || this.iE >= 0){
      if (this.iB >= 0){
        if (this.forwB){
          this.setOpacity(getEl('b-left'),this.iB*2);
          this.setOpacity(getEl('b-right'),this.iB*2);
        }
        else {
          var opac = 100- ((50 - this.iB) * 3);
          if (opac >= 0){
            this.setOpacity(getEl('b-left'),opac);
            this.setOpacity(getEl('b-right'),opac);
          }
        }
        this.iB--;
      }
      if (this.iE >= 0){
        if (this.forwE){
          this.setOpacity(getEl('e-left'),this.iE*2);
          this.setOpacity(getEl('e-right'),this.iE*2);
        }
        else {
          var opac = 100- ((50 - this.iE) * 3);
          if (opac >= 0){
            this.setOpacity(getEl('e-left'),opac);
            this.setOpacity(getEl('e-right'),opac);
          }
        }
        this.iE--;
      }
      animB = setTimeout('Panels.prototype.instances[' + this.instance + '].fadeoutBG();',80);
    }
    else {
      //alert('');
      this.setOpacity(getEl('e-left'),opac);
      this.setOpacity(getEl('e-right'),opac);
      this.setOpacity(getEl('b-left'),opac);
      this.setOpacity(getEl('b-right'),opac);
      this.setBG();
    }
  }
 
  this.moveB = function(){
    if (this.forwB){
      if (this.iB > 50){
        this.forwB = false;
      }
      else {
        this.iB++;
      }
      
    }
    else {
      if (this.iB == 0){
        this.setOpacity(getEl('b-left'),0);
        this.setOpacity(getEl('b-right'),0);
        animB = setTimeout('Panels.prototype.instances[' + this.instance + '].moveB();Panels.prototype.instances[' + this.instance + '].forwB = 1',1600);
        return;
      }
      this.iB--;
    }
    //status = this.iE;
    if (this.forwB){
      this.setOpacity(getEl('b-left'),this.iB*2);
      this.setOpacity(getEl('b-right'),this.iB*2);
    }
    else {
      var opac = 100- ((50 - this.iB) * 3);
      if (opac >= 0){
        this.setOpacity(getEl('b-left'),opac);
        this.setOpacity(getEl('b-right'),opac);
      }
    }

    animB = setTimeout('Panels.prototype.instances[' + this.instance + '].moveB();',80);
  }
 
 
  this.moveE = function(){
    if (this.forwE){
      if (this.iE > 50){
        this.forwE = false;
      }
      else {
        this.iE++;
      }
      
    }
    else {
      if (this.iE == 0){
        this.setOpacity(getEl('e-left'),0);
        this.setOpacity(getEl('e-right'),0);
        animE = setTimeout('Panels.prototype.instances[' + this.instance + '].moveE();Panels.prototype.instances[' + this.instance + '].forwE = 1',1600);
        return;
      }
      this.iE--;
    }
    //status = this.iE;
    if (this.forwE){
      this.setOpacity(getEl('e-left'),this.iE*2);
      this.setOpacity(getEl('e-right'),this.iE*2);
    }
    else {
      var opac = 100- ((50 - this.iE) * 3);
      if (opac >= 0){
        this.setOpacity(getEl('e-left'),opac);
        this.setOpacity(getEl('e-right'),opac);
      }
    }
    animE = setTimeout('Panels.prototype.instances[' + this.instance + '].moveE();',80);
  }
  
  this.setBG = function(){
  
    if (!getEl('chars')){
      return;
    }
    getEl('chars').style.display = 'block';
    if (this.firstB){
      var animBSpeed = 1000;
      var animESpeed = 7800;
    }
    else {
      var animBSpeed = 7800;
      var animESpeed = 1000;
    }
    this.iB = 0;
    this.iE = 0;
    this.forwB = 1;
    this.forwE = 1;
    this.setOpacity(getEl('e-left'),0);
    this.setOpacity(getEl('e-right'),0);
    this.setOpacity(getEl('b-left'),0);
    this.setOpacity(getEl('b-right'),0);
    //getEl('chars').style.display = 'block';
    animB = setTimeout('Panels.prototype.instances[' + this.instance + '].moveB();',animBSpeed);
    animE = setTimeout('Panels.prototype.instances[' + this.instance + '].moveE();',animESpeed);
  }
  
  this.setOpacity = function(el,opac){
    if (el.filters){
      el.filters.alpha.opacity=opac;
    }
    else {
      el.style.opacity=opac/101;
    }
  };

}

var panels = new Panels({
  panelIds:['who','what','work','contact'],
  bgHorPos:[-20,-200,-250,-60],  
  bgVertPos:[-6,-180,12,-60],
  colors:['#000','#FE0000','#AF8554','#0066CC']
}); 

function setupClickLists(){
  //lists
  var list = document.getElementsByTagName('SPAN');
  for (var i = 0; i < list.length; i++){
    if (list[i].className.indexOf('closed') == -1){
      continue;
    }
    addEvent(list[i],'click',function(){
      var list = this.parentNode.parentNode.childNodes;
      for (var i = 0; i < list.length; i++){
        if (list[i].nodeType != 1){
          continue;
        }
        if (this.parentNode == list[i] && list[i].className != 'active'){
          list[i].className = 'active';
        }
        else {
          list[i].className = ''
        }
      }
    });
  }
}
    
var start = 0;
var busy = false;
function goed(id,ok){
if (busy && (!ok)){
  return;
}
busy = true;
  if (id > 6){
    setTimeout('busy = false',200);
    return;
  }
  document.getElementsByTagName('HTML')[0].style.backgroundPosition = '0 ' + id + 'px';
  //document.body.style.backgroundPosition =  12 * id +'px 0';
  id++;
  start++;
  setTimeout('goed(' + id +',1)',200);
}



/* google maps */
    var map = null;
    var geocoder = null;

    function googleMapsLoad() {
      //return;
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        //map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        geocoder = new GClientGeocoder();
        map.addControl(new GSmallMapControl());
        showAddress("Koningslaan 31, Amsterdam");
      }
    }

    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 13);
              
              var icon = new GIcon();
              icon.image = "_images/gmaps_logo.png";
              icon.shadow = "_images/gmaps_logo_shadow.png";
              icon.iconSize = new GSize(100, 19);
              icon.shadowSize = new GSize(120, 39);
              icon.iconAnchor = new GPoint(12, 18);
              icon.infoWindowAnchor = new GPoint(5, 1);  
                          
              var marker = new GMarker(point,icon);
              map.addOverlay(marker);
              //marker.openInfoWindowHtml(address);
              
            }
          }
        );
      }
    }

    var gWindow = false;
    function gMapsRoute(form,lang){
      langstr = [];
      langstr['nl'] = ['plaats','U moet tenminste een plaatsnaam opgeven','straat + huisnummer','nl'];
      langstr['en'] = ['town/city','Please at least fill in a town/city','street address','nl'];
      var straat = form.straat.value;
      var fromAddress = form.plaats.value;
      if (fromAddress == langstr[lang][0]){
        alert(langstr[lang][1]);
        return false;
      }
      if (straat != '' && straat != langstr[lang][2]){
        fromAddress = straat + ', ' + fromAddress;
      }
      
      if (gWindow){
        gWindow.close();
      }
      gWindow = window.open("http://maps.google." + langstr[lang][3] + "/?ie=UTF8&hl=nl&saddr=" + fromAddress + "&daddr=Koningslaan+31+Amsterdam&f=d", "route_planner", "width=900, height=600, scrollbars=yes, resizable=yes");
    }
    
    
    
    
    
if (document.addEventListener) {
  document.addEventListener("DOMContentLoaded", init, null);
}

// for Internet Explorer (using conditional comments)
/*@cc_on @*/
/*@if (@_win32)document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {    
  if (this.readyState == "complete") {        
    init();  
  }
};
/*@end @*/
window.onload = function(){
  init();
  /*google maps*/
  if (getEl('map')){
    googleMapsLoad();
    window.onunload = GUnload;
  } 
}    
    
//DOM loader
function init() {
  if (arguments.callee.done) return;
  arguments.callee.done = true;
  //status = 'loaded';
  iC.setup();
  setupColHeights();
  panels.setup();
  setupClickLists();
};
    
