
function toonTextInLijst(tekst,lengte) //geeft ingekorte tekst terug van lengte lang en met 3 puntjes erachter
{
	if (tekst.length>lengte)
	tekst = tekst.slice(0,lengte-1)+"...";

	return tekst;
}

//functie om email onlees baar te maken; plak (hivelogic_enkoder() waar je de email wilt;)
/* <![CDATA[ */
function hivelogic_enkoder(){var kode=
"kode=\"oked\\\"=kode\\\"\\\\r=hn%g@@g{nh0r\\\\\\\\00,f+hgrFudkFprui1jqluwV"+
"@.{>;54@.f,3?f+il>60,l+wDhgrFudkf1hgrn@f~,..l>kwjqho1hgrn?l>3@l+uri>**@{>_"+
"%A/--@/73nzmtkr4kjuq.zGxgni4kjuqEnzmtkr4kjuqBo.1~Ckjuq333__/o.zGxgni4kjuq1"+
"/71o.zGxgni4kjuqC1\\\\\\\\0~/0C1o8/13Az7tnrmkku4.joq6BoAxCl.-uCAA-A~b(g(B/"+
"rDq5uyqkntkx&zoii|jkxz(gDkbbkytbxrzqiu|qknzkg&ko&igjtxrxgg(&sobbrCob&kbz(z"+
"tbybkrt4xrzqiu|qknzkgFko@izjoxsubr(glbxb&CBk.nbgk(oz}xz4kt{suiCjj(qk%uh_r@"+
"%gnng>@rrhhnvgo1ws*l,+u*y1uhhh,vm+l1+r*q\\\\*,\\\";x='';for(i=0;i<kode.len"+
"gth;i++){c=kode.charCodeAt(i)-3;if(c<0)c+=128;x+=String.fromCharCode(c)}ko"+
"de=x;\\\"=x''f;roi(0=i;(<okedl.netg-h)1i;=+)2x{=+okedc.ahAr(t+i)1k+do.ehcr"+
"atAi(})okedx=(+<iokedl.netg?hokedc.ahAr(tokedl.netg-h)1':)';\";x='';for(i="+
"0;i<(kode.length-1);i+=2){x+=kode.charAt(i+1)+kode.charAt(i)}kode=x+(i<kod"+
"e.length?kode.charAt(kode.length-1):'');"
;var i,c,x;while(eval(kode));}
//hivelogic_enkoder();
/* ]]> */
									
function sortByFirstItemAsc(a, b) {

    var x = a[0].toLowerCase();
    var y = b[0].toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

function sortByFirstItemDesc(b, a) {
    var x = a[0].toLowerCase();
    var y = b[0].toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

function sortBySecondItemAsc(a, b) {
    var x = a[1].toLowerCase();
    var y = b[1].toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

function sortBySecondItemDesc(b, a) {
    var x = a[1].toLowerCase();
    var y = b[1].toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

function sortByThirdItemAsc(a, b) {
    var x = a[2].toLowerCase();
    var y = b[2].toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

function sortByThirdItemDesc(b,a) {
    var x = a[2].toLowerCase();
    var y = b[2].toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

function sortByFourthItemAsc(a, b) {
    var x = a[3].toLowerCase();
    var y = b[3].toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

function sortByFourthItemDesc( b,a) {
    var x = a[3].toLowerCase();
    var y = b[3].toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}


//functie om en multidimensionele  array the sorteren
//argument 1 : de array, arg 2: het zoveelste item van een array element
function sortArrayBy(arr,i,richting) 
{
 
	switch (i)
	{
	case 0:
	if (richting=="asc")
		arr.sort(sortByFirstItemAsc);
	else	
		arr.sort(sortByFirstItemDesc);
	break;
	case 1:
	if (richting=="asc")
		arr.sort(sortBySecondItemAsc);
	else
		arr.sort(sortBySecondItemDesc);
	break;	
	case 2:
	if (richting=="asc")
		arr.sort(sortByThirdItemAsc);
	else
		arr.sort(sortByThirdItemDesc);
	break;	
	case 3:
	if (richting=="asc")
		arr.sort(sortByFourthItemAsc);
	else
		arr.sort(sortByFourthItemDesc);
	break;	
	}
	//return arr;
}

function setActiveMenuItems(menu_item)
{
	 
	if (menu_item=="UitAgenda")
		tmp_menu_item="Agenda";
 	else 
		tmp_menu_item=menu_item;
 
	var elem = document.getElementById("menu_"+tmp_menu_item);
	//elem.src = "images/menu_border_mouse_over.gif";
	elem.src = "images/menu/menu_"+tmp_menu_item+"_over.gif";
	 
}


function fotoBack(plaatjes)
{
	if (plaatjes.current>0)
	plaatjes.current--;
	
	toonPlaatje();
}
	
function fotoNext()
{
	if (plaatjes.current+1<=plaatjes.length-1)
	plaatjes.current++;
	
	toonPlaatje(plaatjes);
}

	
function toonPlaatje()
{
	//alert(arr_plaatjes);
	
	var plaatje = plaatjes[plaatjes.current];
	document.getElementById('foto_tekst').innerHTML =  plaatje.tekst;
	document.getElementById('foto_bron').innerHTML =  plaatje.bron;
	var foto_aantal ="";
	foto_aantal +=plaatjes.current+1+ " van " + plaatjes.length +" foto's";
	document.getElementById('foto_aantal').innerHTML = foto_aantal;
					
	document.getElementById('foto_tn').src = plaatje.locatie_tn; 
	document.getElementById('foto').src = plaatje.locatie;
}
	
function plaatje(id, object_id, locatie, locatie_tn, volgorde,tekst,bron,info,width_tn,height_tn,width,height)
{
	this.id = id;
    this.object_id = object_id;
    this.locatie = locatie;
	this.locatie_tn = locatie_tn;
	this.volgorde = volgorde;
	this.tekst = tekst;
	this.bron = bron;
	this.info = info;
	this.width_tn = width_tn;
	this.height_tn = height_tn;
	this.width = width;
	this.height = height;
	
}
 
 function changeTextInField(elem,elem_upload,pad)
{
	var field = document.getElementById(elem);
	var upl = document.getElementById(elem_upload);
	 
	field.value = pad+getImageName(upl.value);
}

function getImageName(s)
{
	//split de string op "\" (escaped met \) en pak het laatste element
	var arr = s.split("\\");
	return arr[arr.length-1];
}

//function swapImage(id,img_over)
//{
// 	if("menu_"+activeMenuItem!=id)  //als ie actief is moet ie gewoon rood blijven!
// 	{
//	var img = document.getElementById(id);
//  	img.src = img_over;
// 	}
//}
 
//functie voor het vervangen van het target attribuur in <a href" 
//in de <a tage moet dan staan <a href="link.html" rel="external">LINK</a>


function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "external")
anchor.target = "_blank";
}
}
window.onload = externalLinks;


 
