/*

CUSTOM FORM ELEMENTS

Created by Ryan Fait
www.ryanfait.com

The only thing you need to change in this file is the following
variables: checkboxHeight, radioHeight and selectWidth.

Replace the first two numbers with the height of the checkbox and
radio button. The actual height of both the checkbox and radio
images should be 4 times the height of these two variables. The
selectWidth value should be the width of your select list image.

You may need to adjust your images a bit if there is a slight
vertical movement during the different stages of the button
activation.

Visit http://ryanfait.com/ for more information.


var checkboxHeight = "25";
var radioHeight = "25";
var selectWidth = "190";

document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; }</style>');

var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		for(a = 0; a < inputs.length; a++) {
			if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") {
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;

				if(inputs[a].checked == true) {
					if(inputs[a].type == "checkbox") {
						position = "0 -" + (checkboxHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					} else {
						position = "0 -" + (radioHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				span[a].onmousedown = Custom.pushed;
				span[a].onmouseup = Custom.check;
				document.onmouseup = Custom.clear;
			}
		}
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose;
			}
		}
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}
	}
}
window.onload = Custom.init;
*/

var fhs=false;
function chFHS(inst){fhs=true;}
function ge(i){if(document.getElementById)return document.getElementById(i);else if(document.all)return document.all[i];}
function hideiets(s){var o=ge(s);if(o)o.style.display='none';}
function showiets(s){var o=ge(s);if(o)o.style.display='block';}

/*menu functies*/
var activeMIs=new Array(2);

function findPositieX(o) {
	var cl=0;
	if(o){
		if(o.offsetParent){while(o.offsetParent){cl+=o.offsetLeft;o=o.offsetParent;}}
		else if(o.x)cl+=o.x;
	}
	return cl;
}
function findPositieY(o) {
	var ct=0; 
	if(o){
		if(o.offsetParent){while(o.offsetParent){ct+=o.offsetTop;o=o.offsetParent;}}
		else if(o.y)ct+=o.y;
	}
	return ct;
}
function getWidth(o){return o.offsetWidth?o.offsetWidth:0;}
function getHeight(o){return o.offsetHeight?o.offsetHeight:0;}

/*alles wat met menuLayer ml te maken heeft, sh=show(s) of hide(h),h=hoogte*/
function menL(sh,h,h2){
	var o=ge('ml');var p=ge('blok2b998');
	if(o&&p){
		if(sh=='s'){
			o.style.top=(h2+32)+'px';o.style.height=h+'px';p.style.top=((h+h2)+32)+'px';
			showiets('ml');showiets('blok2b998');
		} else {
			hideiets('ml');hideiets('blok2b998');
		}
	}
}
/*returnt de maximale hoogte van de menblokken met obj o1 (starthoogte h1) en o2 (starthoogte h2) (o2 kan submenublk zijn, 5 is margin*/
function findMaxHeight(o1,h1,o2,h2){
	/*alert('fullHeight(o1)='+(o1!=''?fullHeight(o1):0)+',h1='+h1+',fullHeight(o2)='+(o2!=''?fullHeight(o2):0)+',h2='+h2);*/
	return Math.max((o1?fullHeight(o1):0)+h1,(o2?fullHeight(o2):0)+h2)+5;
}

function showAllMenu(nr1,nr2){
	hideAllRelevantMenusFirst(nr1,nr2);
	var o=ge('m'+nr1);var p=ge('mm'+nr1);var q=ge('mmm'+nr1+'_'+nr2);
	h2=(o?findPositieY(o)-12:0);
	if(nr1!=-1){
		activeMIs[0]='mm'+nr1;
		submenu=nr1;
		if(p){
			p.style.left=(findPositieX(o))+'px';
			to=findPositieY(o)+20;
			p.style.top=to+'px'; 
			showiets('mm'+nr1);
			menL('s',findMaxHeight(p,0,0,0),h2);
		}
	}
	if(nr2!=-1){ 
		activeMIs[1]='mmm'+nr1+'_'+nr2;
		submenu=nr2;
		if(p&&q){
			q.style.left=(findPositieX(p)+getWidth(p)+3)+'px';
			to2=findPositieY(ge('mm'+nr1+'_'+nr2));
			q.style.top=to2+'px';
			showiets('mmm'+nr1+'_'+nr2);
			menL('s',findMaxHeight(q,(to2-32-h2),ge('mm'+nr1),0),h2);
		}
	}
}

function hideAllRelevantMenusFirst(nr1,nr2){
	if(activeMIs[0]!='mm'+nr1){menL('h');hideiets(activeMIs[0]);activeMIs[0]='';}
	if(nr2==-1||activeMIs[1]!='mmm'+nr1+'_'+nr2){menL('h');hideiets(activeMIs[1]);activeMIs[1]='';}
}

var submenu=-1; var Tsubmenu;
function ClearTimers(){clearTimeout(Tsubmenu);}
function ClearTimers2(i){if(submenu==i)clearTimeout(Tsubmenu);}
function submenuuit(i){Tsubmenu=setTimeout('submenuuit2('+i+')',1000);}
function submenuuit2(i,j){
	if(submenu!=-1){
		var o=ge('mm'+i);
		if(o){o.style.display='none';menL('h');}
		if(ge(activeMIs[1])){ge(activeMIs[1]).style.display='none';menL('h');}
		submenu=-1;
	}
}

