	var xmlHttp;

	function createXMLHttpRequest() {
		if ( window.ActiveXObject ) {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} else if ( window.XMLHttpRequest ) {
			xmlHttp = new XMLHttpRequest();
		}
	}

	function fn_change_main(img, pic, range, sub, main) {
		createXMLHttpRequest();

		params = "pic=" + pic + "&range=" + range + "&sub=" + sub;

		xmlHttp.open("POST","../ajax/ajax-click-picture-main.php", true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		xmlHttp.onreadystatechange = function() {
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {			
				document.getElementById('main_image').innerHTML = '<img src="../upload/mol/pictures/detail/' + img + '">';
				fn_move_main(range, sub, pic, main);
				if ( main == 5 ) {
					setTimeout("fn_change_description(" + pic + "," + sub + ");",1000);
				}
			}
		}
		xmlHttp.send(params);
	}

	function fn_change_description(pic, sub) {
		createXMLHttpRequest();

		params = "pic=" + pic + "&sub=" + sub;

		xmlHttp.open("POST","../ajax/ajax-change_description.php", true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		xmlHttp.onreadystatechange = function() {
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200 && xmlHttp.responseText != '' ) {
				document.getElementById('prod_text').innerHTML = xmlHttp.responseText;

				$(document).ready(function(){
					$(".lightbox").lightbox();
				});
			}
		}
		xmlHttp.send(params);
	}

	function fn_move_main(range, sub, pic, main) {
		createXMLHttpRequest();

		params = "range=" + range + "&main=" + main + "&sub=" + sub + "&pic=" + pic;

		xmlHttp.open("POST","../ajax/ajax-change-picture-main.php", true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		xmlHttp.onreadystatechange = function() {
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {			
				document.getElementById("gallery-vert").innerHTML = xmlHttp.responseText;
				tooltip.init();
			}
		}
		xmlHttp.send(params);
	}

	function fn_move_sub(range, sub) {
		createXMLHttpRequest();

		params = "range=" + range + "&sub=" + sub;

		xmlHttp.open("POST","../ajax/ajax-change-picture-sub.php", true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		xmlHttp.onreadystatechange = function() {
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {			
				document.getElementById("gallery-hor").innerHTML = xmlHttp.responseText;

				$(document).ready(function(){
					$(".lightbox").lightbox();
				});
			}
		}
		xmlHttp.send(params);
	}

	function fn_move_date(range) {
		createXMLHttpRequest();

		params = "range=" + range;

		xmlHttp.open("POST","../ajax/ajax-change-date.php", true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		xmlHttp.onreadystatechange = function() {
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {			
				document.getElementById("div-date").innerHTML = xmlHttp.responseText;
			}
		}
		xmlHttp.send(params);
	}

	function fn_check_contact() {
		createXMLHttpRequest();

		var voornaam = document.getElementById("voornaam").value;
		var naam = document.getElementById("naam").value;
		var bedrijfsnaam = document.getElementById("bedrijfsnaam").value;
		var straat = document.getElementById("straat").value;
		var woonplaats = document.getElementById("woonplaats").value;
		var tel = document.getElementById("tel").value;
		var email = document.getElementById("email").value;
		var functie = document.getElementById("functie").value;
		var postcode = document.getElementById("postcode").value;
		var bericht = document.getElementById("bericht").value;

		params = "functie=" + functie + "&postcode=" + postcode + "&voornaam=" + voornaam + "&naam=" + naam + "&bedrijfsnaam=" + bedrijfsnaam + "&straat=" + straat + "&woonplaats=" + woonplaats + "&tel=" + tel + "&email=" + email + "&bericht=" + bericht;

		xmlHttp.open("POST","../ajax/ajax-check-contact.php", true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		xmlHttp.onreadystatechange = function() {
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
				document.getElementById("error_box").innerHTML = xmlHttp.responseText;
				//document.getElementById("versturen").style.visibility = 'hidden';
			}
		}
		xmlHttp.send(params);
	}

	function fn_subscribe() {
		createXMLHttpRequest();

		var voornaam = document.getElementById("sub_voornaam").value;
		var naam = document.getElementById("sub_naam").value;
		var email = document.getElementById("sub_email").value;

		params = "voornaam=" + voornaam + "&naam=" + naam + "&email=" + email;

		xmlHttp.open("POST","../ajax/ajax-newsl-subscribe.php", true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		xmlHttp.onreadystatechange = function() {
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
				document.getElementById("mail_errorbox").innerHTML = xmlHttp.responseText;
			}
		}
		xmlHttp.send(params);
	}

	function fn_unsubscribe() {
		createXMLHttpRequest();

		var email = document.getElementById("unsub_email").value;

		params = "email=" + email;

		xmlHttp.open("POST","../ajax/ajax-newsl-unsubscribe.php", true);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		xmlHttp.onreadystatechange = function() {
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200) {
			}
		}
		xmlHttp.send(params);	}
