
	function init(id) {
		var articleId = null;
		// get the # part of the URL
		anchor = getAnchor();

		// get the htmlpart argument
		if (anchor){
			if (anchor.lastIndexOf('htmlpart=') >= 0)	
				articleId = anchor.substr(anchor.lastIndexOf('htmlpart=') + 9,anchor.length);
		}
		// if there is none, use the passed value
		if (articleId == null) 
			articleId = id;
		
		// let Google search pass.
		if (document.URL.match('FORID') == null)
			loadArticle(articleId);
	}

	function loadArticle(id) {

		var callback =
		{
		  success: function(o) {
			b.innerHTML = o.responseText;
			
			// RGE: this should be changed! Unfold the first, for instance.
			
			foldArticles();
			var n = document.getElementById('selected_issue');
			var anim = new YAHOO.util.Scroll($('body'),{scroll:{ to: [0,n.offsetTop - 10]}},0.01);
			anim.animate();

		},
		  failure: function(o) {alert('Er is een fout opgetreden.');}
		};

		// clear the content div

		var b = document.getElementById('body');

		while (b.firstChild){	
			b.removeChild(b.firstChild);
		}

		var cObj = YAHOO.util.Connect.asyncRequest('GET', id, callback);
	}
  	
 	var issue = null;
 	
  	function setSize() {
  		// get the height of the container, footer and header instead.
  		var h = getPageHeight() ;
  		var b = $('body');
  		b.style.height = h - 350; 
  		
  	}

	function loadIssue(n){
		loadArticle('issues.php?issue=' + getData(n), n);
	}	


	function loadLetter(n){
		loadArticle('authors.php?firstletter=' + getData(n), n);
	}	

	function loadAuthor(q){
		loadArticle(q);
	}	
  	
  	// RGE: use the set functions also from the loops!!!
  	
	function nextArticle() {
 	 	var issue = getCurrentArticle();
		var anim = new YAHOO.util.Scroll($('body'),{scroll:{ to: [0,n.offsetTop - 20]}},0.01);
		anim.animate();
	}

  	function setIssue(n) {
  		foldIssues();
  		toggleSibling(n);
  		foldArticles();
  	}
  	
  	function setArticle(n) {
  		foldArticles();
  		toggleSibling(n);
		//var anim = new YAHOO.util.Scroll($('body'),{scroll:{ to: [0,n.offsetTop - 20]}},0.01);
		//anim.animate();
	}
	
  	function foldArticles() {
  		var issues = YAHOO.util.Dom.getElementsByClassName('content','div',getCurrentIssue());
		for (var i = 0; i < issues.length; i++) {
			issues[i].style.display = 'none';	
		}  			
  	}	
  	
  	function foldIssues() {
  		var issues = YAHOO.util.Dom.getElementsByClassName('issue','div','verzeichnis');
		for (var i = 0; i < issues.length; i++) {
			issues[i].style.display = 'none';	
		}  			
  	}	

  	function getCurrentIssue() {
		var issues = YAHOO.util.Dom.getElementsByClassName('issue','div','verzeichnis');
		
		for (var i = 0; i < issues.length; i++) {
			if (issues[i].style.display !== 'none') {
				return issues[i];
			} 
		}
		return null;
	}

	// use the setArticle and setIssue functions in the folowing loops:
	  	
  	function nextIssue() {
  		open = null;	
		var issues = YAHOO.util.Dom.getElementsByClassName('issue','div','verzeichnis');
		
		for (var i = 0; i < issues.length; i++) {
			if (issues[i].style.display !== 'none') {
				open = i;
			} 
	
			issues[i].style.display = 'none';	
		}
		 
		if (open !== null && (open + 1 < issues.length)) {
			issues[open + 1].style.display = 'block';
			
		} else {
			issues[0].style.display = 'block';
		}
	}
  	
	 function foldContent() {
	 	
	 	var open = null;
  		var articles = YAHOO.util.Dom.getElementsByClassName('content','div',getCurrentIssue());
  		
		for (var i = 0; i < articles.length; i++) {
			if (articles[i].style.display !== 'none') {
				open = i;
			} 
			articles[i].style.display = 'none';
		}
		
		if (open !== null && (open + 1 < articles.length)) {
			articles[open + 1].style.display = 'block';
		
		} else {
			articles[0].style.display = 'block';
		}
		
  	}
 


function setForm(elm){
	var val = elm.value;
	document.forms.ideal.purchaseID.value = 'donatie#'; 
	document.forms.ideal.itemPrice1.value = val * 100;
	document.forms.ideal.amount.value = val * 100;
}

function checkForm(frm){
 if (frm.cash.value == ""){
  alert("U heeft geen bedrag ingevoerd");
  return false;
 }

 if (frm.itemDescription1.value == ""){
  alert("U heeft geen email adres ingevoerd");
  return false;
 }

}
 
