function OpenWindow(pURL, pWidth, pHeight)
{
  var win = window.open(pURL, 'win', 'dependent,width=' + pWidth + ',height=' + pHeight);
}

function OpenScrollWindow(pURL, pWidth, pHeight)
{
  var win = window.open(pURL, 'scrollwin', 'dependent,width=' + pWidth + ',height=' + pHeight + ',scrollbars=1');
}

function OpenPicture(pPicture, pWidth, pHeight)
{
  OpenWindow('/openpicture.asp?picture=' + pPicture, (parseInt(pWidth) + 20), (parseInt(pHeight) + 45));
}

function MailTo(pUsername, pDomain)
{
  var strLink = 'mailto:' + pUsername + '@' + pDomain;
  window.open(strLink);
}

function checkValidEmail(pValue)
{
	var x = pValue;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) return true;
	else return false;
}

function positionFooter(){
	var footer = document.getElementById("merkencontainer");
	var colA = document.getElementById("colA");
	var contentleft = 0;
	if(document.getElementById("contentleft")){
		contentleft = document.getElementById("contentleft");
	} else if(document.getElementById("contentleftPage")){
		contentleft = document.getElementById("contentleftPage");
	}
	var contentright = 0;
	if(document.getElementById("contentright")){
		if(document.getElementById("colC") && document.getElementById("colD")){
			if(document.getElementById("colC").offsetHeight > document.getElementById("colD").offsetHeight){
				contentright = document.getElementById("colC");
			} else if(document.getElementById("colD").offsetHeight > document.getElementById("colC").offsetHeight){
				contentright = document.getElementById("colD");
			}
		} else if(document.getElementById("colC")){
			contentright = document.getElementById("colC");
		} else if(document.getElementById("colD")){
			contentright = document.getElementById("colD");
		}
	} else if(document.getElementById("contentrightPage")){
		contentright = document.getElementById("contentrightPage");
	}
	var usedHeight = 0;
	if((colA.offsetHeight > contentleft.offsetHeight) && (colA.offsetHeight > contentright.offsetHeight)){
		usedHeight = colA.offsetHeight + 115;
	} else if((contentleft.offsetHeight > colA.offsetHeight) && (contentleft.offsetHeight > contentright.offsetHeight)) {
		usedHeight = contentleft.offsetHeight + 115;
	} else if((contentright.offsetHeight > colA.offsetHeight) && (contentright.offsetHeight > contentleft.offsetHeight)){
		usedHeight = contentright.offsetHeight + 105;
	}
	if(navigator.userAgent.indexOf("MSIE") > -1){
		//Internet Explorer
		if(usedHeight > (document.body.clientHeight - 110)){
			footer.style.top = usedHeight + 10 + "px";
      footer.style.display = 'block';
		} else {
			footer.style.bottom = 0 + "px";
      footer.style.display = 'block';
		}
	} else if(navigator.userAgent.indexOf("Firefox") > -1) {
		//Firefox
		if(usedHeight > (window.innerHeight - 110)){
			footer.style.top = usedHeight + 10 + "px";
		} else {
			footer.style.bottom = 0 + "px";
			footer.style.display = 'block';
		}
	}
}
