function ShowHide( type ){
	var Element = document.getElementById( "FotoHolder" );
	if( Element ) {
		Element.className = type;
	}
}

var previousCell = null;
var previousAnchor = null;

function OpenClose(anchor, id) {
	
	var ContentObject = document.getElementById( 'Content' );
	var cell = document.getElementById( "item" + id );
	
	if ( previousCell ) {		
		var Height = parseInt( ContentObject.style.height.split("px").join("") );
		
		var CellHoeveelheid = Math.ceil( previousCell.offsetHeight / 20 );
		var CellHeight = ( CellHoeveelheid * 20 );
		
		var NewHeight = Height - CellHeight; 		
		ContentObject.style.height = NewHeight + 'px';
	}
	
	if ( cell != null ){
		
		if ( anchor.className == "Open"  ) {
			anchor.className = "Close";
			cell.style.display = "none";
		} else {
			anchor.className = "Open";
			cell.style.display = "block";
		}
		
		if ( anchor ){
			var Height = parseInt( ContentObject.style.height.split("px").join("") );

			var CellHoeveelheid = Math.ceil( cell.offsetHeight / 20 );
			var CellHeight = ( CellHoeveelheid * 20 );
			
			var NewHeight = Height + CellHeight;
			ContentObject.style.height = NewHeight + 'px';
		}

		if( previousCell != null && previousCell != cell ) previousCell.style.display = "none";
		if( previousAnchor != null && previousAnchor != anchor ) previousAnchor.className = "Close";

		previousCell = cell;
		previousAnchor = anchor;
	}
}

function showType() {
	ToggleInfo( OpenIndex );
	OpenIndex = null;	
	
	var Map = document.getElementById( 'KaartHolder' )
	for( var i = 0; i < document.Legenda.itemtype.length; i++ ) {
		
		if( ( document.Legenda.itemtype[ i ].checked ) && ( Map ) ) {
		    var type = document.Legenda.itemtype[ i ].value;
		    Map.className = type;
	    }
	}
}

var OpenIndex = null;
function ToggleInfo( id ) {
	var object = document.getElementById( "item" + id );
	if ( object != null ){
		if( object.className == "InfoPopup Hide" ) {
			if( OpenIndex != null ){
				document.getElementById( "item" + OpenIndex ).className = "InfoPopup Hide";
			}
			object.className = "InfoPopup Show";
			OpenIndex = id;
		} else {
			object.className = "InfoPopup Hide";
			OpenIndex = null;
		}
	}

}

function setHeight( ObjectID ) {
	var Object = document.getElementById( ObjectID );
	
	if( Object ) {
		var Amount = Math.ceil( Object.offsetHeight / 20 );
		var Height = ( Amount * 20 );
		if( Height < 360 ) {
			var Height = 360;
		}
		Object.style.height = Height + 'px';
	}
}

window.onload = function() {
	/*
	 * Cleaner code, no inline javascript
	 */
	var Cycle = new FotoCycle( 'FotoHolder', 'IMG', 6500 );
	var FAQCycle = new FotoCycle( 'FAQHolder', 'A', 6500 );
	setHeight( 'Content' );
	setHeight( 'RightColumn' );
	setHeight( 'ProjectHolder' );
	
}