function ge(id) {
	return document.getElementById(id);
}

function laadNavigatie() {
	
	if(ge('fotos')) {
		
		var fotos  = ge('fotos').getElementsByTagName('img');

		if(fotos.length>0) {
			for(var n=0; n<fotos.length; n++) {
				fotos[n].onmouseover = function() {
					this.style.border = '1px solid #FF9900';
				}
				fotos[n].onmouseout = function() {
					this.style.border = '1px solid #BDC63D';
				}
			}
		}
		
	}
	
	if(ge('scroller')) {
		
		var fotos  = ge('scroller').getElementsByTagName('div');

		if(fotos.length>0) {
			for(var n=0; n<fotos.length; n++) {
				fotos[n].onmouseover = function() {
					this.style.border = '1px solid #FF9900';
				}
				fotos[n].onmouseout = function() {
					this.style.border = '1px solid #BDC63D';
				}
			}
		}
		
	}
	
	if(ge('taal')) {
		ge('taal').onmouseover = function() {
			this.src = this.src.replace(/.gif/,"2.gif");
		}
	
		ge('taal').onmouseout = function() {
			this.src = this.src.replace(/2.gif/,".gif");
		}
	}
	
	if(ge('up') && ge('down')) {
		ge('up').onmouseover = function() {
			this.src = this.src.replace(/.gif/,"2.gif");
		}
		ge('down').onmouseover = function() {
			this.src = this.src.replace(/.gif/,"2.gif");
		}
		ge('up').onmouseout = function() {
			this.src = this.src.replace(/2.gif/,".gif");
		}
		ge('down').onmouseout = function() {
			this.src = this.src.replace(/2.gif/,".gif");
		}		
	}
	
	if(ge('buttonprevious')) {
		ge('buttonprevious').onmouseover = function() {
			this.src = this.src.replace(/.gif/,"2.gif");
		}
		ge('buttonprevious').onmouseout = function() {
			this.src = this.src.replace(/2.gif/,".gif");
		}
	}
	
	if(ge('buttonnext')) {
		ge('buttonnext').onmouseover = function() {
			this.src = this.src.replace(/.gif/,"2.gif");
		}
		ge('buttonnext').onmouseout = function() {
			this.src = this.src.replace(/2.gif/,".gif");
		}
	}	
	
}

function laadFotoUpdate() {
	
	if(ge('fotoklein')) {
		
		var afbeeldingen = ge('fotoklein').getElementsByTagName('img');
		
		if(afbeeldingen.length > 0) {
			
			for(var n=0; n<afbeeldingen.length; n++) {

				afbeeldingen[n].onmouseover = function() {
					this.style.cursor = 'pointer';
					this.style.border = '1px solid #FF9900';

				}
				
				afbeeldingen[n].onmouseout = function() {
					this.style.cursor = 'default';
					this.style.border = '1px solid #BDC63D';
				}
				
				afbeeldingen[n].onclick = function() {
					laadGroteFoto(this.src);
				}
				
			}
		}
		
	}
	
}

function laadFotoAlbums() {

	var paginas = $$('div.album');	
	var aantalPaginas = paginas.length;	
	var hoogte = 170;	
	var totaleHoogte = hoogte * aantalPaginas;
	
	if(document.getElementById('scroller')) {
		document.getElementById('scroller').style.height = totaleHoogte + 'px';
		document.getElementById('scroller').focus();
	
		toChapter(0, root);
	}
}

function toChapter(pagina, webroot) {
	
	if(pagina=='next') {
		var nieuw = Math.round(document.getElementById('geselecteerd').value)+1;		
	} else if(pagina=='previous') {
		var nieuw = Math.round(document.getElementById('geselecteerd').value)-1;	
	} else {
		var nieuw = Math.round(pagina);
	}
	
	document.getElementById('geselecteerd').value = nieuw;
		
	var scroll = new Fx.Scroll('albums', {
		wait: false,
		duration: 1400,
		transition: Fx.Transitions.Expo.easeInOut
	});
	
	ge('up').onclick = function() { toChapter('previous', webroot) };
	ge('down').onclick = function() { toChapter('next', webroot) };
	
	var maxitems = ge('scroller').getElementsByTagName('div').length;
		
	if(maxitems < 3) {
		ge('up').onclick = '';
		ge('down').onclick = '';
	} else {
		if(nieuw==0) {
			ge('up').onclick = '';
		}
		if((nieuw+2) >= maxitems) {
			ge('down').onclick = '';
		}
	}
	
	scroll.toElement('album'+nieuw);
}	

function laadGroteFoto(bron) {
	
	var jSonRequest = new Json.Remote(root+'ajaxserver',{onComplete: function(resultaat){		
		if(resultaat.gelukt) {
			ge('fotogroot').src = resultaat.bron;
		}		
	}}).send({'actie': 'haalGroteFoto', 'bron' : bron});
		
}

function hoverKnop(id) {
	ge(id).className = 'buttongroen2';
}

function unhoverKnop(id) {
	ge(id).className = 'buttongroen';
}

// Start Specifiek voor inschrijfpagina
function haalPrijs() {
	var spelers     = document.getElementById('deelnemers_spelende_leden').value;
	var begeleiding = document.getElementById('deelnemers_begeleiding').value;
	
	// bereken prijs
	var prijs = (spelers*55)+(begeleiding*50);
	
	document.getElementById('kosten').innerHTML = '&euro;'+prijs+',-';
}

function controleerShirts() {
	var spelers     = document.getElementById('deelnemers_spelende_leden').value;
	var begeleiding = document.getElementById('deelnemers_begeleiding').value;
	
	var shirtsS			= document.getElementById('t-shirts_s').value;
	var shirtsM			= document.getElementById('t-shirts_m').value;
	var shirtsL			= document.getElementById('t-shirts_l').value;
	var shirtsXL		= document.getElementById('t-shirts_xl').value;
	var shirtsXXL		= document.getElementById('t-shirts_xxl').value;
	
	var totaalSpelers = parseInt(spelers) + parseInt(begeleiding);
	var totaalShirts	= parseInt(shirtsS) + parseInt(shirtsM) + parseInt(shirtsL) + 
											parseInt(shirtsXL) + parseInt(shirtsXXL);
	
	var html;
	if (totaalSpelers == totaalShirts)
	{
		html = 'true';
	}
	else
	{
		html = 0;
	}
	
	document.getElementById('shirtsTotal').value = html;
}
// Einde Specifiek voor inschrijfpagina

function gaNaarVanuitSmoothbox(link) {
	window.parent.location = link;
}

function inserticon(from,to) {  
  document.getElementById(to).value += from;   
  document.getElementById(to).focus();  
}

function naarRonde(weblink, waarde) {
	
	window.location = weblink+waarde;
		
	
}