/*  site.js  -  bevat site-specifieke variabelen en functies.
 *  (C) Copyright 2003  Kars Meyboom <kars@kde.nl>
 *
 *  LICENSE:
 * 
 *  This code is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 * 
 *  This code is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

// --
// -- GLOBALS
// --

// maximale lengte voor paginatitels
var maxTitleLength = 45;

// --
// -- FUNCTIES
// --

function standaard_zhl_init () {
	if (document.body.clientWidth > 800) {
		maxTitleLength += ((document.body.clientWidth - 800) / 8);
	}

	init_page_margins();
	fix_title();
}

function fix_title () {
	var h1 = document.getElementById('koptabel').getElementsByTagName('h1')[0];
	var title;

	if (h1.childNodes > 1) {
		// met commentaar
		h1.childNodes[1].nodeValue = snip(h1.childNodes[1].nodeValue, maxTitleLength);
	} else {
		// zonder commentaar (gegenereerde protocollen)
		h1.childNodes[0].nodeValue = snip(h1.childNodes[0].nodeValue, maxTitleLength);
	}

}

var mX = -1;
var mY = -1;

function move_canvas (event) {
	var dx, dy;
	var wx, wy;

	dx = event.clientX - mX;
	dy = event.clientY - mY;

	var win = getTarget(event).parentNode;

	wx = win.offsetLeft;
	wy = win.offsetTop;

	win.style.left = (wx + dx) + 'px';
	win.style.top = (wy + dy) + 'px';

	mX = event.clientX;
	mY = event.clientY;
}


// --
// -- INITIALISATIE
// --

at_init('standaard_zhl_init()');
at_update('update_page_margins()');
at_update('update_arrow()');