/*wordt gebruikt voor mail link te genereren achter spam img*/
function linkMailAdres(dom,pre,spammsg){document.location.href='mailto:'+pre+'@'+dom+'.com?subject='+spammsg;}

/*formulierveld en image maakt een extra veld aan om nog een afbeelding toe te voegen.*/
/*function addoption(formstr,namestr,idfl,langtxt) {
	var i=0;
	while(ge('f_'+namestr+i)) i++;
	var nr=i;
	var html=document.createElement('div');
	html.innerHTML='<div class="f'+idfl+'"><div class="fl'+idfl+'"><label>'+langtxt+'</label></div><div class="ff'+idfl+'"><input id="f_'+namestr+nr+'" type="file" name="'+formstr+'['+namestr+nr+']" class="wit"></div><div style="clear:both"></div></div>';
	if(ge('imageoptions') && ge('f_'+namestr+eval(nr-1)) && ge('f_'+namestr+eval(nr-1)).value!='') 
		ge('imageoptions').appendChild(html);
}*/


/*wordt gerbuikt voor alsosees openklap div, samen met hideiets en showiets*/
/*function showDown(str) {
 	var p=ge(str);
  if(p){p.style.backgroundImage='url(http://pictures.greatestdivesites.com/img/down.gif)';p.style.backgroundRepeat='no-repeat';p.style.backgroundPosition='top right';}
}
function showUp(str) {
  var p=ge(str);
	if(p){p.style.backgroundImage='url(http://pictures.greatestdivesites.com/img/up.gif)';p.style.backgroundRepeat='no-repeat';p.style.backgroundPosition='top right';}
}*/

/*function cS(str) {
  var s=ge(str);
	if(s)var t=s.style.display!='block' ? showiets(str) : hideiets(str);
}*/
function cS(s,t) {
  var o=ge(s);var p=ge(t);
  if(o&&p){
  	o.style.display!='block'?showiets(s):hideiets(s);
  	p.className=='buu right'?cCN(t,'bud right'):cCN(t,'buu right');
	}	
}
/* change classname van een element*/
function cCN(s,c){var o=ge(s);if(o)o.className=c;}

function selectText(){
	var p=ge('banners');
	if(p){
		var o=p.getElementsByTagName('textarea');
		if(o){for(var i=0;i<o.length;i++){o[i].onclick=function(){this.focus();this.select();};}}
	}
}

/*wordt gebruikt bij inloggen zodat ook op enter gedrukt kan worden, e=event, f=formtxt*/
function onReturnFunc(e,f){
	var k=window.event?e.keyCode:e.which;
	var l=String.fromCharCode(k);r=/\r/;
	if(r.test(l))eval(f);
}

/*si=show item,s=id item,m=mingroote,p=stapgrootte,t=timeout,w=width of height,l=origsize,mG=maakGroot,mK=maakKlein*/
/*function si(x,s,m,p,t,w){
  var o=ge(s);
  if(o)if(o.style.display!='block'){o.style.display='block';mG(x,s,m,p,t,w);}
}
function hi(x,s,m,p,t,w){
	var o=ge(s);
	if(o)if(o.style.display!='none')mK(x,s,m,p,t,w,x);
}
function mG(x,s,m,p,t,w){
	if(w=='w')ge(s).style.width=x+'px';else ge(s).style.height=x+'px';
	if(x<m)setTimeout("mG("+(x+p)+",'"+s+"',"+m+","+p+","+t+",'"+w+"')",t);
}
function mK(x,s,m,p,t,w,l){
	if(x>m){
		if(w=='w')ge(s).style.width=x+'px';else ge(s).style.height=x+'px';
		setTimeout("mK("+(x-p)+",'"+s+"',"+m+","+p+","+t+",'"+w+"',"+l+")",t);
	} else {
		ge(str).style.display='none';
		if(w=='w')ge(s).style.width=l+'px';
		else ge(s).style.height=l+'px';
	}
}*/

/*shows en fades een nieuwe div in dit blok*/
/*function sfD(oid,nid){
	if(ge(oid)&&ge(nid))ge(oid).innerHTML=ge(oid).innerHTML+ge(nid).innerHTML;
}*/

/* nog checken of de hele functionaliteit van openklap boxen nog wel bestaat */
/*function schuifUit() {
	var su=gECN(document,'div','openklap');
	if(su){
		for(var i=0;i<su.length;i++) {
			ge((su[i].id).substring(3)).style.display='none';
			su[i].onmouseover=function(){
				idsub=(this.id).substring(3);
				th=fullHeight(ge(idsub));
				si(15,idsub,th,10,10,'h');showUp(this.id);
			};
			su[i].onclick=function(){
				idsub=(this.id).substring(3);
				th=fullHeight(ge(idsub));
				hi(th,idsub,15,10,10,'h');showDown(this.id);
			};
		}
	}
}*/

/*Finds the full,possible,height of an element e*/
function fullHeight(e){
	if(e.style.display!='none')return e.offsetHeight||getHeight(e);
	/* anders element has display:none dus trucen */
	e.style.display='block';e.style.position='absolute';
	var h=e.clientHeight||getHeight(e);
	e.style.display='none';e.style.position='relative';
	return h;
}

/*Finds the full,possible,width of an element e*/
function fullWidth(e){
	if(e.style.display!='none')return e.offsetWidth||getWidth(e);
	/*anders element has display:none dus trucen*/
	e.style.display='block';e.style.position='absolute';
	var w=e.clientWidth||getWidth(e);
	e.style.display='none';e.style.position='relative';
	return w;
}

