var request = false;
try {
request = new XMLHttpRequest();
}
catch (ms) {
	try {
		request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (ms2) {
			request = new ActiveXObject("Microsoft.XMLHTTP");
		}
}

function submitform(myform) {
  document.contact.submit();
}

function execute(page, language, width) {
	if (width != document.body.clientWidth) {
		width = document.body.clientWidth;
	}
	string = "index.php?page=" + page + "&width=" + width + "&lang=" + language;
	location.href= string ;
}


function getObj(name) {
	if (document.getElementById) {
		return document.getElementById(name).style;
	}
 	else if (document.all) {
 		return document.all[name].style;
 	}
 	else if (document.layers) {
 		return document.layers[name];
 	}
}


function naarRechts(initialPos) {
	var divver = getObj('mt');
	sprong=10;
	tegaan=(initialPos-1) * -561;
	if ((a-tegaan) > -11) { sprong=5; }
	if ((a-tegaan) > -6) { sprong=3; }
	if ((a-tegaan) > -3) { sprong=1; }
	a+=sprong;
	divver.left = a;
	if (a < (initialPos-1) * -561) {
		repeatLink = 'naarRechts(' + initialPos + ')';
		time = setTimeout(repeatLink,1);
	}


}


function naarLinks(initialPos) {
	var divver = getObj('mt');
	sprong=10;
	tegaan=initialPos * -561;
	if ((a-tegaan) < 11) { sprong=5; }
	if ((a-tegaan) < 6) { sprong=3; }
	if ((a-tegaan) < 3) { sprong=1; }
	a-=sprong; 
	if (a < (-561*initialPos))  { 
		a=-561*initialPos; 
	}
	divver.left = a;
	if (a > -561 * initialPos) {
		repeatLink = 'naarLinks(' + initialPos + ')';
		time = setTimeout(repeatLink,1);
	}
}

function restoreWidthLeftBackbar(addingWidth) {
	var divver = new getObj('d01');
	if (addingWidth > 0) {
		divver.width= initTextPos + addingWidth;
	}
	else {
		divver.width = initTextPos;
	}
}

function recalculateCenter() {
	var addingWidth = 0;
	var pageWidth= document.body.clientWidth;
	if (pageWidth > 1024) {
		addingWidth = Math.round((pageWidth - 1024) / 2);
		for (i=0; i < divs.length; i++) {
			verplaats = orgLeft[i] + addingWidth;
			var divver = new getObj(divs[i]);
			if (divs[i] != "d01") {
				divver.left = verplaats;
			}
			else {
				divver.left=0; 
			}
		}
	}
	else {
		for (i=0; i < divs.length; i++) {
			var divver = new getObj(divs[i]);
			divver.left = orgLeft[i];
		}

	}
//alert("ja");
setTimeout("ajaxWidth(" + pageWidth + ")", 1000);
	restoreWidthLeftBackbar(addingWidth);
}

function ajaxWidth(pageWidth) {
	request.open("GET", "setwidth.php?width=" + pageWidth, true);
	request.onreadystatechange = function() {
		if (request.readyState == 4 && request.status == 200) {
			var answer = request.responseText;
			//alert (answer);
			}
	}
	request.send(null);
}

