var pictureURLS = new Array();
var currentPicture = 0;
var currentAlbum = 0;

var videoIDS = new Array();
var currentVideo = 0;
var currentVideoAlbum = 0;

function nextImage(){
	if(currentPicture < (pictureURLS[currentAlbum].length-1)){
		currentPicture++;
	}else{
		currentPicture = 0;
	}
	document.getElementById('largeimage').src = pictureURLS[currentAlbum][currentPicture];
}

function previousImage(){
	if(currentPicture > 0){
		currentPicture--;
	}else{
		currentPicture = pictureURLS[currentAlbum].length-1;
	}
	document.getElementById('largeimage').src = pictureURLS[currentAlbum][currentPicture];
}

function nextVideo(){
	if(currentVideo < (videoIDS[currentVideo].length-1)){
		currentVideo++;
	}else{
		currentVideo = 0;
	}
	showVideo(videoIDS[currentVideoAlbum][currentVideo]);
}

function previousVideo(){
	if(currentVideo > 0){
		currentVideo--;
	}else{
		currentVideo = videoIDS[currentVideoAlbum].length-1;
	}
	showVideo(videoIDS[currentVideoAlbum][currentVideo]);
}

function showLarge(curalbum,curpos,picurl){
	currentPicture = curpos;
	currentAlbum = curalbum;
	document.getElementById('largeimage').src = picurl;
}
function showVideo(id){
	// wis eerst oude inhoud
	document.getElementById("videoContent").innerHTML = "<font color='#000000'>loading video...</font>";
	// haal nieuwe inhoud op via getContent.php
	xmlhttp.open("GET", "getContent.php?item=videodetail&contentid="+id,true);
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4){
				tekst_content = xmlhttp.responseText;
				document.getElementById("videoContent").innerHTML = tekst_content;
		}
	}
	xmlhttp.send(null);	
}
function getContent(item){
	
	flashProxy.call('shiftbackground', 3);
	
	// wis eerst oude inhoud
	document.getElementById("content_container").innerHTML = "<font color='#000000'>loading page...</font>";
	// haal nieuwe inhoud op via getContent.php
	xmlhttp.open("GET", "getContent.php?item="+item, true);
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4){
				tekst_content = xmlhttp.responseText;
				document.getElementById("content_container").innerHTML = tekst_content;
				if(item=='pictures'){
					initPictures();
				}				
		}
	}
	xmlhttp.send(null);
}
function getNewsDetail(id){
	// wis eerst oude inhoud
	document.getElementById("content_container").innerHTML = "<font color='#000000'>loading page...</font>";
	// haal nieuwe inhoud op via getContent.php
	xmlhttp.open("GET", "getContent.php?item=newsdetail&contentid="+id,true);
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4){            
				tekst_content = xmlhttp.responseText;
				document.getElementById("content_container").innerHTML = tekst_content;
				//verander afbeelding in Flash header
		}
	}
	xmlhttp.send(null);	
}
function postMessage(id){
	postString = "getContent.php?item=postmessage&contentid="+id+"&name="+document.getElementById('name').value+"&message="+document.getElementById('message').value+"&link="+document.getElementById('link').value;
	postString = postString.replace(/\n/g, "<br/>");
	document.getElementById("comment_div").innerHTML = "<h1>Thank You!</h1>";
	// wis eerst oude inhoud
	//document.getElementById("content_container").innerHTML = "<font color='#000000'>loading page...</font>";
	// haal nieuwe inhoud op via getContent.php
	xmlhttp.open("POST", postString);
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4){            
				tekst_content = xmlhttp.responseText;
				document.getElementById("content_container").innerHTML = tekst_content;
				//verander afbeelding in Flash header
		}
	}
	xmlhttp.send(null);
}
function swapHeader(nmbr){
	document.getElementById('header').style.backgroundImage="url('components/images/header_"+nmbr+".jpg')";
}
function resizeIframeToFitContent(iframe) {
    // This function resizes an IFrame object
    // to fit its content.
    // The IFrame tag must have a unique ID attribute.
    iframe.height = document.frames[iframe.id]
                    .document.body.scrollHeight;}