/*To get all a elements in the document with a "info-links" class. 
getElementsByClassName(document,'a','info-links') shortened to gECN(); 
To get all div elements within the element named "container",with a "col" class. 
getElementsByClassName(document.getElementById('container'),'div','col'); 
To get all elements within in the document with a "click-me" class. 
getElementsByClassName(document,'*','click-me');
getElementsByClassName(oElm,strTagName,strClassName) shortened to gECN(o,t,c)
arrElements=a, arrReturnElements=r, oElement=oe
voor classes mi en smi uit menu een uitzondering maken. Die moet alleen menuitems met id returnen, zie functie tmh()*/
function gECN(o,t,c){
	if(o){
		var a=(t=='*' && o.all)?o.all:o.getElementsByTagName(t);
		var r=new Array();
		c=c.replace(/\-/g,'\\-');
		var oRegExp=new RegExp('(^|\\s)'+c+'(\\s|$)');
		var oe;
		for(var i=0;i<a.length;i++){
			oe=a[i];
			if(c=='mi'||c=='smi'){if(oRegExp.test(oe.className)&&oe.id)r.push(oe);}
			else if(oRegExp.test(oe.className))r.push(oe);
		}
		return r;
	}
}

function tmh(){

	var tm=gECN(ge('menumenu'),'div','mi');
	if(tm){
		for(var i=0;i<tm.length;i++){
//			if(tm[i].id){
				tm[i].onmouseover=function(){showAllMenu((this.id).substring(1),-1);ClearTimers();};
				tm[i].onmouseout=function(){submenuuit((this.id).substring(1),0);};
//			}
		}
	}

	/*alle top submenu header*/
	var tmsh=gECN(ge('menusubmenu'),'div','sm');
	if(tmsh){
		for(var i=0;i<tmsh.length;i++) {
			tmsh[i].onmouseover=function(){ClearTimers();};
			tmsh[i].onmouseout=function(){submenuuit((this.id).substring(2),0);};
		}
	}
	/*alle top submenu items*/
	var tms=gECN(ge('menusubmenu'),'div','smi');
	if(tms){
		for(var i=0;i<tms.length;i++) {
//			if(tms[i].id){
				tms[i].onmouseover=function(){
					idt=(this.id).split('_');
					showAllMenu(idt[0].substring(2),idt[1])
					/*changeBG(this.id);*/
				};
				/*tms[i].onmouseout=function(){changeBG2(this.id);}*/
//			}
		}
	}

	/*alle top subsubmenu header*/
	var tmssh=gECN(ge('menusubmenu'),'div','ssm');
	if(tmssh){
		for(var i=0;i<tmssh.length;i++) {
			tmssh[i].onmouseover=function(){ClearTimers();};
			tmssh[i].onmouseout=function(){
				idt=(this.id).split('_');
				submenuuit(idt[0].substring(3),1);};
		}
	}

/*
	var tmss=gECN(ge('menusubmenu'),'div','ssmi');
	if(tmss){
		for(var i=0;i<tmss.length;i++) {
			tmss[i].onmouseover=function(){changeBG(this.id);}
			tmss[i].onmouseout=function(){changeBG2(this.id);}
		}
	}
	
	var lm=gECN(document,'div','li');
	if(lm){
		for(var i=0;i<lm.length;i++) {
			if((lm[i].className).indexOf('lia')==-1){
				lm[i].onmouseover=function(){changeBG(this.id);}
				lm[i].onmouseout=function(){changeBG2(this.id);}
			}
		}
	}
	*/
}

/*showItemInBox(id1,id2) bepalt het hiden en showen van opgegeven div blokken*/
function sIB(id,id2){hideiets(id);showiets(id2);}

function disableSelection(target){
if(typeof target.onselectstart!='undefined') /*IE route*/
	target.onselectstart=function(){return false;};
else if(typeof target.style.MozUserSelect!='undefined') /*Firefox route*/
	target.style.MozUserSelect='none';
else /*All other route (ie: Opera)*/
	target.onmousedown=function(){return false;};
target.style.cursor='default';
}

/* BEGIN tonen en hiden van partner box */
function showPI(id){var o=ge('psb');if(o){o.innerHTML=ge(id).innerHTML;o.style.display='block';}}
function hidePI(){var o=ge('psb');if(o)o.style.display='none';}

/* Verplaatsen floating partnerbox: www.jtricks.com/javascript/navigation/floating.html
haselement shortened to he, has_inner to hi,target_x to tx,target_y to ty
floating_menu=flm,
fm_shift_x=fmx,fm_shift_y=fmy,fm_next_x=fmnx,fm_next_y=fmny,step_x=sx,step_y=sy
move_menu()=mm,compute_shifts()=csh,float_menu()=fm*/
var tx=10;var ty=-420;
var hi=typeof(window.innerWidth)=='number';
var he=document.documentElement&&document.documentElement.clientWidth;
var fm_id='psb';var fmx,fmy,fmnx,fmny;
function mm(){if(document.layers){flm.left=fmnx;flm.top=fmny;}else{flm.style.left=fmnx+'px';flm.style.top=fmny+'px';}}
function csh(){
 	fmx=hi?pageXOffset:he?document.documentElement.scrollLeft:document.body.scrollLeft;
  if(tx<0)fmx+=hi?window.innerWidth:he?document.documentElement.clientWidth:document.body.clientWidth;
  fmy=hi?pageYOffset:he?document.documentElement.scrollTop:document.body.scrollTop;
  if(ty<0)fmy+=hi?window.innerHeight:he?document.documentElement.clientHeight:document.body.clientHeight;
}
function fm() {
	var sx,sy;csh();
	sx=(fmx+tx-fmnx)*.07;
	if(Math.abs(sx)<.5)sx=fmx+tx-fmnx;
  sy=(fmy+ty-fmny)*.07;
  if(Math.abs(sy)<.5)sy=fmy+ty-fmny;
  if(Math.abs(sx)>0||Math.abs(sy)>0){fmnx+=sx;fmny+=sy;mm();}
  setTimeout('fm()',20);
}

