window.defaultStatus = "JuroFoon - betrouwbaar juridisch advies voor een eerlijke prijs";

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}



function SetCellClass(r,s){
  	for(var i=0; i<r.cells.length; i++) r.cells(i).className = s;
	}

//function isEmailAddr(email){
//  var result = false
//  var theStr = new String(email)
//  var spatieindex = theStr.indexOf(" ");
//  var index = theStr.indexOf("@");
//  if ((index > 0 ) && (spatieindex == -1))
//  {
//    var pindex = theStr.indexOf(".",index);
//    if ((pindex > index+1) && (theStr.length > pindex+1))
//	result = true;
//  }
//  return result;
//}

//function CheckEmailAanmeldpagina() {
//  if (!isEmailAddr(document.getElementById('txtemail_pagina').value))
//   {
//    alert("Vul a.u.b. een correct emailadres in.");
//
//   }
// else 
//   {
//  location.replace ("/nieuws/nieuwsbrief/aanmelden.asp?email="+document.getElementById('txtemail_pagina').value)
//   }
//}
//
//
//function CheckEmailAfmelden() {
//
//  if (!isEmailAddr(document.getElementById('txtemailafmelden').value))
//   {
//    alert("Vul a.u.b. een correct emailadres in.");
//
//   }
// else 
//   {
//  location.replace ("/nieuws/nieuwsbrief/afmelden.asp?email="+document.getElementById('txtemailafmelden').value)
//   }
//}
//
//function CheckEmail(e)
//{
//
//  if ((e.value.length > 0) && (!isEmailAddr(e.value)))
//  {
//    alert("Vul a.u.b. een correct emailadress in.");
//    e.focus();
//    return (false);
//  }
//
//  return (true);
//}



function Inloggenoud(targeturl){
samplewin = window.open("/inloggen/inlogscherm.asp?targeturl="+targeturl, "","scrollbars=0,status=0,resizable=0,width=280,height=280,top=100,left=100");
}

function Inloggen(targeturl){
if (targeturl == undefined) { location.href='/inloggen'; } else { location.href='/inloggen?targeturl='+targeturl; }
}

function InloggenChat(){
samplewin = window.open("/inloggen/inlogscherm.asp?target=chat", "","scrollbars=0,status=0,resizable=0,width=280,height=280,top=100,left=100");
}

function InloggenExtra(target){
samplewin = window.open("/inloggen/inlogscherm.asp?target="+target, "","scrollbars=0,status=0,resizable=0,width=280,height=280,top=100,left=100");
}

function Chat(){
chatwindow = window.open("/leden/chat_intro_disclaimer.asp", "","scrollbars=0,status=0,resizable=0,width=660,height=600,top=20,left=200");
}     

function Uitloggen(){
samplewin = window.open("/inloggen/uitlogscherm.asp", "","scrollbars=0,status=0,resizable=0,width=280,height=250,top=100,left=100");
}


function StelUwVraag(){
samplewin = window.open("/banner/klik.asp?bannerid=5a", "","scrollbars=0,status=0,resizable=0,width=320,height=415,top=250,left=300");
}

function StelUwVraag_b(){
samplewin = window.open("/banner/klik.asp?bannerid=5", "","scrollbars=0,status=0,resizable=0,width=320,height=415,top=250,left=300");
}





  function CheckFormat(s, f) {
    var i;
    for (i=0; i < s.length && i < f.length; i++) {
      if (f.charAt(i) == '9') {
        if (!(parseInt(s.charAt(i)) >= 0)) {
          return false; }
      }
      else {
        if (s.charAt(i) != f.charAt(i)) {
          return false; }
      }				
    }
    return (s.length == f.length);
  }
  function DateValid(ctl) {
    var s = ctl.value;
    if (CheckFormat(s, "9-9-9999")) {
      ctl.value = "0" + s.substr(0, 1) + "-" + "0" + s.substr(2,1) + "-" + s.substr(4,4); }
    else if (CheckFormat(s, "99-9-9999")) {
      ctl.value = s.substr(0, 2) + "-" + "0" + s.substr(3,1) + "-" +  s.substr(5,4); }
    else if (CheckFormat(s, "9-99-9999")) {
      ctl.value = "0" + s.substr(0, 1) + "-" + s.substr(2,2) + "-" + s.substr(5,4); }
    else if (CheckFormat(s, "9/9/9999")) {
      ctl.value = "0" + s.substr(0, 1) + "-" + "0" + s.substr(2,1) + "-" + s.substr(4,4); }
    else if (CheckFormat(s, "9/99/9999")) {
      ctl.value = "0" + s.substr(0, 1) + "-" + s.substr(2,2) + "-" + s.substr(5,4); }
    else if (CheckFormat(s, "99/9/9999")) {
      ctl.value = s.substr(0, 2) + "-" + "0" + s.substr(3,1) + "-" +  s.substr(5,4); }
    else if (CheckFormat(s, "99/99/9999")) {
      ctl.value = s.substr(0, 2) + "-" + s.substr(3,2) + "-" +  s.substr(6,4); }
    else if (CheckFormat(s, "999999")) {
      ctl.value = "0" + s.substr(0, 1) + "-" + "0" + s.substr(1,1) + "-" + s.substr(2,4); }
    else if (CheckFormat(s, "99999999")) {
      ctl.value = s.substr(0, 2) + "-" + s.substr(2,2) + "-" +  s.substr(4,4); }
    else if (CheckFormat(s, "9999999")) {
      ctl.value = Dateformat(s.substr(0, 2),2) + "-" + Dateformat(s.substr(2,1),2) + "-" +  Dateformat(s.substr(3,4),2); }
  }



function Nieuwsbrief(url){
samplewin = window.open(url, "","scrollbars=1,status=0,resizable=0,width=700,height=500,top=100,left=100");
}            

function BewerkAdvertentie(nummer){
samplewin = window.open('/advocaten/advertentie.asp?nummer='+nummer, "","scrollbars=0,status=0,resizable=0,width=550,height=600,top=50,left=100");
}         

function ismaxlength(obj){
  var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
  if (obj.getAttribute && obj.value.length>mlength)
  obj.value=obj.value.substring(0,mlength)
}

function ChatDisclaimer(){
samplewin = window.open('/leden/chatdisclaimer.asp', "","scrollbars=0,status=0,resizable=0,width=500,height=400,top=100,left=100");
}      


function MaakBoxjesEvenHoog(){

	if(document.getElementById('box1')&&document.getElementById('box2')) {
		obj1=document.getElementById('box1');
		obj2=document.getElementById('box2');
		var h12 = obj1.offsetHeight;
		if (obj2.offsetHeight> obj1.offsetHeight) {
		var h12 = obj2.offsetHeight;
		}
	obj1.style.height=h12+'px';
	obj2.style.height=h12+'px';
	}

	if(document.getElementById('box3')&&document.getElementById('box4')) {
		obj3=document.getElementById('box3');
		obj4=document.getElementById('box4');
		var h34 = obj3.offsetHeight;
		if (obj4.offsetHeight> obj3.offsetHeight) {
		var h34 = obj4.offsetHeight;
		}
	obj3.style.height=h34+'px';
	obj4.style.height=h34+'px';
	}
}

addLoadEvent(MaakBoxjesEvenHoog);

