function imageFresh(form) {
	if(form.foto.value != "") {
		var file = form.foto.value;
		var lengte = file.length;
		var begin = lengte - 3;
		var ext = file.substring(begin,lengte);
		if(ext.toLowerCase() != "jpg") { 
			alert('Plaatje kan alleen JPG zijn (dus niet renamen naar *.jpg!)');
		}
		else {
			document.getElementById('voorstellingImg').src = form.foto.value;
		}
	}
}

function smile(type) {
	if (document.getElementById("message").createTextRange) {
		document.getElementById("message").focus();
		document.selection.createRange().duplicate().text = type;
	}
	else {
		document.getElementById("message").focus();
		document.getElementById("message").value += type;
	}
}

function addUBB(varBegin,varEnd, tekst) {
	strSelection = document.selection.createRange().text
		if (strSelection != "") {
			document.selection.createRange().text = varBegin + strSelection + varEnd;
			return;
		}
		else {
			var promptUBB = prompt (tekst, '');
			if(promptUBB) {
				document.getElementById("message").focus();
				document.getElementById("message").value += varBegin + promptUBB + varEnd;
			}
		}
}

function addLink(varBegin, varEnd, tekst) {
	
	if(varBegin == "[email=") {
		var varType = 'Typ het emailadres.';
	}
	else {
		var varType = 'Typ de link.';	
	}
	
	strSelection = document.selection.createRange().text
		if (strSelection != "") {
			var promptUrl = prompt (varType, '');
			if(promptUrl) {
				document.selection.createRange().text = varBegin + promptUrl + ']' + strSelection + varEnd;
				return;
			}
		}
		else {
			var promptUBB = prompt (tekst, '');
			if(promptUBB) {
				var promptUrl = prompt (varType, '');
				if(promptUrl) {
					document.getElementById("message").focus();
					document.getElementById("message").value += varBegin + promptUrl + ']' + promptUBB + varEnd;
				}
			}
		}
}

function addList() {
	var listtype = prompt ('Wat voor een opsomming wil je? Voor een normale opsomming typ "o". Voor een numerieke typ "1". Voor een alfabetische typ "a"', '');
	if((listtype == "a") || (listtype == "1") || (listtype == "o")) {
		thelist = '[list=' + listtype + ']\n';
		var listentry = "initial";
		while ((listentry != "") && (listentry != null)) {
			listentry = prompt('Opsomming onderdeel invoeren.\nKlik op annuleren om de lijst af te maken.', '');
			if ((listentry != "") && (listentry != null)) {
				thelist = thelist + '[li]' + listentry + '[/li]\n';
			}
		}
		thelist = thelist + '[/list]';
		document.getElementById("message").focus();
		document.getElementById("message").value += thelist;
	}
}

/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="agenda.php?m=1">Januari</a>'
menu1[1]='<a href="agenda.php?m=2">Februari</a>'
menu1[2]='<a href="agenda.php?m=3">Maart</a>'
menu1[3]='<a href="agenda.php?m=4">April</a>'
menu1[4]='<a href="agenda.php?m=5">Mei</a>'
menu1[5]='<a href="agenda.php?m=6">Juni</a>'
menu1[6]='<a href="agenda.php?m=7">Juli</a>'
menu1[7]='<a href="agenda.php?m=8">Augustus</a>'
menu1[8]='<a href="agenda.php?m=9">September</a>'
menu1[9]='<a href="agenda.php?m=10">Oktober</a>'
menu1[10]='<a href="agenda.php?m=11">November</a>'
menu1[11]='<a href="agenda.php?m=12">December</a>'
menu1[12]='<a href="archief.php"><b>Archief</b></a>'

var menu2=new Array()
menu2[0]='<a href="route.php?p=adres">Adresgegevens</a>'
menu2[1]='<a href="route.php?p=route">Route</a>'

//Contents for menu 2, and so on
//var menu3=new Array()
//menu3[0]='<a href="techniek.php?p=zaal">Zaal</a>'
//menu3[1]='<a href="techniek.php?p=licht">Licht</a>'
//menu3[2]='<a href="techniek.php?p=geluid">Geluid</a>'
//menu3[3]='<a href="pdf/techniek.pdf">Download als PDF</a>'

