// Global vars
var spd = 10;		// Slide speed of the menu
var max = 80;		// Top value of tip when minimized (mouseout)
var min = 10;		// Top value of tip when maximized (mouseover)
var tim = null;		// Var user for setTimout function

var ie5 = (document.getElementById && document.all);
var ns6 = (document.getElementById && !document.all);

function init_shortcut() {
    var shortlist = document.getElementById('shortlist');
    shortlist.style.top = "20px";
    shortlist.style.left = (ns6) ? "-88px" : "-75px";
    shortlist.style.width = "170px";
    shortlist.style.height = "210px";
    shortlist.style.display = "none";

    var shadow = document.getElementById('shadow');
    shadow.style.top = (parseInt( shortlist.style.top ) + 3)+"px";
    shadow.style.left = (parseInt( shortlist.style.left ) + 3)+"px";
    shadow.style.height = (ns6) ? (parseInt( shortlist.style.height ) + 13)+"px" : parseInt( shortlist.style.height );
    shadow.style.width = (ns6) ? (parseInt( shortlist.style.width ) + 13)+"px" : parseInt( shortlist.style.width );
    shadow.style.display = "none";
}


function init() {
    var div = document.getElementsByTagName("div");

    for(var i=0; i<div.length ;i++) {
        if( div[i].className == "tip" ) {
            div[i].style.top = "80px";
            div[i].style.height = "1px";
        }
    }
}

function quicknav() {
    document.getElementById('shortlist').style.display = ( document.getElementById('shortlist').style.display == "block") ? "none":"block";
    document.getElementById('shadow').style.display = ( document.getElementById('shadow').style.display == "block") ? "none":"block";
}


function slide(obj, dir) {
    var el = document.getElementById(obj);
    clearTimeout(el.tim);
    var t = parseInt(el.style.top);
    var h = parseInt(el.style.height);

    if (dir) {
        if (t>min) {
            el.style.top = t-spd+'px';
            el.style.height = h+spd+'px';
            el.tim=setTimeout("slide('"+obj+"', 1)",1);
        } else {
            el.style.top = min+'px';
            el.style.height = h+'px';
        }
    } else {
        if (t<max) {
            el.style.top = t+spd+'px';
            el.style.height = h-spd+'px';
            el.tim=setTimeout("slide('"+obj+"')",1);
        } else {
            el.style.top = max+'px';
            el.style.height = '1px';
        }
    }
}

function pop(doc, width, height, x, y) {
    newpop = window.open(doc, "", "width="+width+",height="+height+", toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,zoombox=no,left="+x+",top="+y);
    newpop.focus();
}

function popUpCenter(url, width, height, scrollBar, position) {
    var marginLeft=0;
    var marginTop=20;
    if(position=="center") {
        marginLeft=(screen.width) ? (screen.width-width)/2 : 100;
        marginTop=(screen.height) ? (screen.height-height)/2 : 100;
    }
    newpop = window.open(url, "", "width="+width+",height="+height+", toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars="+scrollBar+",resizable=no,zoombox=no,left="+marginLeft+",top="+marginTop);
    newpop.focus();
}

function mailtop(what){
  var a,b,c,d,e,f,g,h,i
  a='<a class="addnav" href=\"mai'
  b='info'
  c='\">'
  a+='lto:'
  b+='@'
  e='</a>'
  b+='brandweer-tytsjerksteradiel.nl'
  f=b
  g='<img src=\"'
  h=''
  i='\" alt="E-mai" border="0">'
  if (f) d=f
  else if (h) d=g+h+i
  else d=b
  d=what
  document.write(a+b+c+d+e)
}

function mailtext(what){
  var a,b,c,d,e,f,g,h,i
  a='<a href=\"mai'
  b='info'
  c='\">'
  a+='lto:'
  b+='@'
  e='</a>'
  b+='brandweer-tytsjerksteradiel.nl'
  f=b
  g='<img src=\"'
  h=''
  i='\" alt="E-mai" border="0">'
  if (f) d=f
  else if (h) d=g+h+i
  else d=b
  d=what
  document.write(a+b+c+d+e)
}

function mailfooter(){
  var a,b,c,d,e,f,g,h,i
  a='<a class="funmenu" href=\"mai'
  b='info'
  c='\">'
  a+='lto:'
  b+='@'
  e='</a>'
  b+='brandweer-tytsjerksteradiel.nl'
  f=b
  g='<img src=\"'
  h=''
  i='\" alt="E-mai" border="0">'
  if (f) d=f
  else if (h) d=g+h+i
  else d=b
  d='Contact'
  document.write(a+b+c+d+e)
}


// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id) {
	var el = document.getElementById(id);
	if (calendar != null) {
		// we already have one created, so just update it.
		calendar.hide();		// hide the existing calendar
		calendar.parseDate(el.value); // set it to a new date
	} else {
		// first-time call, create the calendar
		var cal = new Calendar(true, null, selected, closeHandler);
		calendar = cal;		// remember the calendar in the global
		cal.setRange(1900, 2070);	// min/max year allowed
		calendar.create();		// create a popup calendar
	}
	calendar.sel = el;		// inform it about the input field in use
	calendar.showAtElement(el);	// show the calendar next to the input field
	// catch mousedown on the document
	Calendar.addEvent(document, "mousedown", checkCalendar);
	return false;
} 


// JS Calendar
var calendar = null; // remember the calendar object so that we reuse
// it and avoid creating another 


// This function gets called when an end-user clicks on some date
function selected(cal, date) {
	cal.sel.value = date; // just update the value of the input field
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks the "Close" (X) button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
	cal.hide();			// hide the calendar

	// don't check mousedown on document anymore (used to be able to hide the
	// calendar when someone clicks outside it, see the showCalendar function).
	Calendar.removeEvent(document, "mousedown", checkCalendar);
}

// This gets called when the user presses a mouse button anywhere in the
// document, if the calendar is shown.  If the click was outside the open
// calendar this function closes it.
function checkCalendar(ev) {
	var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
	for (; el != null; el = el.parentNode)
	// FIXME: allow end-user to click some link without closing the
	// calendar.  Good to see real-time stylesheet change :)
	if (el == calendar.element || el.tagName == "A") break;
	if (el == null) {
		// calls closeHandler which should hide the calendar.
		calendar.callCloseHandler(); Calendar.stopEvent(ev);
	}
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id) {
	var el = document.getElementById(id);
	if (calendar != null) {
		// we already have one created, so just update it.
		calendar.hide();		// hide the existing calendar
		calendar.parseDate(el.value); // set it to a new date
	} else {
		// first-time call, create the calendar
		var cal = new Calendar(true, null, selected, closeHandler);
		calendar = cal;		// remember the calendar in the global
		cal.setRange(1900, 2070);	// min/max year allowed
		calendar.create();		// create a popup calendar
	}
	calendar.sel = el;		// inform it about the input field in use
	calendar.showAtElement(el);	// show the calendar next to the input field

	// catch mousedown on the document
	Calendar.addEvent(document, "mousedown", checkCalendar);
	return false;
}

function cklappen( div ) {
	var code = document.getElementById('code_'+div).style;
	
	if( code.display == 'none' )
	{
		code.display		= 'block';
	}
	else
	{
		code.display		= 'none';
	}
}


