function encryptemail(user,site,subject)
{
	document.write('<FORM><b>Stuur een Email:</b><br><INPUT TYPE="button" VALUE="' + user + '@' + site + '" onClick="parent.location=\'mailto:' + user + '@' + site + '?subject=' + subject + '\'"></FORM>');
}


function redirect(page)
{
	window.location.href='index.php?page='+page;
}

function bookmarksite(title, url)
{
	if (document.all){window.external.AddFavorite(url, title);}
	else if (window.sidebar){window.sidebar.addPanel(title, url, "");}
}

function changeHomePage(obj,url)
{
	var appname = navigator.appName;
	var appversion = parseInt(navigator.appVersion);
	if(navigator.appVersion.substring(17,23)=="MSIE 5" || navigator.appVersion.substring(17,23)=="MSIE 6" || navigator.appVersion.substring(17,23)=="MSIE 7")
	{
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage(url);
	}
	else
	{
		alert("Het is helaas niet gelukt om www.OnsLimburg.nl als startpagina in te stellen. U zult dit handmatig moeten doen.");
	}
}

function ajax(url)
{
	urltot=url;
	var jsel=document.createElement('SCRIPT');
	jsel.type='text/javascript';
	jsel.src=urltot;
	document.body.appendChild (jsel);
}
setInterval("ajax('banner.php?gemeente_id=1')",'15000');

function minimizeall(j)
{
	for(i=0;i<number;i++)
	{
		if (i!=j)
		{
			bericht='bericht'+i;
			if (document.getElementById(bericht))
			{
				bericht=document.getElementById(bericht);
				if (bericht.style.visibility=='visible')
				{
					bericht.style.visibility='hidden';
					for(j=i+1;j<number;j++)
					{
						button='button'+j;
						if (document.getElementById(button))
						{
							button=document.getElementById(button);
							button.style.top=parseInt(button.style.top)-(links[i]*linkheight);
						}
					}
				}
			}
		}
	}
}

function toggle(i)
{
	minimizeall(i);
	bericht='bericht'+i;
	bericht=document.getElementById(bericht);
	if (bericht.style.visibility=='visible')
	{
		bericht.style.visibility='hidden';
		for(j=i+1;j<number;j++)
		{
			button='button'+j;
			if (document.getElementById(button))
			{
				button=document.getElementById(button);
				button.style.top=parseInt(button.style.top)-(links[i]*linkheight);
			}
		}
	}
	else
	{
		bericht.style.visibility='visible';
		for(j=i+1;j<number;j++)
		{
			button='button'+j;
			if (document.getElementById(button))
			{
				button=document.getElementById(button);
				button.style.top=parseInt(button.style.top)+(links[i]*linkheight);
			}
		}
	}
}

function disableSelection(target)
{
	if (typeof target.onselectstart!="undefined")
	{
		target.onselectstart=function(){return false}
	}
	else if (typeof target.style.MozUserSelect!="undefined")
	{
		target.style.MozUserSelect="none"
	}
	else
	{
		target.onmousedown=function(){return false}
	}
	target.style.cursor = "default"
}

number=8;
number=number+1;
linkheight=16;
var links = new Array();

function setupmenu(page,loggedin)
{
	links[1]=6;
	links[2]=0;
	links[3]=4;
	links[4]=2;
	links[5]=3;
	links[6]=3 + parseInt(loggedin);
	links[7]=0;
	links[8]=0;
	totalheight=0;
	var ar = new Array();
	for(i=0;i<100;i++)
	{
		j=i+1;
		bericht='bericht'+i;
		button='button'+j;
		if (document.getElementById(bericht))
		{
			bericht=document.getElementById(bericht);
			disableSelection(bericht);
		}
		if (document.getElementById(button))
		{
			button=document.getElementById(button);
			disableSelection(button);
			if (i!=0)
			{
				totalheight=totalheight+(linkheight*links[i]*-1);
				button.style.top=totalheight;
			}
		}
	}
	if(page=='actueel' || page=='news') {toggle(1);}
	if(page=='voordeelkaart') {toggle(3);}
	if(page=='ticketservice') {toggle(4);}
	if(page=='prikkers') {toggle(5);}
	if(page=='login') {toggle(6);}
	
}

function emailCheck (emailStr) {var error="Het door u ingevuld e-mail adres is onjuist.";var emailPat=/^(.+)@(.+)$/;var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";var validChars="\[^\\s" + specialChars + "\]";var quotedUser="(\"[^\"]*\")";var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;var atom=validChars + '+';var word="(" + atom + "|" + quotedUser + ")";var userPat=new RegExp("^" + word + "(\\." + word + ")*$");var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");var matchArray=emailStr.match(emailPat);if (matchArray==null) {alert(error);return false;}var user=matchArray[1];var domain=matchArray[2];if (user.match(userPat)==null) {alert(error);return false;}var IPArray=domain.match(ipDomainPat);if (IPArray!=null) {for (var i=1;i<=4;i++) {if (IPArray[i]>255) {alert(error);return false;}}return true;}var domainArray=domain.match(domainPat);if (domainArray==null) {alert(error);return false;}var atomPat=new RegExp(atom,"g");var domArr=domain.match(atomPat);var len=domArr.length;if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) {alert(error);return false;}if (len<2) {alert(error);return false;}return true;}
