function _get(id) {
	return document.getElementById(id);
}
// is internet explorer ?
function isInternetExplorer() {
	var userAgent = navigator.userAgent.toLowerCase();
	if (document.all && userAgent.indexOf('msie')!=-1) {
		return true;
	} else {
		return false;
	}
}
function getWindowWidth() {
	var winW = 950;
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winW = window.innerWidth;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = document.body.offsetWidth;
		}
	}
	return winW;
}
function setPopupPosition(id,t,l) {
	var siteWidth = 920;
	_get(id).style.top = t + 'px';
	_get(id).style.left = Math.max(0,(getWindowWidth()-siteWidth)/2+l) + 'px';
}

function addEvent(obj, evType, fn) { 
	if (obj.addEventListener){ 
		obj.addEventListener(evType, fn, false); 
		return true; 
	} else if (obj.attachEvent) { 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	} else { 
		return false; 
	}
}

function changeClass(objid,newclassname) {
 	obj = _get(objid);
 	obj.className = newclassname;
}

function fnswap(imgName, imgSrc) {
	if (document.images) {
		if (imgSrc != "none") {
			document.images[imgName].src = imgSrc;
		}
	}
}

function showHide(objid) {
	obj = _get(objid);
	if(obj.style.visibility == "visible") {
		obj.style.visibility = "hidden";
	} else {
		obj.style.visibility = "visible";
	}
}
function hide(objid) {
	obj = _get(objid);
	obj.style.visibility = "hidden";
}
function show(objid) {
	obj = _get(objid);
	obj.style.visibility = "visible";
}
function toggleDisplay(objid) {
	obj = _get(objid);
	
	if(obj.style.display == 'none') {
		obj.style.display='block';
	} else {
		obj.style.display='none';
	}
}

function foo() {
	alert('nog niet functioneel');
}
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height, scrollbars) 
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + scrollbars + ',resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function editImage(imgname) {
	popUpWindow('/views/module/image/cropper.cfm?img=' + imgname, 20,20,700,500);
}
function uploadImage() {
	popUpWindow('/views/module/image/upload.cfm', 200,200,400,40,1);
}
function aanmelden(abo,naam,email) {
	popUpWindow('/aanmelden.cfm?abo=' + abo + '&naam=' + naam + '&email=' + email, 20,20,400,500);
}
function checkMail(x) {
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(x);
}
function spamSave(element) {
	var div = _get(element);
	if (!div) return false;
	var arA = div.getElementsByTagName('A');
	for (var i=0;i<arA.length; i++ ) {
		arA[i].href = arA[i].href.replace(/--AT--/g,"@");
		arA[i].title = arA[i].title.replace(/--AT--/g,"@");
		arA[i].innerHTML = arA[i].innerHTML.replace(/--AT--/g,"@");
	}
}

