/* 
  ------------------------------------
  PVII Menu CSS Express Drop-Down Menu
  by Project Seven Development
  www.projectseven.com
  ------------------------------------
*/
function P7_ExpMenu(){ //v1.1.0.2 by PVII-www.projectseven.com
 if(navigator.appVersion.indexOf("MSIE")==-1){return;}
 var i,k,g,lg,r=/\s*p7hvr/,nn='',c,cs='p7hvr',bv='p7menubar';
 for(i=0;i<10;i++){g=document.getElementById(bv+nn);if(g){
 lg=g.getElementsByTagName("LI");if(lg){for(k=0;k<lg.length;k++){
 lg[k].onmouseover=function(){c=this.className;cl=(c)?c+' '+cs:cs;
 this.className=cl;};lg[k].onmouseout=function(){c=this.className;
 this.className=(c)?c.replace(r,''):'';};}}}nn=i+1;}
}

// Checks if a string is empty
function emptystr(string) {
	var x = 0;
	var chr;
	var empty = true;
	if (string.length) {
		do {
			chr = string.substring(x, x + 1);
			x++;
			empty = (chr == ' ' || chr == '\t' || chr == '\n' || chr == '\r');
		} while (empty && x < string.length);
	}
	return empty;
}

function checkGetal(item, name){
  if (isNaN(document.subform.elements[item].value)){
	  alert(name + ' moet een nummer zijn!');
    document.subform.elements[item].focus();
    return false;
  }
  else{
    return true;
  }
}

function showAlert(item, name){
  if (emptystr(document.subform.elements[item].value)){
    alert('U heeft ' + name + ' vergeten in te voeren!');
    document.subform.elements[item].focus();
    return false;
  }
  else{
    return true;
  }
}

function checkEmail(item){
  var pattern=/(^[\-_\.a-zA-Z0-9]+)@((([0-9]{1,3}\.){3}([0-9]{1,3})((:[0-9])*))|(([a-zA-Z0-9\-]+)(\.[a-zA-Z]{2,})+(\.[a-zA-Z]{2})?((:[0-9])*)))/;
  
  if (document.subform.elements[item].value.search(pattern) == -1){
    alert('Het e-mailadres is onjuist!');
    document.subform.elements[item].focus();
    return false;
  }
  else{
    return true;
  }
}

function addSubject() {
    return (showAlert('subject', 'het onderwerp') && showAlert('user', 'de naam') && checkEmail('email') && showAlert('content', 'het bericht')); 
}

function addPost() {
    return (showAlert('user', 'de naam') && checkEmail('email') && showAlert('content', 'het bericht')); 
}

function addNewsletterMember() {
    return (showAlert('lastname', 'de achternaam') && showAlert('firstname', 'de voornaam') && checkEmail('email'));
}

function removeNewsletterMember() {
    return checkEmail('email');
}

function searchRelation() {
    return (showAlert('search_string', 'de zoekopdracht'));
}

function windowOpen(name,url,Hoogte,Breedte) {
  LeftPosition = (screen.width) ? (screen.width-Breedte)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-Hoogte)/2 : 0;
  settings ='height='+Hoogte+',width='+Breedte+',top='+TopPosition+',left='+LeftPosition+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes'
  window_open = window.open(url,name, settings);
  window_open.focus();
}

function selectListboxItem ( theListbox, theItem ) {
	theOptions = theListbox.options;
	for(i=0; i<theOptions.length; i++) {
		theOptions[i].selected = theOptions[i].value == theItem;
	}
}

function printFrame(frame_name){ 
  if(typeof window.print == "undefined"){ 
    alert("Uw browser ondersteund dit niet!"); 
  }else{ 
    parent.frames[frame_name].focus(); 
    parent.frames[frame_name].window.print();  
  } 
} 

function form_setfocus( aForm ) {
	if( aForm.elements[0]!=null) {
		var i;
		var max = aForm.length;
		for( i = 0; i < max; i++ ) {
			if( aForm.elements[ i ].type != "hidden" &&
				!aForm.elements[ i ].disabled &&
				!aForm.elements[ i ].readOnly ) {
				aForm.elements[ i ].focus();
				break;
			}
		}
	}
}

imgFadeObjects = new Object();
imgFadeTimers = new Object();

