/**
 * 
 */

function DoNav(theUrl) {
	document.location.href = theUrl;
}

function ChangeColor(object, highLight) {
	if (highLight) {
		object.style.backgroundColor = '#dcfac9';
	} else {
		object.style.backgroundColor = 'white';
	}
}


function showAddress(address) {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GMapTypeControl());
		map.addControl(new GLargeMapControl());
		mwh();
		geocoder = new GClientGeocoder();

		geocoder.getLatLng(address, function(point) {
			if (!point) {
				alert(address + " is niet gevonden");
			} else {
				map.setCenter(point, 15);
				var marker = new GMarker(point);
				map.addOverlay(marker);

				// As this is user-generated content, we display it as
				// text rather than HTML to reduce XSS vulnerabilities.
				//marker.openInfoWindow(document.createTextNode(address));
			}
	    }
		);
	}
}

function ge(idname)
{
	return document.getElementById(idname);
}

// ----- mousewheel
function zoom(oEvent, s){
	if(s == -120){
		map.zoomOut();
	}
                
	if(s == 120) {
		map.zoomIn();
	}
}

function mwh() {
var d = ge('map');

	if (d){
		try {
			if (document.body.addEventListener) {
				d.addEventListener('DOMMouseScroll', 
						function(oEvent) {zoom(oEvent, oEvent.detail * -40); }, false);
			} else {
				d.onmousewheel = function() { zoom(event, event.wheelDelta); return false; }
			}
		} catch (ex) {}
	}
}


function handleFiles(files) {
var img=document.getElementById("previewField"); 
	if (files.length) {  
		for (var i = 0; i < files.length; i++) {  
			img.src = window.URL.createObjectURL(files[i]);  
			img.onload = function(e) {  
				window.URL.revokeObjectURL(this.src);  
			}
	    }  
	}  
}  


function evaluateFile(f){
	var TheForm = document.UitslagForm;
	filename=TheForm.uitslag.value;
	ext = filename.slice(filename.indexOf("."));
	
	if (ext != ".pdf") {
		alert("U dient hier een acrobat pdf bestand te selecteren.");
		TheForm.uitslag.value="";
	}
}
