

//class="exit" onclick="window.open(this.href);return false;"
function checkLinks() {
	var alinks,i;
	alinks = document.getElementsByTagName('a');
	for (i=0;i<alinks.length;i++) {
		islink = alinks[i].href;
		if (islink && islink.indexOf(window.location.hostname) == -1 && islink.indexOf('javascript:') == -1) {
				if (alinks[i].childNodes[0].nodeName != 'IMG') { //alinks[i].className='exit';
				}
				alinks[i].onclick=function() { return openlink(this); };
				
				/*if (!alinks[i].title) 
					alinks[i].title = 'open ' + alinks[i].href + ' in een nieuw venster';*/
		}
	}
}
function openlink(o) {
	var o;
	window.open(o.href);return false;
	
}
function checkAjaxLinks() {

	var anchors = document.getElementsByTagName('a');

		// loop through all anchor tags
		for (var i=0; i<anchors.length; i++){
			anchor = anchors[i];
			
			var relAttribute = String(anchor.getAttribute('rel'));
			
			// use the string.match() method to catch 'lightbox' references in the rel attribute
			if (anchor.getAttribute('href') && ((relAttribute.toLowerCase().match('event')) || (relAttribute.toLowerCase().match('kaart')) || (relAttribute.toLowerCase().match('gerecht')))) {
				this.rel = relAttribute;
				anchor.onclick = function() {
					makeLink(this,this.rel);
					return false;
				 }
			}
		}	
}
function makeLink(alink,rel) {
	alink = String(alink);

	id = (alink.substr(alink.indexOf('=')+1));
	if (rel == 'event') {
		do_getEventDetail(id);
	} else if (rel == 'gerecht') {
		do_getKaartDetail(id, 'gerechten');
	} else if (rel == 'kaart') {
		do_getKaartDetail(id, 'kaarten');	
	} else
		do_getEvents(id);
}

function initLists() {
    var myStretcher = new Array();

	// Pick your classes
		var myStretch = document.getElementsByClassName('stretch');
		var myStretcher = document.getElementsByClassName('stretcher');

	// Create the accordian
		var myAccordion = new fx.Accordion(myStretch, myStretcher, {opacity: true,duration: 300});
	// Select your default opened section
		for(i=0; i<myStretcher.length;i++) {
			
			if (myStretcher[i].getAttribute('rel') == 'open')
				myAccordion.showThisHideOpen(myStretcher[i]);
		}
	
}


window.onload = function () {
	// list effects
	
	//initSubNav();
	checkLinks();
	checkAjaxLinks();
	
	
	
}