/*begin admin stats, dive extra string es*/
function setinner(es,k){var o=ge('stats'+es);if(o)o.innerHTML=ge('stats'+es+k).innerHTML;}
function setinner2(es){var o=ge('stats'+es);if(o)o.innerHTML='';}

/*laat box j (0,1,2) met div class cl, een voor een in elkaar overlopen, j is hudige id, k is volgende*/
function setfbox(cl,j){
	var t=gECN(ge('main'),'div',cl+'2');
	if(t){n=t.length;if(n>1){k=0;if(j!=-1){
		k=(j==(n-1))?0:j+1;id1=cl+j;id2=cl+k;
		var o=ge(id1);var p=ge(id2);
		if(o&&p){
  		stap=50;to=15;wtot=210;/*echte afstand wtot=210, verschil=10 dat je bij ML in uiteindelijke stap erbij opteld.*/
  		o.style.left='0px';p.style.left=wtot+'px';p.style.display='block';
  		mL(cl,id1,id2,wtot,0,wtot,stap,to);
  	}
	}setTimeout("setfbox('"+cl+"',"+k+")",6000);}}
}

/*schuift id1 naar links en id2 komt er vanaf rechts invliegen*/
function mL(cl,id1,id2,wtot,w1,w2,stap,to) {
	var o=ge(id1);var p=ge(id2);
	if(o&&p){
		if(w1<-wtot){o.style.left=-(wtot+10)+'px';p.style.left='0px';}
		else{
			o.style.left=w1+'px';p.style.left=w2+'px';
			setTimeout("mL('"+cl+"','"+id1+"','"+id2+"',"+wtot+","+(w1-stap)+","+(w2-stap)+","+stap+","+to+")",to);
		} 
		/*if(w1<-(wtot/2)&&cl=='asnp'&&ge('asnpbghref')&&ge('href'+id2))ge('asnpbghref').href=ge('href'+id2).href;*/
		/*if(w1<-(wtot/2)&&cl=='asnp'&&ge('asnpbghref')&&ge('href'+id2)){ge('asnpbghref').href=ge('href'+id2).href;ge('asnpbghref').onclick=eval(ge('href'+id2).onclick);alert(eval(ge('href'+id2).onclick));}*/
	}
}

/* voor rating */
function actRat(id){for(i=1;i<=id;i++)cCN('rat'+i,'rata');}
function inactRat(id){for(i=1;i<=id;i++)cCN('rat'+i,'rat');}

/* voor gmaps */
function amover(id){var o=ge('a'+id);if(o)o.style.textDecoration='underline';}
function amout(id){var o=ge('a'+id);if(o)o.style.textDecoration='none';}

/*voor members, en voor pasfoto box verschillende tabs*/
function sopen(id,n){
	sluitalle('vmt'+n);
	var o=ge('vmt'+n+id);var p=ge('sst'+n+id);
	if(o)o.style.display='block';
	if(p)p.innerHTML='';
}
function sluitalle(c){
	var v=gECN(ge('body'),'div',c);
  for(var i=0;i<=v.length;i++)if(v[i]!=null&&ge(v[i].id))ge(v[i].id).style.display='none';
}

/*schuifUit();*/
/*function iinit(){tmh();selectText();setImgDown(-1,'EN');setfbox('halgal',-1);setfbox('asnp',-1);}
if(window.attachEvent)window.attachEvent('onload',iinit);
else window.addEventListener('DOMContentLoaded',iinit,false);*/

function sendMails(){
	if(ge('fsh'))ge('fsh').value='oke';
	if(ge('fma'))ge('fma').submit();
}

