function checkFieldsContactForm(){
    if ((document.getElementById('naam').value != "") && (document.getElementById('email').value != "")) {
        return true;            
    } else {
        alert("Niet alle velden zijn correct ingevuld !");
        return false;
    }
}

function checkFieldsInfoForm(){
    if ((document.getElementById('naam').value != "") && (document.getElementById('email').value != "")) {
        return true;            
    } else {
        alert("Niet alle velden zijn correct ingevuld !");
        return false;
    }
}

function OpenWin(mypage,myname,w,h,features) {
    if(screen.width){
    var winl = (screen.width-w)/2;
    var wint = (screen.height-h)/2;
    }else{winl = 0;wint =0;}
    if (winl < 0) winl = 0;
    if (wint < 0) wint = 0;
    var settings = 'height=' + h + ',';
    settings += 'width=' + w + ',';
    settings += 'top=' + wint + ',';
    settings += 'left=' + winl + ',';
    settings += features;
    win = window.open(mypage,myname,settings);
    win.window.focus();
}      

function checkNieuwsbrief() {
	var sOut = "De volgende velden zijn incorrect:\n";
	var bResult = true;
	if (document.getElementById('email').value == '') {
		sOut += 'E-mail adres\n';
		bResult = false;
	}
	if (!bResult) {
		alert(sOut);
	}
	return bResult;	
}

function changePage() {
	if (self.parent.frames.length != 0) {
		self.parent.location=document.location;
	}
}

function init() {
//		params = 'affid=gh01&c=VRZK_GHD';
	new Ajax.Updater('offertForm', 'public/form.php', {asynchronous: true,evalScripts:true});  
}


function showContact() {
//   new Effect.Fade('dvText', {from: 1, to: 0});
//	  new Effect.SlideUp('dvSlideBlock', {duration: 0.0});
  new Effect.Appear('dvBlock', {from: 0, to: 1});
  new Effect.SlideDown('dvBlock', {duration: 0.8});
}

function hideContact() {
  //new Effect.SlideUp('dvSlideBlock', {duration: 0.0});
 // new Effect.Fade('dvText', {from: 0, to: 1});
  new Effect.SlideUp('dvBlock', {duration: 0.8});
  new Effect.Appear('dvBlock', {from: 1, to: 0});
}        

function showOfferteForm() {
  new Effect.Appear('dvOfferteBlock', {from: 0, to: 1});
  new Effect.SlideDown('dvOfferteBlock', {duration: 0.8});
}

function hideOfferteForm() {
  new Effect.SlideUp('dvOfferteBlock', {duration: 0.8});
  new Effect.Appear('dvOfferteBlock', {from: 1, to: 0});
}        

function OpenWin(mypage,myname,w,h,features) {
	if(screen.width){
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	}else{winl = 0;wint =0;}
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	var settings = 'height=' + h + ',';
	settings += 'width=' + w + ',';
	settings += 'top=' + wint + ',';
	settings += 'left=' + winl + ',';
	settings += features;
	win = window.open(mypage,myname,settings);
	win.window.focus();
}

function logOff() {
document.location='/beheer/index.php?logout=true';
}

var indMenuDown = false;

function dropmenu() {
  document.getElementById('dropdownMenu').style.display='block';
  indMenuDown = false; 
}

function dropmenuUp() {
  if (indMenuDown) {
      document.getElementById('dropdownMenu').style.display='none';
      indMenuDown = false; 
  }
}

function loadFrame() {
	location.href="#top";
}

function checkEmail() {
  var tmp = "";
  var bResult = true;
  
  if (!checkValidEmailAddress("emailadres")) {
    tmp += "Uw E-mailadres is niet correct ingevuld !";
    bResult = false;
  }
  
  if (bResult) {
    return true;
  } else {
    alert(tmp);
    return false;
  }
}

function checkValidEmailAddress(obj) {
	var myEMailIsValid = true;
	var myAtSymbolAt = document.getElementById(obj).value.indexOf('@');
	var myLastDotAt = document.getElementById(obj).value.lastIndexOf('.');
	var mySpaceAt = document.getElementById(obj).value.indexOf(' ');
	var myLength = document.getElementById(obj).length;
	
	if (myAtSymbolAt < 1 ) 
	 {myEMailIsValid = false}
	
	if (myLastDotAt < myAtSymbolAt) 
	 {myEMailIsValid = false}
	
	if (myLength - myLastDotAt <= 2) 
	 {myEMailIsValid = false}
	
	
	// no empty space " " is permitted (one may trim the email)
	// x.y@yell ow.com : NOT valid
	
	if (mySpaceAt != -1) 
	 {myEMailIsValid = false}
	
	
	if (myEMailIsValid == true) {
		document.getElementById(obj).style.backgroundColor = "#FFFFFF";
		return true;
	} else {
    	//alert("email is not correct");
    	document.getElementById(obj).style.backgroundColor = "#FFCCCC";
		//document.getElementById(obj).focus();
		return false;
	}
}
function changePage() {
  if (self.parent.frames.length != 0)
  	self.parent.location=document.location;
}
  
function PrintContent() {
  if(screen.width){
  var winl = (screen.width-600)/2;
  var wint = (screen.height-550)/2;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + 550 + ',';
  settings += 'width=' + 600 + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += "scrollbars=yes";
  win = window.open("print.php","Print",settings);
  win.window.focus();
}

function showPopUp(url) {
  document.getElementById('divPopupBody').innerHTML = '';

  new Effect.Appear('divLoader', {from: 0, to: 1, duration: 0.1});
 	new Ajax.Updater('divPopupBody', url, {asynchronous: true,evalScripts:true});  
}

function closePopUp() {
  document.getElementById('divLoader').style.display='none';
//  new Effect.Appear('divLoader', {from: 1, to: 0, duration: 0.1});
}

