//methode om video's aan het DOM toe te voegen
function setVideo(divId,videoPath, width, height) {
	width = width?width:'250';
	height = height?height:'250';
	var myObject = document.createElement('object'); 
	obj = document.getElementById(divId);
	obj.appendChild(myObject); 
	myObject.width = width; 
	myObject.height = height; 
	myObject.stretchToFit = true;
	myObject.classid= "clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6";  
	myObject.URL = videoPath;
	//myObject.uiMode = "mini";
}

//functie voor foto overzicht bouwsteen
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
var popupscherm=0;

function popup_afbeelding(filename, fileid, width, height, scrollbars, resizable, menubar, toolbar, status, location) {
	if (popupscherm && ! popupscherm.closed)	popupscherm.close();
	if (!filename || filename=="")				filename="http://www.grundel.nl";
	if (!fileid || fileid=="")					fileid="Grundel";
	if (!width || width=="")					width="50";
	if (!height || height=="")					height="50";
	if (!scrollbars || scrollbars=="")			scrollbars="no";
	if (!resizable || resizable=="")			resizable="yes";
	if (!menubar || menubar=="")				menubar="no";
	if (!toolbar || toolbar=="")				toolbar="no";
	if (!status || status=="")					status="no";
	if (!location || location=="")				location="no";
	popupscherm=0;
	var args = "height=" + height + ", width=" + width + ", scrollbars=" + scrollbars + ", resizable=" + resizable +  ", menubar=" + menubar + ", toolbar=" +toolbar + ", status=" + status + " ,location=" + location;
	popupscherm = open(filename, fileid, args);
	if (!InternetExplorer) 						popupscherm.focus();
}

function init_stats () {
	var theOptions = document.stats_form.periode.options;
	var months = ["Januari","Februari","Maart","April","Mei","Juni","Juli", "Augustus","September","Oktober","November","December"]
	
	var today = new Date();
	var currentMonth = today.getMonth();
	var currentYear = today.getYear();
	
	for (var i=0; i< 12; i++) {
		var m = currentMonth - i;
		var y = currentYear;
		if (m < 0) {
			m = m + 12;
			y = currentYear - 1;
		}
		var str = months[m] + " " + y;
		var id = m + "-" + y;

		theOptions[theOptions.length] = new Option(str, id);
	}
}

function check_stats_form(theForm) {
	if (theForm.periode.value == "") {
		alert("Vul periode in!");
		return false;
	}
	
	if (theForm.output_type.value == "display")
		theForm.action = "/p3.php";
	else
		theForm.action = "/statistieken/statistieken.php";
		
//	alert(theForm.output_type.value);
	var arrPeriode = theForm.periode.value.split("-");
	theForm.month.value = parseInt(arrPeriode[0]) + 1;
	theForm.year.value = arrPeriode[1];
	return true;
}