/**************************************************************
Event attacher
Voorbeeld van gebruik: document.attachEvent("onload", functieNaamHier);
***************************************************************/
document.events = [];
document.attachEvent = function(type, reference) {
    var evt = this.events;
    if(!evt[type]) evt[type] = [];
    evt[type][evt[type].length] = reference;

    document[type] = function(e) { 
        document.executeEvents(type, e);        
    }
}    

document.executeEvents = function(type, e) {
    for(var i in this.events[type]) {
        this.events[type][i](e);
    }    
}

window.onunload = function() { document.executeEvents('onunload'); }
window.onload = function() { document.executeEvents('onload'); }
window.onresize = function() { document.executeEvents('onresize'); }


/**************************************************************
Google Maps
***************************************************************/
function load(adres) {
  if (GBrowserIsCompatible()) {
    var geocoder = new GClientGeocoder();                          
    
    var map = new GMap2(document.getElementById("map"));
  
    geocoder.getLatLng(
        adres,
        function(point) {
          if (point) {
            GEvent.addListener(map, "click", function() {
                myWin = open("","","width=1000,height=600,Directories=no,Location=no,Resizable=yes,scrollbars=auto,menubar=no");
                myWin.location.href="http://maps.google.com?q="+adres+"&z=16&ie=UTF8&iwloc=addr";
            });
            map.setCenter(point, 15);
            marker = new GMarker(point);
            map.addOverlay(marker);
            map.addControl(new GSmallZoomControl());
          }
        }
      );

  }
}

function cMaps(){

    this.setAdres = function(sAdres){
        this.adres = sAdres;
    }
    
    this.display = function(){
        
        load(this.adres);
    
    }
}



/**************************************************************
jQuery
***************************************************************/
$(document).ready(function(){
    Website.init();
});

Website.init = function() {    
    
    this.setExternalLinks();  
     
    this.footerCarrousel();
    
};

// Links met rel="external" moeten in een nieuw venster worden geopend
Website.setExternalLinks = function() {

    $("a[rel=external]").each(function(i){ 
        this.target="_blank"; 
    }); 
    
}

Website.footerCarrousel = function() {
    
    var options = {
        scroll: {
            speed: 1300,
            pauseOnHover: true
        },
        auto: {
            pauseDuration: 5000
        }
    }

    $('#sponsors-carrousel').carouFredSel(options);
}
