
/*onderstaande functie is nodig omdat internet explorer niet alles snapt van css
  in het bijzonder dingen als hover worden door ie alleen maar bij links gebruikt
	deze functie hangt een klasse naam aan de elementen zodat het alsnog goedkomt
	zie ook de stylesheet menu_stijl.css
	
	deze functie wordt aangeroepen in de onload van iedere pagina*/
	

function header(){
  document.write('<a href="/index.htm"><img src="/images/banner.jpg" alt="Salon Sabijn" border="0" width="900" height="171"></a>');
	window.name="hoofdpagina";
}

function footer(){
  document.write('<div id="footer"><img src="/images/bottom.gif" alt="Salon Sabijn" border="0" width="900" height="39"></div>');
}

/*onderstaande functie is nodig omdat internet explorer niet alles snapt van css
  in het bijzonder dingen als hover worden door ie alleen maar bij links gebruikt
	deze functie hangt een klasse naam aan de elementen zodat het alsnog goedkomt
	zie ook de stylesheet menu_stijl.css
	
	deze functie wordt aangeroepen in de onload van iedere pagina*/
	
function menu_ie(){
  /* currentStyle restricts the Javascript to IE only */
  if (document.all && document.getElementById("nav").currentStyle) {  
  var navroot = document.getElementById("nav");
    /* Get all the list items within the menu */
    var lis=navroot.getElementsByTagName("LI");  
    for (i=0; i<lis.length; i++) {
      /* assign the function to the LI */
      lis[i].onmouseover=function() {		
        this.className+=" over";
	    }
      lis[i].onmouseout=function() {                       
        this.className=this.className.replace(" over", "");
      }
      /* If the LI has another menu level */
      if(lis[i].lastChild.tagName=="UL"){
        /* assign the function to the LI */
        lis[i].onmouseover=function() {		
          /* display the inner menu */
          this.className+=" over";
          this.lastChild.style.display="block";
  	    }
	      lis[i].onmouseout=function() { 
	        /* hide the inner menu */ 
          this.className=this.className.replace(" over", "");                     
          this.lastChild.style.display="none";
	      }
      }
    }
  } 
/*	
	var navroot = document.getElementById("nav");
	var links=navroot.getElementsByTagName("A");
	for (i=0; i<links.length; i++) {
	  links[i].onfocus=function(){
	    this.parentElement.className+=" over";
		}
		links[i].onblur=function(){
	    this.parentElement.className.replace(" over", "");
		}
    if(links[i].parentElement.lastChild.tagName=="UL"){
      links[i].onfocus=function(){
	      this.parentElement.className+=" over";
        this.parentElement.lastChild.style.display="block";
	    }
      links[i].onblur=function(){
	      this.parentElement.className.replace(" over", "");                     
        this.parentElement.lastChild.style.display="none";
     }
    }
	}
	*/
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function verify_nwsbrf_small(f){
   var errors = "";  
   var msg = "";
   //email controleren
   //er moet een @ in voorkomen en op een positie erna een ., dit mag echter niet de laatste positie zijn!
   //dit alles natuurlijk alleen als het veld niet leeg is.
   if ((f.p_email.value == null) || (f.p_email.value == "") ||(f.p_email.value == " ") ||(f.p_email.value == "Uw e-mailadres...")) {
       errors += "\n          " + 'E-mail adres is niet ingevuld';
   }
   else {
      if (f.p_email.value.indexOf('@')==-1 ||
          f.p_email.value.indexOf('@')==0 ||
          f.p_email.value.indexOf('@')==e.value.length -1 ||
          f.p_email.value.indexOf('.',f.p_email.value.length -1)==f.p_email.value.length -1 ||
          f.p_email.value.indexOf('.', f.p_email.value.indexOf('@'))==-1 ||
          f.p_email.value.indexOf('@', f.p_email.value.indexOf('@')+1)>=1 ||
          (f.p_email.value.indexOf('.', f.p_email.value.indexOf('@'))!=-1&&
              f.p_email.value.indexOf('.', f.p_email.value.indexOf('@'))==f.p_email.value.length -1)
           ){
           errors += "\n          " + 'Geen geldig E-mail adres';
	    }
	 }
   if  (!errors) return true;
   msg  = "____________________________________________________\n\n"
   msg += "De gegevens kunnen niet verzonden worden vanwege de volgende fout(en):\n";
   msg += "Corrigeer deze fout(en) alstublieft en druk opnieuw op verzend.\n";
   msg += "____________________________________________________\n\n"
   msg += errors + "\n";
   alert(msg);
   return false;
}


function verwerk_nwsbrf_small(p_email,p_actiecode){
   var xmlHttp
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return false
 }
var url="/pls/db/web_aanmeld_nieuwsbrief_small?p_email="+p_email+"&p_actiecode="+p_actiecode+"&p_ajax=J"
xmlHttp.onreadystatechange=function() 
{ if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  {
    var xmlResponse = xmlHttp.responseText
    if (xmlResponse.indexOf("FOUT:")==-1) {
       document.getElementById("msgNwsbrf").innerHTML= xmlResponse
    }
    else {
       document.getElementById("errNwsbrf").innerHTML= xmlResponse
    }
  } 
 };
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
  
}