function imgFade(object, naarDoorzichtigheid, snelheid, aantalStappen) {


	if (!document.all) {
		return;
	}

	if (object != "[object]") {
		setTimeout("imgFade("+object+","+naarDoorzichtigheid+","+snelheid+","+aantalStappen+")",0);
		return;
	}

	clearTimeout(imgFadeTimers[object.sourceIndex]);

	diff = naarDoorzichtigheid-object.filters.alpha.opacity;
	direction = 1;
	if (object.filters.alpha.opacity > naarDoorzichtigheid) {
		direction = -1;
	}

	aantalStappen = Math.min(direction*diff,aantalStappen);
	object.filters.alpha.opacity+=direction*aantalStappen;

	if (object.filters.alpha.opacity != naarDoorzichtigheid) {
		imgFadeObjects[object.sourceIndex] = object;
		imgFadeTimers[object.sourceIndex] = setTimeout("imgFade(imgFadeObjects["+object.sourceIndex+"],"+naarDoorzichtigheid+","+snelheid+","+aantalStappen+")",snelheid);
	}
}

// this is a dummy function. Every module can override this function for initialisation
function init() {
	null;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=lib_bwcheck()

/***************************************************************************************
Variables to set:
***************************************************************************************/
messages=new Array()
//Write your descriptions in here.
messages[0] = "Terug naar de startpagina"
messages[1] = "Bezoek de ANVR website"
messages[2] = "Bezoek de IATA website"
messages[3] = "Bezoek de SGR website"
messages[4] = "Bezoek de Calamiteitenfonds website"
messages[5] = "Welkom op de website van Reisburo Paul Crombag"
messages[6] = "Klik hier om naar de rekenmodule te gaan"
messages[7] = "Klik hier om terug naar de homepage te gaan"
//To have more descriptions just add to the array.

fromX = 20 //How much from the actual mouse X should the description box appear?
fromY = -10 //How much from the actual mouse Y should the description box appear?

//To set the font size, font type, border color or remove the border or whatever,
//change the clDescription class in the stylesheet.

//Makes crossbrowser object.
function makeObj(obj){								
   	this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
	if(!this.evnt) return false
	this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;	
   	this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;		
	this.writeIt=b_writeIt;																
	return this
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function b_writeIt(text){
	if (bw.ns4){this.wref.write(text);this.wref.close()}
	else this.wref.innerHTML = text
}

//Capturing mousemove
var descx = 0
var descy = 0
function popmousemove(e){descx=bw.ns4||bw.ns6?e.pageX:event.x; descy=bw.ns4||bw.ns6?e.pageY:event.y}

var oDesc;
//Shows the messages
function popup(num){
    if(oDesc){
		oDesc.writeIt('<div class="clDescription">'+messages[num]+'</div>')
		if(bw.ie5||bw.ie6) descy = descy+document.body.scrollTop
		oDesc.css.left = (descx+fromX)+px
		oDesc.css.top = (descy+fromY)+px
		oDesc.css.visibility = "visible"
    }
}

//Hides it
function popout(){
	if(oDesc) oDesc.css.visibility = "hidden"
}

function setPopup(){
   	if(bw.ns4)document.captureEvents(Event.MOUSEMOVE)
    document.onmousemove = popmousemove;
	oDesc = new makeObj('divDescription')
}

function boekReis1(){
  return (showAlert('aanhef', 'aanhef') && showAlert('naamb', 'naam') && showAlert('voorlettersb', 'voorletters') && showAlert('adres', 'adres') && showAlert('postcode', 'postcode') && showAlert('woonplaats', 'woonplaats') && showAlert('tel', 'tel') && showAlert('personen', 'aantal reizigers'));
}

function boekReis2(){
	var naam = "";
	for (var i=0, j=reizigerform.elements.length; i<j; i++)
	{
		if((reizigerform.elements[i].type == "text") && (reizigerform.elements[i].value==""))
			if(reizigerform.elements[i].name == "naam[]")
			  naam = "namen";
			else if(reizigerform.elements[i].name == "voorletters[]")
			  naam = "voorletters";
	}
	if(naam != "")
	{
		alert("U moet alle " +naam+ " invullen.");
		return false;
	}
	else
	  return true;
}

function verstuurContact(){
  return (showAlert('naam', 'naam') && showConfirmation('contactformulier', 'versturen'));
}
