function openWindow( URL, winName, width, height, center, showMenu, showScrollbars ) 
{ 
	  xposition=0; yposition=0; 
	    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){ 
	        xposition = (screen.width - width) / 2; 
	        yposition = (screen.height - height) / 2; 
	    } 
	    args = "width=" + width + "," 
	    + "height=" + height + "," 
	    + "location=0," 
	    + "menubar=" + (showMenu != null ? showMenu : "0") + "," 
	    + "resizable=1," 
	    + "scrollbars=" + (showScrollbars != null ? showScrollbars : "1") + "," 
	    + "status=0," 
	    + "titlebar=0," 
	    + "toolbar=0," 
	    + "hotkeys=0," 
	    + "screenx=" + xposition + ","  //NN Only 
	    + "screeny=" + yposition + ","  //NN Only 
	    + "left=" + xposition + ","     //IE Only 
	    + "top=" + yposition;           //IE Only 


	  window.open( URL , winName , args ); 
} 

function closeto( URL )
{
	if ( window.opener != null ) {
		if ( URL )
			window.opener.location = URL;
		window.close();
		window.opener.focus();
	}
	else {
		if ( URL ) document.location = URL;
	}
}

function showPrint()
{
	if (window.print != null) 
	{ window.print(); } 
	else 
	{ alert('Om te printen selecteer Print van het File menu.'); }
}

function showHelp( topic, width, height )
{
	if ( !width ) width = 280;
	if ( !height ) height = 250;
	
	var args = "width=" + width + "," 
	    + "height=" + height + "," 
	    + "location=0," 
	    + "menubar=0," 
	    + "resizable=1," 
	    + "scrollbars=1," 
	    + "status=0," 
	    + "titlebar=0," 
	    + "toolbar=0," 
	    + "hotkeys=0";
	

	window.open( webRoot + "/Help/Popup.aspx?topic=" + encodeURIComponent(topic), "help", args );
}

function printArticle( articleId )
{
	var suffix = '';
	
	if ( images != null && images.length > 0 && images[currentPicture] != null )
		suffix = '&artikelFoto=' + images[currentPicture].Id;
	
	openWindow( webRoot + '/Artikel/PrintArtikel.aspx?artikelId=' + articleId + suffix,'print',640,500,1, 1 );
}

function archiveArticle( articleId )
{
	openWindow( webRoot + '/Registratie/MijnArchiefPopup.aspx?artikelId=' + articleId, 'archief', 350, 200, 1, 0, 0 );
}

function Picture( id, fileRef, source, caption, datum, title )
{
	this.Id	= id;
	this.FileRef = fileRef;
	this.Source = source;
	this.Caption = caption;
	this.Datum = datum;
	this.Title = title;

	// Preload
	this.Image	= new Image();
	this.Image.src = this.Source;
}



function Picture_ext( id, fileRef, source, caption, datum, title, myclass , clientid )
{
	this.Id	= id;
	this.FileRef = fileRef;
	this.Source = source;
	this.Caption = caption;
	this.Datum = datum;
	this.Title = title;

	// Preload
	this.Image	= new Image();
	this.Image.src = this.Source;
	this.MyClass = myclass;
	this.ClientID = clientid;
}






function firstPicture( showAlt ) {
	movePicture( 0, showAlt );
}

function prevPicture( showAlt ) {
	movePicture( currentPicture - 1, showAlt );
}


function nextPicture( showAlt ) {
	movePicture( currentPicture + 1, showAlt );
}

function imageId() {
	if (document.images)
	{
		var i = images[currentPicture];	
		if (i != null)
			return i.Id;
	}
}

function imageFileRef() {
	if (document.images)
	{
		var i = images[currentPicture];	
		if (i != null)
			return i.FileRef;
	}
}