var menu8=new Array()
menu8[0]='TEST'
menu8[1]='<a href="techniek.php?p=zaal">Gegevens</a>'
menu8[2]='<a href="techniek.php?p=licht">Reserveringen</a>'
menu8[3]='<a href="techniek.php?p=geluid">Favorieten</a>'
menu8[4]='<a href="pdf/techniek.pdf">Lalalal</a>'

var menu9=new Array()
menu9[0]='<a href="voegtoe.php">Voeg toe</a>'
//menu9[1]='<a href="#">TEST</a>'
		
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth, color){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)
dropmenuobj.style.backgroundColor=color

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

/***********************************************
* Drop down menu w/ description- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//1) CUSTOMIZE TEXT DESCRIPTIONS FOR LINKS ABOVE
var thetext1=new Array()
thetext1[0]="";
thetext1[1]="<b>Amsterdam - Haarlem:</b><br>Rijksweg A9 door Velsertunnel / Wijkertunnel.<br>Afslag Heemskerk >> Communicatieweg.<br>Bij rotonde rechtsaf.<br>Bij verkeerslichten linksaf >> Tolweg.<br>Bij verkeerslichten linksaf >> Hoflaan.<br>Eerste weg rechtsaf >> doorrijden tot De Cirkel."
thetext1[2]="<b>Zaandam Uitgeest:</b><br>N203, bij verkeerlichten rechtsaf richting Heemskerk >> Jacoba van Beierenlaan<br>Door spoortunnel >> rotonde rechtdoor >> bocht naar rechts >> bocht naar links >> de Kleis<br>Tweede verkeerslicht linksaf >> Hoflaan.<br>Eerste weg rechtsaf >> doorrijden tot De Cirkel."
thetext1[3]="<b>Alkmaar:</b><br>Rijksweg richting Haarlem.<br>Afslag Heemskerk >> Communicatieweg.<br>Bij rotonde rechtsaf.<br>Bij verkeerslichten linksaf >> Tolweg.<br>Bij verkeerslichten linksaf >> Hoflaan.<br>Eerste weg rechtsaf >> doorrijden tot De Cirkel."
thetext1[4]="<b>Westzaan - Assendelft:</b><br>Communicatieweg.<br>Bij rotonde rechtdoor.<br>Bij verkeerslichten linksaf >> Tolweg.<br>Bij verkeerslichten linksaf >> Hoflaan.<br>Eerste weg rechtsaf >> doorrijden tot De Cirkel."
thetext1[5]="<b>Beverwijk:</b><br>Laan der Nederlanden.<br>Bij verkeerslichten (politiebureau) Beneluxlaan richting Heemskerk.<br>Deze straat helemaal uitrijden >> rotonde rechtdoor >> weg buigt af naar links >> Hoflaan.<br>Eerste weg linksaf >> doorrijden tot De Cirkel."
thetext1[6]="<b>Castricum:</b><br>Rijksstraatweg richting Beverwijk.<br>Bij verkeerslichten linksaf >> Starweg.<br>Bij verkeerslichten rechtsaf >> Jan Ligthartstraat.<br>Bij verkeerslichten linksaf >> Tolweg.<br>Bij verkeerslichten rechtsaf >> Hoflaan.<br>Eerste weg rechtsaf >> doorrijden tot De Cirkel."

function displaydesc(which, descriptionarray, container){
if (document.getElementById)
document.getElementById(container).innerHTML=descriptionarray[which.selectedIndex]
}

function jumptolink(what){
var selectedopt=what.options[what.selectedIndex]
if (document.getElementById && selectedopt.getAttribute("target")=="newwin")
window.open(selectedopt.value)
else
window.location=selectedopt.value
}

//2) Call function displaydesc() for each drop down menu you have on the page
//   This function displays the initial description for the selected menu item
//   displaydesc(name of select menu, name of corresponding text array, ID of SPAN container tag):
//   Important: Remove the calls not in use (ie: 2nd line below if there's only 1 menu on your page)

//displaydesc(document.form1.select1, thetext1, 'textcontainer1')

// Deleten voorstelling

function del_show(showId) {
	var answer = confirm("Weet u zeker dat u deze voorstelling wilt verwijderen?")
	if (answer){
		window.location = "agenda.php?delete=" +showId;
	}
}



