function retrieveCookie( cookieName ) {
	/* retrieved in the format
	cookieName4=value; cookieName3=value; cookieName2=value; cookieName1=value
	only cookies for this domain and path will be retrieved */
	var cookieJar = document.cookie.split( "; " );
	for( var x = 0; x < cookieJar.length; x++ ) {
		var oneCookie = cookieJar[x].split( "=" );
		if( oneCookie[0] == escape( cookieName ) ) { return unescape( oneCookie[1] ); }
	}
	return null;
}

function setCookie( cookieName, cookieValue, lifeTime, path, domain, isSecure ) {
	if( !cookieName ) { return false; }
	if( lifeTime == "delete" ) { lifeTime = -10; } //this is in the past. Expires immediately.
	/* This next line sets the cookie but does not overwrite other cookies.
	syntax: cookieName=cookieValue[;expires=dataAsString[;path=pathAsString[;domain=domainAsString[;secure]]]]
	Because of the way that document.cookie behaves, writing this here is equivalent to writing
	document.cookie = whatIAmWritingNow + "; " + document.cookie; */
	document.cookie = escape( cookieName ) + "=" + escape( cookieValue ) +
		( lifeTime ? ";expires=" + ( new Date( ( new Date() ).getTime() + ( 1000 * lifeTime ) ) ).toGMTString() : "" ) +
		( path ? ";path=" + path : "") + ( domain ? ";domain=" + domain : "") + 
		( isSecure ? ";secure" : "");
	//check if the cookie has been set/deleted as required
	if( lifeTime < 0 ) { if( typeof( retrieveCookie( cookieName ) ) == "string" ) { return false; } return true; }
	if( typeof( retrieveCookie( cookieName ) ) == "string" ) { return true; } return false;
}

function onClose(){
  if(window.screenTop>10000){
    return false
  }
}

function popup(url,options){
  window.open(url,"popup",options)
}
function popup_boventiteling() {
    popup('/popups/boventiteling','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,menubar=no,width=600,height=325')
}
function popup_annuleringsverzekering() {
    popup('/popups/annuleringsverzekering','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,menubar=no,width=600,height=325')
}
function showmenu(menu_id) {
  ie4 = (document.all)? true:false
  mac = (agt.indexOf("mac")!=-1) 
  if (previous_menu != '') {
    if (previous_menu != menu_id) {
      if (ie4 && mac) {
        var menu = document.all[previous_menu];
      } else {
        var menu = document.getElementsByName(previous_menu);
      }
      for (var i=0;i<menu.length;i++) {
        menu[i].style.display = 'none';
      }
    }
  }
  previous_menu = menu_id
  clearTimeout(menu_time_out)
  if (ie4 && mac) {
    var menu = document.all[previous_menu];
  } else {
    var menu = document.getElementsByName(previous_menu);
  }
  for (var i=0;i<menu.length;i++) {
    menu[i].style.left = 224;
    menu[i].style.top = 112;
    if (ie4) {
      menu[i].style.display = '';
    }
    else {
      menu[i].style.display = 'table-row';
    }
  }
}

function hidemenu(menu_id) {
  hide_menu = menu_id
  menu_time_out = setTimeout("hidemenuitems()",500);
}

function hidemenuitems(elmnt) {
  if (ie4 && mac) {
    var menu = document.all[previous_menu];
  } else {
    var menu = document.getElementsByName(previous_menu);
  }
  for (var i=0;i<menu.length;i++) {
    menu[i].style.display = 'none'
  }
}

function getOffsetLeft (el) {
  var ol = el.offsetLeft;
  while ((el = el.offsetParent) != null)
    ol += el.offsetLeft;
  return ol;
}

function switchmenu(show,hide, hide_second) {
  ie4 = (document.all)? true:false
  if (ie4 && mac) {
     var hide_label = document.all['label_' + hide];
     var hide_second_label = document.all['label_' + hide_second];
     var show_label = document.all['label_' + show];
  } else {
    var hide_label = document.getElementsByName('label_' + hide);
    var hide_second_label = document.getElementsByName('label_' + hide_second);
    var show_label = document.getElementsByName('label_' + show);
  }
  for (var i=0;i<hide_label.length;i++) {
    hide_label[i].className = 'big-sub-title';
  }
  for (var i=0;i<hide_second_label.length;i++) {
    hide_second_label[i].className = 'big-sub-title';
  }
  for (var i=0;i<show_label.length;i++) {
    show_label[i].className = 'big-title';
  }
  if (ie4 && mac) {
     var menu = document.all[hide];
     var menu_second = document.all[hide_second];
  } else {
    var menu = document.getElementsByName(hide);
    var menu_second = document.getElementsByName(hide_second);
  }
  for (var i=0;i<menu.length;i++) {
    menu[i].style.display = 'none';
  }
  for (var i=0;i<menu_second.length;i++) {
    menu_second[i].style.display = 'none';
  }
  if (ie4 && mac) {
    var show_items = document.all[show];
  } else {
    var show_items = document.getElementsByName(show);
  }
  for (var i=0;i<show_items.length;i++) {
    if (ie4) {
      show_items[i].style.display = '';
    }
    else {
      show_items[i].style.display = 'table-row';
    }
  }
}


