var type = "IE";

function BrowserSniffer() {
	if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP";		//Opera
	else if (document.all) type="IE";														//Internet Explorer e.g. IE4 upwards
	else if (document.layers) type="NN";													//Netscape Communicator 4
	else if (!document.all && document.getElementById) type="MO";							//Mozila e.g. Netscape 6 upwards
	else type = "IE";
}

BrowserSniffer();

function ShowPhoto(id,sVal) {
	if (type=="IE") document.all[id].src = sVal;
	if (type=="NN") document.layer['id'].src = sVal;
	if (type=="MO" || type=="OP") document.getElementById(id).src = sVal;
}

function GetValue(id){
	if (type=="IE") return document.all[id].value;
	if (type=="NN") return document.layer['id'].value;
	if (type=="MO" || type=="OP") return document.getElementById(id).value;
}

function SetValue(id,sVal){
	if (type=="IE") document.all[id].value = sVal;
	if (type=="NN") document.layer['id'].value = sVal;
	if (type=="MO" || type=="OP") document.getElementById(id).value = sVal;
}

function hidesb(){
	window.status=''
	return true
}

function IsValidEmail(emailStr){
     var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
     var regex = new RegExp(emailReg);
     return regex.test(emailStr);
}

function validateLogin() {
	var userid = GetValue("userid");
	var userpass = GetValue("userpass");
	if (userid == "" || userpass == "") {
		alert("U heeft geen geldig email adres en wachtwoord ingevuld.");
	}else{
		document.loginform.submit();
	}
}

function validateLogin2() {
	document.loginform2.submit();
}

function Register() {
	SetValue("act","register");
	document.regform.submit();
}

function notLoggedIn() {
	//alert("Please log in first");
	location.href = "inloggen.asp";
}


function joinMailing() {
	var email = GetValue("email");
	var selstr = "c=join&e="+email;
	if (email == "" || !IsValidEmail(email)) {
		alert("U heeft geen geldig email adres ingevuld.");
	}else{
		SetValue("email","");
		location.href = "joinmailinglist.asp?"+selstr;
	}
}

function leaveMailing() {
	var email = GetValue("email");
	var selstr = "c=leave&e="+email;
	if (email == "" || !IsValidEmail(email)) {
		alert("U heeft geen geldig email adres ingevuld.");
	}else{
		SetValue("email","");
		location.href = "joinmailinglist.asp?"+selstr;
	}
}

function redir(url) {
	if (url != "") {
		location.href = url;
	}
}

function LaunchSubscribe() {
	NewWindow('joinmailinglist.asp',300,200,'yes','');
}

function Launch(targetURL) {
	NewWindow(targetURL,600,500,'yes','');
}

var win=null;
function NewWindow(targetpage,w,h,scroll,pos){
	LeftPosition = (screen.width)?(screen.width-w)/2:100;
	TopPosition=(screen.height)?(screen.height-h)/2:100;
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(targetpage,"",settings);
}

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

if (document.layers) 
	document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
	document.onmouseover=hidesb
	document.onmouseout=hidesb