/* allerlei jscript functies die ajax gebruiken om zaken te tonen */
function rCB(s){
	if(s){
		s=s.replace(/&/g,'[[[AND]]]');
		s=s.replace(/\\\\/g,'[[[BACKSLASH]]]');
		s=s.replace(/"/g,'[[[DQUOTE]]]');
		s=s.replace(/'/g,'[[[QUOTE]]]');
		//s=s.replace(/<\/p>\n<p>/g,'</p><p>');		
		s=s.replace(/\n/g,'');		
	}
	return s;
}
function saveform(ty,een,twee,re,li,ifid,lang){
	var em1='';var i1='';var i2='';var l1='';var rb1='';var ta1='';var u1='';var u2='';var ca='';
	if(ge('em1'))em1=rCB(ge('em1').value);
	if(ge('i1'))i1=rCB(ge('i1').value);
	if(ge('i2'))i2=rCB(ge('i2').value);
	if(ge('l1'))l1=rCB(ge('l1').value);
	if(ge('rb1y'))rb1=ge('rb1y').checked;
	if(ge('ta1')){if(window.tinyMCE && window.tinyMCE.get('ta1')){var tinyMCE=window.tinyMCE;ta1=tinyMCE.get('ta1').getContent();}if(ta1=='')ta1=ge('ta1').value;}ta1=rCB(ta1);
	/*if(ge('ta1'))ta1=rCB(ge('ta1').value);*/
	if(ge('u1'))u1=rCB(ge('u1').value);
	if(ge('u2'))u2=rCB(ge('u2').value);
	if(ge('ca'))ca=ge('ca').value;

	var a=new EA('/include/ajaxajax.inc.php?ifid='+ifid+'&lang='+lang);  
	a.zetActie('saveform',{'ty':ty,'een':een,'twee':twee,'em1':em1,'i1':i1,'i2':i2,'l1':l1,'rb1':rb1,'ta1':ta1,'u1':u1,'u2':u2,'ca':ca});
	var b=a.doeRequest(); 

	var ar=b.split('<<SPLITTER>>');
	/* als de window.location de str ?aid=,&aid=,?invid=,&invid=, of #bla tag name weghalen erin heeft staan dan strippen dit deel
	 dus als reload en geen error ar[2]==0 dan pas reloaden */
	if(re&&ar[2]==''){ 
		hre=(li==''?window.location.href:li);
		if(hre.indexOf('?aid=')>=0||hre.indexOf('?invid=')>=0||hre.indexOf('&aid=')>=0||hre.indexOf('&invid=')>=0)hre=hre.substr(0,hre.indexOf('?'));
		if(hre.indexOf('#')>=0)hre=hre.substr(0,hre.indexOf('#'));
		window.location.href=hre;
	}
	else{
		if(ge('ca'))ge('ca').value='';
		if(ge('errortext2'))ge('errortext2').innerHTML=ar[0];	
		if(ar[1]!=''){var arr=ar[1].split(',');for(var i in arr){if(ge('l'+arr[i]))ge('l'+arr[i]).className='fl';if(ge(arr[i])&&ar[2]=='')ge(arr[i]).value='';}}
		if(ar[2]!=''){var arr2=ar[2].split(',');for(var j in arr2){if(ge('l'+arr2[j]))ge('l'+arr2[j]).className='fl error';}}
		if(ge('imageexmp') && ar[1]=='')ge('imageexmp').innerHTML='';
	}
	if(ar[3]!='')eval(ar[3]);
	
	tmh();
}
function saveform2(id,id2,soort,type,jsfunc,ifid,lang){
	var dt1='';var dt2='';var dt3='';var em1='';var i1='';var i2='';var i3='';var i4='';var i5='';var i6='';var i7='';var i8='';var i9='';var rb1='';var rb2='';var sm1=new Array();var sm2=new Array();var selhib=0;var seldr=0;var selds=0;var ta1='';var ta2='';var ca='';
	
	if(ge('dt1'+id))dt1=ge('dt1'+id).value;
	if(ge('dt2'+id))dt2=ge('dt2'+id).value;
	if(ge('dt3'+id))dt3=ge('dt3'+id).value;
	if(ge('em1'+id))em1=rCB(ge('em1'+id).value);
	if(ge('i1'+id))i1=rCB(ge('i1'+id).value);
	if(ge('i2'+id))i2=rCB(ge('i2'+id).value);
	if(ge('i3'+id))i3=rCB(ge('i3'+id).value);
	if(ge('i4'+id))i4=rCB(ge('i4'+id).value);
	if(ge('i5'+id))i5=rCB(ge('i5'+id).value);
	if(ge('i6'+id))i6=rCB(ge('i6'+id).value);
	if(ge('i7'+id))i7=rCB(ge('i7'+id).value);
	if(ge('i8'+id))i8=rCB(ge('i8'+id).value);
	if(ge('i9'+id))i9=rCB(ge('i9'+id).value);
	if(ge('rb1y'+id))rb1=ge('rb1y'+id).checked;
	if(ge('rb2y'+id))rb2=ge('rb2y'+id).checked;
	count=0;if(ge('sm1'+id)){var ob=ge('sm1'+id);if(ob.options){for(var i=0;i<ob.options.length;i++){if(ob.options[i].selected){sm1[count]=ob.options[i].value;count++;}}}}
	count=0;if(ge('sm2'+id)){var ob=ge('sm2'+id);if(ob.options){for(var i=0;i<ob.options.length;i++){if(ob.options[i].selected){sm2[count]=ob.options[i].value;count++;}}}}
	if(ge('selhib'+id))selhib=ge('selhib'+id).value;
	if(ge('seldr'+id))seldr=ge('seldr'+id).value;
	if(ge('selds'+id))selds=ge('selds'+id).value;
	/*if(ge('selds'+id)){selds=ge('selds'+id).value;if(id2==0&&jsfunc=='divesites'&&type=='add')id2=selds;}*/
	if(ge('ta1'+id)){if(window.tinyMCE && window.tinyMCE.get('ta1'+id)){var tinyMCE=window.tinyMCE;ta1=tinyMCE.get('ta1'+id).getContent();}if(ta1=='')ta1=ge('ta1'+id).value;}ta1=rCB(ta1);
	/*alert(window.tinyMCE);alert(tinyMCE.get('ta1'+id).getContent());alert(ge('ta1'+id).value);alert(rCB(ta1));*/
	if(ge('ta2'+id)){if(window.tinyMCE && window.tinyMCE.get('ta2'+id)){var tinyMCE=window.tinyMCE;ta2=tinyMCE.get('ta2'+id).getContent();}if(ta2=='')ta2=ge('ta2'+id).value;}ta2=rCB(ta2);
	if(ge('ca'))ca=ge('ca').value;
	var a=new EA('/include/a-'+jsfunc+'.php?ifid='+ifid+'&lang='+lang);  
	a.zetActie('save'+jsfunc,{'id':id,'id2':id2,'soort':soort,'type':type,'dt1':dt1,'dt2':dt2,'dt3':dt3,'em1':em1,'i1':i1,'i2':i2,'i3':i3,'i4':i4,'i5':i5,'i6':i6,'i7':i7,'i8':i8,'i9':i9,'rb1':rb1,'rb2':rb2,'selhib':selhib,'seldr':seldr,'selds':selds,'sm1':sm1,'sm2':sm2,'ta1':ta1,'ta2':ta2,'ca':ca});
	var b=a.doeRequest(); 

	var ar=b.split('<<SPLITTER>>');
	if(ge('fm'+id))ge('fm'+id).innerHTML=ta1;/*check waar gebruikt en wellicht in arr[4] zetten voor eval javascript*/
	if(ge('ca'))ge('ca').value='';
	if(ge('sst'+id)){ge('sst'+id).innerHTML=ar[0];if(ar[2]!='')ge('sst'+id).className='ft error';else ge('sst'+id).className='ft';}
	if(ar[1]!=''){var arr=ar[1].split(',');for(var i in arr){
		if(ge('l'+arr[i]+id))ge('l'+arr[i]+id).className='fl';
		if(ge(arr[i]+id)&&ar[2]==''&&type!='edit'&&type!='home'){if(arr[i]=='ta1'&&tinyMCE)tinyMCE.get('ta1'+id).setContent('');else if(arr[i]=='ta2'&&tinyMCE)tinyMCE.get('ta2'+id).setContent('');else if(arr[i]!='selhib'&&arr[i]!='seldr'&&arr[i]!='selds')ge(arr[i]+id).value='';}
	}}
	if(ar[2]!=''){var arr2=ar[2].split(',');for(var j in arr2){if(ge('l'+arr2[j]+id))ge('l'+arr2[j]+id).className='fl error';}}
	if(ar[3]!='')eval(ar[3]);
}
function delform2(id,id2,soort,jsfunc,ifid,lang){
	var a=new EA('/include/a-'+jsfunc+'.php?ifid='+ifid+'&lang='+lang);  
	a.zetActie('del'+jsfunc,{'id':id,'id2':id2,'soort':soort});
	var b=a.doeRequest();
	if(b!=0){if(ge(b+id))ge(b+id).innerHTML='';if(ge(b+'r'+id))ge(b+'r'+id).innerHTML='';}
}

function showtransform(jsfunc,id,fn,eh,soort,mid,idt,browser,ifid,lang){
	var a=new EA('/include/'+jsfunc+'?ifid='+ifid+'&lang='+lang);  
	/*if(eh=='')eh=findPositieY(ge(idt==''?'vm'+id:idt+id));*/
	eh=gSP();
	a.zetActie('stf',{'id':id,'fn':fn,'eh':eh,'soort':soort,'mid':mid});
	var b=a.doeRequest();
	var o=ge('fadingdiv');var p=ge('bottomcenter');
	if(ifid==-1&&o){o.innerHTML=b;o.style.lineHeight='19px';o.focus();}
/*  if(ifid==-1&&o){o.innerHTML=b;parseScript(b);o.style.lineHeight='19px';o.focus();}*//*ljcf('http://ads2.smowtion.com/ad.js','js');*/
  if(ifid!=-1&&p)p.innerHTML=b; /*dit kan omdat voor iframe geen fadingdiv is en dus maar een met id=bottomcenter*/
/*window.scrollTo(0,eh);*/
}

/*function getScrollPosition, met var scrollTop (s)*/
function gSP(){
	/*document.documentElement.scrollTop*/
	var s=document.body.scrollTop;
	if(s==0){
    if(window.pageYOffset)s=window.pageYOffset;
		else s=document.body.parentElement ? document.body.parentElement.scrollTop : 0;
	}
	return s;
}

/*voor divesites, creert de hoofdboom met options na klikken op de hoofdidboom (hib) en na klikken op de regio items.*/
function chibds(id,sit,ty,ty2,tye,ifid,lang){
	var a=new EA('/include/a-divesites.php?ifid='+ifid+'&lang='+lang);  
	a.zetActie('chibds',{'sit':sit,'ty':ty,'ty2':ty2,'tye':tye});
	var b=a.doeRequest();
	var ar=b.split('<<SPLITTER>>');
	var p=ge('seldr'+id); 
	if(p&&ar[0]!=''){
		var dr=ar[0].split('<>');
		p.options.length=0;
		for(var i in dr){var dr2=dr[i].split('++');p.options[p.length]=new Option(dr2[1],dr2[0]);}
		p.disabled=false;
	}
	var o=ge('selds'+id); 
	if(o&&ar[1]!=''){
		var ds=ar[1].split('<>');
		o.options.length=0;
		for(var i in ds){var ds2=ds[i].split('++');o.options[o.length]=new Option(ds2[1],ds2[0]);}
		o.disabled=false;
	}
}

/* sio=safeitemopties, voor pictures, movies */
function sio(id,jsfunc,ifid,lang){
	var ti='';var ke='';var be='';var selhib=0;var selds=0;var seldl=0;
	if(ge('fmtg')){ti=ge('fmtg').value;ti=rCB(ti);}
	if(ge('fmkg')){ke=ge('fmkg').value;ke=rCB(ke);}
	if(ge('fmsg')){if(window.tinyMCE&&window.tinyMCE.get('fmsg')){var tinyMCE=window.tinyMCE;be=tinyMCE.get('fmsg').getContent();}else be=ge('fmsg').value;}be=rCB(be);
	if(ge('selhib'+id))selhib=ge('selhib'+id).value;
	if(ge('seldr'+id))seldr=ge('seldr'+id).value;
	if(ge('selds'+id))selds=ge('selds'+id).value;
	if(ge('seldl'+id))seldl=ge('seldl'+id).value;
	var a=new EA('/include/'+jsfunc+'.php?ifid='+ifid+'&lang='+lang);  
	a.zetActie('sio',{'id':id,'ti':ti,'ke':ke,'be':be,'selhib':selhib,'seldr':seldr,'selds':selds,'seldl':seldl});
	var b=a.doeRequest(); 
	if(ge('fmsgm'))ge('fmsgm').innerHTML=b;
	if(ge('fmt'))ge('fmt').innerHTML='<h2>'+ti+'</h2>';
	if(ge('fmk'))ge('fmk').innerHTML='<h3>'+ke+'</h3>';
	if(ge('fms'))ge('fms').innerHTML='<p>'+be+'</p>';
}


/* fucntie doeiets roept ajax aan en functie doeiets en met vars id1,id2,id3,id4.
ondermeer de functies readItem (afhandeling of berichten members gelezen of niet gelezen zijn, 
inv (member invitation afhandeling), apl (laadt image in in shadebox om resources te besparen)
uR (update rating), iw (politie iswrong afhandeling), setimgdown (de lijst met banners onderaan)
setledenstats (de statistieken van leden optellen als getoond wordt), 
unsetimgupload (als img geupload is in contact form) */
function di(id1,id2,id3,id4,jsfunc,jsfunc2,ifid,lang){
	var a=new EA('/include/'+jsfunc+'.php?ifid='+ifid+'&lang='+lang);  
	a.zetActie(jsfunc2,{'id1':id1,'id2':id2,'id3':id3,'id4':id4});
	var b=a.doeRequest();
	var ar=b.split('<<SPLITTER>>');
	var resp=ar[1];
	if(ar[0]==1)eval(resp);
}

/*doeiets2 doet hetzelfde als doe iets alelen dan voor forms, er zit dus een makkelijkemanier
ingebouwd om de forms af te handelen.*/
/*function di2(id,id2,soort,jsfunc,jsfunc2,ifid,lang){
	var a=new EA('/include/'+jsfunc+'.php?ifid='+ifid+'&lang='+lang);  
	a.zetActie(jsfunc2,{'id':id,'id2':id2,'soort':soort});
	var b=a.doeRequest();
	var ar=b.split('<<SPLITTER>>');
	var resp=ar[1];
	if(ar[0]==1)eval(resp);
}*/

/*ljcf loads a css or js file depending on the filetype ft en filename fn*/
/*function ljcf(fn,ft){
 if(ft=="js"){ //if filename is a external JavaScript file
  var fr=document.createElement('script');
  fr.setAttribute("type","text/javascript");
  fr.setAttribute("src",fn);
//	fr.setAttribute("id",new Date().getTime() + "_onDemandLoadedScript");
 }
 else if(ft=="css"){ //if filename is an external CSS file
  var fr=document.createElement("link");
  fr.setAttribute("rel", "stylesheet");
  fr.setAttribute("type", "text/css");
  fr.setAttribute("href",fn);
 }
 if(typeof fr!="undefined")document.getElementsByTagName("head")[0].appendChild(fr);
// if(typeof fr!="undefined")ge('gab').innerHTML=eval(fr);
// if(typeof fr!="undefined")ge('gab').appendChild(fr);
//	if(typeof fr!="undefined")ge('gab').innerHTML="<script type='text/javascript' src='http://ads2.smowtion.com/ad.js'></script>";  
	//alert(ge('gab'));
}*/

/*parseScript dynamically loads all javascript variable listed in source such as <script type='text/javascript'>var x=5;</script>*/
/*function parseScript(_source) {
	var source = _source;
	var source2 = _source;
	var scripts = new Array();
	
	// Strip out tags
	while(source.indexOf("<script") > -1 || source.indexOf("</script") > -1) {
		var s = source.indexOf("<script");
		var s_e = source.indexOf(">", s);
		var e = source.indexOf("</script", s);
		var e_e = source.indexOf(">", e);
		
		// Add to scripts array
		scripts.push(source.substring(s_e+1, e));
		// Strip from source
		source = source.substring(0, s) + source.substring(e_e+1);
	}
	//alert(scripts);
	// Loop through every script collected and eval it
	for(var i=0; i<scripts.length; i++) {
		try {
			eval(scripts[i]);
		}
		catch(ex) {
			// do what you want here when a script fails
		}
	}
	
		var scriptFragment = '<script[^>]*src=(\"|\')([\\S\\s]*?)(\"|\')[^>]*><\/script>';
		var scriptRegExp = RegExp(scriptFragment, 'img');
		var scriptMatches = source2.match(scriptRegExp);
		var scripts = new Array();
	//	alert(scriptMatches);
		if(scriptMatches != null){
			for(i = 0; i < scriptMatches.length; i++){
				var srcFragment = 'src=(\"|\')([\\S\\s]*?)(\"|\')';
				var srcRegExp = RegExp(srcFragment , 'img');
				var results = srcRegExp.exec(scriptMatches[i]);
				scripts.push(results[2]);
			}
		}
		for(var i=0; i<scripts.length; i++) ljcf(scripts[i],'js');
	//	return (scripts || []);
	//	alert(scripts);

	
//	//'http://ads2.smowtion.com/ad.js'
//var head = document.getElementsByTagName("head")[0];
//			script = document.createElement('script');
//			script.id = new Date().getTime() + "_onDemandLoadedScript";
//			script.type = 'text/javascript';
//			script.src = scriptSrc;
//			head.appendChild(script);
//
//function IncludeJS(sId, fileUrl, source) 
// { 
// if ( ( source != null ) && ( !document.getElementById( sId ) ) ){ 
// var oHead = document.getElementsByTagName('HEAD').item(0);
// var oScript = document.createElement( "script" );
// oScript.language = "javascript";
// oScript.type = "text/javascript";
// oScript.id = sId;
// oScript.defer = true;
// oScript.text = source;
// oHead.appendChild( oScript );
// } 
// } 
// AjaxPage( "scrA", "b.js" ); 
//
//	 var oHead = document.getElementsByTagName('HEAD').item(0);
// var oScript= document.createElement("script");
// oScript.language = "javascript";
// oScript.type = "text/javascript";
// oScript.defer = true;
//// oScript.src="http://ads2.smowtion.com/ad.js";
// oHead.appendChild( oScript); 
 
//	source=ge('gab').innerHTML=document.write("<script type='text/javascript' src='http://ads2.smowtion.com/ad.js'><\/script>");  
	// Return the cleaned source
	//return source;
}
*/

var JSON = (function () {
    var m = {
            '\b': '\\b',
            '\t': '\\t',
            '\n': '\\n',
            '\f': '\\f',
            '\r': '\\r',
            '"' : '\\"',
            '\\': '\\\\'
        },
        s = {
            array: function (x) {
                var a = ['['], b, f, i, l = x.length, v;
                for (i = 0; i < l; i += 1) {
                    v = x[i];
                    f = s[typeof v];
                    if (f) {
                        v = f(v);
                        if (typeof v == 'string') {
                            if(b) a[a.length] = ',';
                            a[a.length] = v;
                            b = true;
                        }
                    }
                }
                a[a.length] = ']';
                return a.join('');
            },
            'boolean': function (x) {
                return String(x);
            },
            'null': function (x) {
                return "null";
            },
            number: function (x) {
                return isFinite(x) ? String(x) : 'null';
            },
            object: function (x) {
                if (x) {
                    if (x instanceof Array) return s.array(x);
                    var a = ['{'], b, f, i, v;
                    for (i in x) {
                        v = x[i];
                        f = s[typeof v];
                        if (f) {
                            v = f(v);
                            if (typeof v == 'string') {
                                if(b) a[a.length] = ',';
                                a.push(s.string(i), ':', v);
                                b = true;
                            }
                        }
                    }
                    a[a.length] = '}';
                    return a.join('');
                }
                return 'null';
            },
            string: function (x) {
                if (/["\\\x00-\x1f]/.test(x)) {
                    x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
                        var c = m[b];
                        if(c)return c;
                        c = b.charCodeAt();
                        return '\\u00' +
                            Math.floor(c / 16).toString(16) +
                            (c % 16).toString(16);
                    });
                }
                return '"' + x + '"';
            }
        };
        
	return {
		parse: function(s) {
			try {
				return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
					s.replace(/"(\\.|[^"\\])*"/g, ''))) &&
					eval('(' + s + ')');
			} catch (e) {
			alert(e);
				return false;
			}
		},
		stringify: s.object
	};
})();
/*EfocusAjax shortened to EA
serverUrl=su,*/
function EA(su){
	this.xmlHttpReq=false;
	this.serverUrl=su?su:'';
	this.isAsynchroon=false;
	this.actie='';
	this.actieParameter=false;
	this.formulierMethode='POST';
};
EA.prototype.zetActie=function(a,ap){
	this.actie=a;
	this.actieParameter=ap;
};
EA.prototype.doeRequest=function(){
	if(window.XMLHttpRequest)var xmlHttpReq=new XMLHttpRequest();
	else if(window.ActiveXObject)var xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");
	xmlHttpReq.open(this.formulierMethode,this.serverUrl,this.isAsynchroon);
	xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded;charset=UTF-8');
	xmlHttpReq.send('actie='+this.actie+((this.actieParameter) ? '&actieParameter='+JSON.stringify(this.actieParameter):''));
	return JSON.parse(xmlHttpReq.responseText);
};
/*
function sm_click(url,bu,bt,br) {
	u='';if(bu!='')u='?'+bu+'='+encodeURIComponent(location.href);
	t='';if(bt!='')t=(u!=''?'&':'?')+bt+'='+encodeURIComponent(document.title);
	window.open(url+u+t+br,'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}*/
