
scrl_busy = 0;
function scrollItem(obj, scr_ht, direction) {
	if (!scrl_busy) {
		scrl_busy = 1;
		scroll_plus = 0;
		scr_top = document.getElementById(obj).scrollTop;
		scroll_pos = scr_top;
		if (direction == "d") { scr_to = scr_top + scr_ht; }
		else { scr_to = scr_top - scr_ht; }
		if (scr_to < 0) { scr_to = 0; }
		animateScroll(obj, scr_ht, direction);
		}
	}

function animateScroll(obj, scr_ht, direction) {
	this.obj = obj;
	this.scr_ht = scr_ht;
	this.direction = direction;
	++scroll_plus;
	if (direction == "d") { scroll_pos += scroll_plus; }
	else { scroll_pos -= scroll_plus; }
	if (direction == "d" && scroll_pos >= scr_to) { scroll_pos = scr_to; }
	else if (direction == "u" && scroll_pos <= scr_to) { scroll_pos = scr_to;  }
	document.getElementById(obj).scrollTop = scroll_pos;
	if (scroll_pos != scr_to) { scrl=setTimeout("animateScroll(this.obj, this.scr_ht, this.direction)",25); }
	else { scrl_busy = 0; }
	}

var what_r;
	
function compareItemsList(wid, action) {
	var fstatus = 0;
	var random = parseInt(Math.random()*10235401) 
	
	var Rx= RegExp('\\bmycmp_item\\b','ig')
	var n= document.getElementById("mycmp_content").innerHTML.match(Rx);
	var cn = n? n.length: 0;
	
	if (cn > 0 && action != "d" || action == "d" && cn > 1 || action == "a") { document.getElementById("mycmp").style.display = "block"; }
	else { document.getElementById("mycmp").style.display = "none"; }
	
	if (cn >= 3 && action == "a") { alert("U kunt maximaal 3 vakanties vergelijken!"); }
	else {
		if (window.XMLHttpRequest) {
			xmlhttp=new XMLHttpRequest();
			xmlhttp.onreadystatechange=compareStatus;
			xmlhttp.open("GET", "data_comparebdr.php?aktie="+action+"&wid="+wid+"&rnd="+random, true);
			xmlhttp.send(null);
			}
		else if (window.ActiveXObject) {
			xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); 
			if (xmlhttp) {
				xmlhttp.onreadystatechange=compareStatus;
				xmlhttp.open('GET', "data_comparebdr.php?aktie="+action+"&wid="+wid+"&rnd="+random, true);
				xmlhttp.send();
				}
			}
		}
	}
	

	
function compareStatus() {
	if (xmlhttp.readyState==4) {
		if (xmlhttp.status==200) {
			document.getElementById("mycmp_content").innerHTML = xmlhttp.responseText;
			alert("Selecteer twee of meer vakanties.\nDeze verschijnen aan de rechterzijde van de pagina\nbij het onderdeel ‘Vergelijk vakanties’.");
			}
		}
	}
	
function chgObjColor(obj, clr) {
	obj.style.backgroundColor = clr;
	}

	
var the_obj = "";
var ajx = initAJAX();

function loadData(obj, url) {
	var rnd = parseInt(Math.random()*10235401) 
	the_obj = obj;
	document.getElementById(the_obj).innerHTML = "Een moment geduld a.u.b.";
	if(ajx){
		ajx=new XMLHttpRequest();
		ajx.onreadystatechange=loadStatus;
		if(url.indexOf("?")>0){
			ajx.open("GET", url+"&rnd="+rnd, true);
		} else {
			ajx.open("GET", url+"?rnd="+rnd, true);
		}
		ajx.send(null);
	}
}

function initAJAX(){
	if(window.ActiveXObject){
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else if(window.XMLHttpRequest){
		return new XMLHttpRequest();
	} else {
		alert("Your browser does not support AJAX.");
		return null;
	}
}

function loadStatus() {
	if (ajx.readyState==4) {
		if (ajx.status==200) {
			document.getElementById(the_obj).innerHTML = ajx.responseText;
		}
	}
}

function showItem(obj) {
	document.getElementById(obj).style.display = "block";
	}
	
function hideItem(obj) {
	document.getElementById(obj).style.display = "none";
	}
	
	function openWindow(elem){
		if(elem.className.substring(0, 8)=='accolist'){
			if(elem.className=='accolist_desc'){
				elem.className = 'accolist_desc_open';
			} else {
				elem.className = 'accolist_desc';
			}
		} else {
			if(elem.className=='tekst'){
				elem.className = 'tekst_open';
			} else {
				elem.className = 'tekst';
			}
		}
	}