function movePicture( cnt, showAlt )
{
	if ( document.images && cnt >= 0 && cnt < images.length )
	{
		
		
		var img = document.getElementById( 'picArticle' );
		var nextPicTop = document.getElementById( 'picNextTop' );
		var nextPicBottom = document.getElementById( 'picNextBottom' );
		var prevPicTop = document.getElementById( 'picPrevTop' );
		var prevPicBottom = document.getElementById( 'picPrevBottom' );
		var caption	= document.getElementById( 'picCaption' );
		var title	= document.getElementById( 'picTitle' );
		var datum	= document.getElementById( 'picDate' );
		var positionTop = document.getElementById( 'picPosTop' );
		var positionBottom = document.getElementById( 'picPosBottom' );
		var source = document.getElementById( 'picSource' );
		var clear	= document.getElementById( 'picClear' );
		var setalt	= !(showAlt == false);
		
		if ( img != null && ((nextPicTop != null && prevPicTop != null) || (nextPicBottom != null && prevPicBottom != null)) )
		{
			var i = images[cnt];
			
			if ( i != null )
			{
				
				// Changes the class of the div where the image is contained in the  article detail 
				if ( i.ClientID != null )
				{
					var divimgviewer = document.getElementById( i.ClientID + '_divImageViewerMulti' );
					if ( divimgviewer != null )
					{
						divimgviewer.className = i.MyClass;
					}
				}
									
				
				img.src = i.FileRef;
				
				if ( setalt ) img.alt = i.Caption;
				
				var hasSource = true;
				var hasCaption = true;
				
				if ( datum != null ) {
					if (i.Datum != null && i.Datum != "") {
						datum.innerHTML = "[" + i.Datum + "]";
						datum.style.display = "block";
					}
					else
						datum.style.display = "none";
				}
				
				if ( i.Caption != null && i.Caption != "" ) {
					caption.innerHTML = i.Caption;
					caption.style.display = "block";
				}
				else {
					caption.style.display	= "none";
					hasCaption				= false;
				}
					
				if ( title != null ) {
					if ( i.Title != null && i.Title != "" ) {
						title.innerHTML = i.Title;
						title.style.display = "block";
					}
					else
						title.style.display = "none";
				}
					
				if ( i.Source != null && i.Source != "" ) {
					source.innerHTML = i.Source;
					source.style.display = "block";
				}
				else {
					source.style.display = "none";
					hasSource			= false;
				}
				
				if ( clear != null ) {	
					if ( hasSource || hasCaption )
						clear.style.display = "block";
					else
						clear.style.display = "none";
				}
				
				if (positionTop != null && nextPicTop != null && nextPicTop != null)
				{
					positionTop.innerHTML = (cnt + 1) + "/" + images.length;
					if ( cnt == (images.length - 1) )
					{
						nextPicTop.style.display = "none";
					}
					else
					{
						nextPicTop.style.display = "block";
					}
					
					if ( cnt == 0 )
					{
						prevPicTop.style.display = "none";
					}
					else
					{
						prevPicTop.style.display = "block";
					}
				}
				if (positionBottom != null && nextPicBottom != null && nextPicBottom != null)
				{
					positionBottom.innerHTML = (cnt + 1) + "/" + images.length;
				
					if ( cnt == (images.length - 1) )
					{
						nextPicBottom.style.display = "none";
					}
					else
					{
						nextPicBottom.style.display = "block";
					}
					
					if ( cnt == 0 )
					{
						prevPicBottom.style.display = "none";
					}
					else
					{
						prevPicBottom.style.display = "block";
					}
				}				
				currentPicture = cnt;
			}
		}
	}
}

function openFotoSpecial( showId ) {
			window.open( webRoot + '/Nieuws/Foto/Fotospecial.aspx?show=' + showId, "link", "toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1, resizable=0, width=745, height=550, left=50, top=50" );
}

var currentPicture = 0;
var images = new Array();

/*  - NBO */
var nbo_bvrace = window.location.href.indexOf("genericId=630");
if (nbo_bvrace > -1)
{
	document.write ("<scr"+"ipt language=javascript>var adhese_extra ='nbo_bvrace'<\/scr"+"ipt>");
} 

