/*$(document).ready(function () {

	
	setInterval('swapImages()', 5000);
});*/

window.onload = function() {
	setInterval('swapImages()', 6000);
}

function swapImages(){
  /*var $active = $('#myGallery .active');
  var $next = ($('#myGallery .active').next().length > 0) ? $('#myGallery .active').next() : $('#myGallery img:first');
  $active.fadeOut(function(){
    $active.removeClass('active');
    $next.fadeIn().addClass('active');
  });*/

 /*$(".block").animate({
	 }
  }, "slow");*/

	/* var image = $("#slideshowPicture");
		 image.fadeOut('fast', function () {
        image.attr('src', arrFiles[2]);
        image.fadeIn('fast');
    });*/

	var randomnumber=Math.floor(Math.random()*(arrFiles.length-1))
    document.getElementById("slideshowPicture").src = arrFiles[randomnumber];
}

function change(obj,id)
{
	switch(id)
	{
		case 1:
			obj.src="uploads/images/pdf_icon_small_hover.jpg";
		break;
		case 2:
			obj.src="uploads/images/pdf_icon_small.jpg";
		break;
	}
}

function checkContactForm()
{
	var formulier = document.getElementById("contactform");

	title = "Titel van het bericht";

	var error;

	if(formulier.Naam.value == "")
	{
		document.getElementById("namemessage").innerHTML = "<font color='red'><b>U dient een naam in te vullen.</b></font>";
		formulier.Naam.style.backgroundColor = "red";
		error = 1;
		return false;
	}
	if(formulier.Email.value == "")
	{
		document.getElementById("emailmessage").innerHTML = "<font color='red'><b>U dient een emailadres in te vullen.</b></font>";
		formulier.Email.style.backgroundColor = "red"; 
		error = 1;
		return false;
	}
	if(formulier.Titel.value == "")
	{
		document.getElementById("berichttitlemessage").innerHTML = "<font color='red'><b>U dient een titel in te vullen.</b></font>";
		formulier.Titel.style.backgroundColor = "red"; 
		error = 1;
		return false;
	}
	if(formulier.Bericht.value == "")
	{
		document.getElementById("berichtmessage").innerHTML = "<font color='red'><b>U dient een titel in te vullen.</b></font><br />";
		formulier.Bericht.style.backgroundColor = "red"; 
		error = 1;
		return false;
	}

	if(error == 1)
	{
		return false;
	}
	else
	{
		formulier.submit();
	}
}

function toContact(encodedstring)
{
	frm = document.createElement("form");
	frm.name = "to_contact_form";
	frm.action = "http://www.vogelvreugdwierden.nl/contact";
	frm.method = "post";
	
	inpTo = document.createElement("input");
	inpTo.type = "hidden";
	inpTo.name = "to";
	inpTo.value = encodedstring;

	frm.appendChild(inpTo);
	document.body.appendChild(frm);
	
	frm.submit();
}
