var tmptimertest = 0;
var tmptimerrunning = false;

function doublechange(link1,link2){
	parent.content.content2.location=link2;
	parent.content.subnav.location=link1;
}

function show_holi(id, sid){
	selectorUrl = "urlaub.php?action=details&uid="+id+"&"+sid;
	selector = open(selectorUrl,"selectorWindow","width=450,height=450,screenX=0,screenY=0");
	selector.focus();
}

function new_project(sid){
	altFenster = this; 
	selectorUrl = "index.php?action=new_project&"+sid;
	selector=open(selectorUrl,"selectorWindow","width=500,height=500,screenX=0,screenY=0,resizable=YES,dependent=yes");
	selector.focus();
} 

function project_close(){
	self.close();
	altFenster.focus();
}

function MoveOption (MoveFrom, MoveTo, FormId) {
	//tested on:
	// - Win2k: MSIE5.5, MSIE6, NN6.2.1, NN6.2.2
	// - Mac: NN4.7/MacOS9.0.4 and MSIE5/MacOS9.0.4
	// - others: Mozilla0.9.8/FreeBSD4.5, Mozilla snapshot 2002040410 on Linux 2.4.18 
	
	var name;
	var ID;
	var i;
	var SelectFrom = eval('window.document.nd.elements[\"'+MoveFrom+'[]\"]');	
	var SelectTo = eval('window.document.nd.elements[\"'+MoveTo+'[]\"]');
	var SelectedIndex = SelectFrom.options.selectedIndex;
	
	if (SelectedIndex == -1) {
		alert(err_no_person);
	}
	else {
		for (i=0; i<SelectFrom.options.length; i++) {
			if(SelectFrom.options[i].selected) {
				name = SelectFrom.options[i].text;
				ID = SelectFrom.options[i].value;
				SelectFrom.options[i] = null;
				SelectTo.options[SelectTo.options.length]=new Option (name,ID);
				i--;
			}
		}
		
		//begin of sorting stuff, it could be very slooow
		//needs JS1.1 and higher
		var sorting = new Array();		
		for (i=0; i<SelectTo.options.length; i++) {
			sorting[i] = SelectTo.options[i].text+"###"+SelectTo.options[i].value;
		}
		sorted = sorting.sort();
		for (i=0; i<SelectTo.options.length; i++) {
			var tmp = sorted[i].split("###");
			name = tmp[0];
			ID = tmp[1];
			SelectTo.options[i]=new Option (name,ID);
		}
		// end of sorting stuff
	}
	
	return;
}

function MoveOption3 (MoveFrom, MoveTo) {
	//tested on:
	// - Win2k: MSIE5.5, MSIE6, NN6.2.1, NN6.2.2
	// - Mac: NN4.7/MacOS9.0.4 and MSIE5/MacOS9.0.4
	// - others: Mozilla0.9.8/FreeBSD4.5, Mozilla snapshot 2002040410 on Linux 2.4.18 
	
	var name;
	var ID;
	var i;
	var SelectFrom = eval('window.document.f1.elements[\"'+MoveFrom+'[]\"]');	
	var SelectTo = eval('window.document.f1.elements[\"'+MoveTo+'[]\"]');
	var SelectedIndex = SelectFrom.options.selectedIndex;
	
	if (SelectedIndex == -1) {
		alert(err_no_person);
	} else {
		for (i=0; i<SelectFrom.options.length; i++) {
			if(SelectFrom.options[i].selected) {
				name = SelectFrom.options[i].text;
				ID = SelectFrom.options[i].value;
				SelectFrom.options[i] = null;
				SelectTo.options[SelectTo.options.length]=new Option (name,ID);
				i--;
			}
		}
		
		if (MoveTo == 'att') {
			//begin of sorting stuff, it could be very slooow
			//needs JS1.1 and higher
			var sorting = new Array();		
			for (i=0; i<SelectTo.options.length; i++) {
				sorting[i] = SelectTo.options[i].text+"###"+SelectTo.options[i].value;
			}
			sorted = sorting.sort();
			for (i=0; i<SelectTo.options.length; i++) {
				var tmp = sorted[i].split("###");
				name = tmp[0];
				ID = tmp[1];
				SelectTo.options[i]=new Option (name,ID);
			}
			// end of sorting stuff
		}
	}
	
	return;
}

function addLocationcrm(id,location,type){
	opener.document.f1.locationid.value = id;
	opener.document.f1.location.value = location;
	window.close();
}
function addLocationshipping(id,location,type){
	opener.document.f1.ship_carrier_lynxid.value = id;
	opener.document.f1.location.value = location;
	window.close();
}
function selComp(id,location){
	opener.document.f1.locationid.value = id;
	opener.document.f1.location.value = location;
	window.close();
}
function selComp2(id,location){
	opener.document.f1.locationid2.value = id;
	opener.document.f1.location2.value = location;
	
	var S = opener.document.getElementById("oc");
	var L = S.options.length;
	
	S.options.selectedIndex = (S.options.length - 1);
	window.opener.Insert(id);
	window.close();
}

function selComp3(id,location){

}

function addShipLocation(id,location,type,subid,subloc){
	opener.document.nd.locationid.value = id;
	opener.document.nd.location.value = location;
	opener.document.nd.locationtype.value = type;
	opener.document.nd.shipid.value = subid;
	opener.document.nd.shiploc.value = subloc;
	window.close();
}
function addShipLocation2(id,location,type,subid,subloc){
	opener.document.nd.locationintid.value = id;
	opener.document.nd.locationint.value = location;
	opener.document.nd.locationinttype.value = type;
	opener.document.nd.shipintid.value = subid;
	opener.document.nd.shipintloc.value = subloc;
	window.close();
}

function changecust(rooturl,mod) {
	var url = rooturl + "/modules/general/companies.php?funk=changecust&mod="+ mod +"&search=true";
	window.open(url,"companies","width=700,height=300,resizable=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,scrollbars=yes,status=no,toolbar=no,history=no");
}

function addcust(id,location,type){
	opener.document.ae.compid.value = id;
	opener.document.ae.disp1.value = location;
	window.close();
}
function changefakt(rooturl,mod) {
  var url = rooturl + "/modules/general/companies.php?funk=changefakt&mod="+ mod +"&search=true";
  window.open(url,"companies","width=700,height=300,resizable=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,scrollbars=yes,status=no,toolbar=no,history=no");
}
function addfakt(id,location,type){
	opener.document.ae.faktid.value = id;
	opener.document.ae.disp2.value = location;
	window.close();
}

function deletefakt(){
	document.ae.faktid.value = "";
	document.ae.disp2.value = "";
}

/*einde ontwikkeling*/



function close_project(sid){
	alert("Variable temp"+temp);
	alt.focus();
	alt.name = "";
}

var clockID = 0;
var clock = false;

function writeMailFunc(type,sessie,email,conid,contype,explicit,popupwin) {
	if(type){
		if(popupwin == 'true') {
			webmailpopup('../webmail2/index3.php?email=' + email + '&cont_id=' + conid + '&cont_type=' + contype + '&PHPSESSID=' + sessie);
		}
		else {
			url = '../webmail2/index3.php?email=' + email + '&cont_id=' + conid + '&cont_type=' + contype + '&PHPSESSID=' + sessie;
			document.location = url;
		}
	}
	else {
		if(explicit == '1') {
			popupurl = '../general/makemail.php?email=' + email + '&cont_id=' + conid + '&cont_type=' + contype + '&PHPSESSID=' + sessie;
			window.open(popupurl,'reminder','width=700,height=500,top=20,left=20,menubars=no,alwaysRaised=yes,resizable=no,scrollbars=no,titlebar=no,toolbar=no,locationbar=no');
		}
		else {
			document.location = "mailto:" + email;
		}
	}
}

function dialdocs(dialnr,sessie, contact, type,commtype, importtable) {
	var wid = screen.width;
	var hei = screen.height;
	
	var yes = 1;
	var no  = 0;
	
	var ext = document.ext.extension_field_temp.value;
	
	var menubar     = no;      // The File, Edit, View Menus
	var scrollbars  = yes;   // Horizontal and vertical scrollbars
	var locationbar = no;  // The location box with the site URL
	var directories = no;  // the "What's New", "What Cool" links
	var resizable   = no;    // Can the window be resized?
	var statusbar   = yes;    // Status bar (with "Document: Done")
	var toolbar     = no;      // Back, Forward, Home, Stop toolbar
	
	windowprops = "height=450,width=700,top=200,left=200";
	windowprops += 	(menubar ? ",menubars" : "") +
					(scrollbars ? ",scrollbars" : "") +
					(locationbar ? ",location" : "") +
					(directories ? ",directories" : "") +
					(resizable ? ",resizable" : "") +
					(statusbar ? ",status" : "") +
					(toolbar ? ",toolbar" : "");
	
	var url = "../contact/dial.php?dialnr=" + dialnr + "&extension=" + ext + "&contact=" + contact + "&type=" + type + "&commtype=" + commtype + "&importtable=" + importtable + "&PHPSESSID=" + sessie;
	//document.getElementById('dummytelframe').src = url;
	window03 = window.open(url,'document',windowprops);
}

function dial(dialnr,sessie, contact, type,commtype) {
	var wid = screen.width;
	var hei = screen.height;
	
	var yes = 1;
	var no  = 0;
	
	var ext = top.document.getElementsByName("extension_field_temp")[0].value;
	
	
	var menubar     = no;      // The File, Edit, View Menus
	var scrollbars  = yes;   // Horizontal and vertical scrollbars
	var locationbar = no;  // The location box with the site URL
	var directories = no;  // the "What's New", "What Cool" links
	var resizable   = no;    // Can the window be resized?
	var statusbar   = yes;    // Status bar (with "Document: Done")
	var toolbar     = no;      // Back, Forward, Home, Stop toolbar
	
	windowprops = "height=450,width=700,top=200,left=200";
	windowprops += 	(menubar ? ",menubars" : "") +
					(scrollbars ? ",scrollbars" : "") +
					(locationbar ? ",location" : "") +
					(directories ? ",directories" : "") +
					(resizable ? ",resizable" : "") +
					(statusbar ? ",status" : "") +
					(toolbar ? ",toolbar" : "");
	
	var url = "../contact/dial.php?dialnr=" + dialnr + "&extension=" + ext + "&contact=" + contact + "&type=" + type + "&commtype=" + commtype + "&importtable=0&PHPSESSID=" + sessie;	
	//document.getElementById('dummytelframe').src = url;
	window03 = window.open(url,'document',windowprops);
}

function dial2(dialnr,sessie, contact, type) {
	var wid = screen.width;
	var hei = screen.height;
	
	var yes = 1;
	var no  = 0;
	
	var ext = parent.document.ext.extension_field_temp.value;
	
	var menubar     = no;      // The File, Edit, View Menus
	var scrollbars  = yes;   // Horizontal and vertical scrollbars
	var locationbar = no;  // The location box with the site URL
	var directories = no;  // the "What's New", "What Cool" links
	var resizable   = no;    // Can the window be resized?
	var statusbar   = yes;    // Status bar (with "Document: Done")
	var toolbar     = no;      // Back, Forward, Home, Stop toolbar
	
	windowprops = "height=450,width=700,top=200,left=200";
	windowprops += 	(menubar ? ",menubars" : "") +
					(scrollbars ? ",scrollbars" : "") +
					(locationbar ? ",location" : "") +
					(directories ? ",directories" : "") +
					(resizable ? ",resizable" : "") +
					(statusbar ? ",status" : "") +
					(toolbar ? ",toolbar" : "");
	
	var url = "../contact/dial.php?dialnr=" + dialnr + "&extension=" + ext + "&contact=" + contact + "&type=" + type + "&PHPSESSID=" + sessie;
	//document.getElementById('dummytelframe').src = url;
	window03 = window.open(url,'document',windowprops);
}

/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2003-4 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

/*
  dw_lib.js - used with dw_glide.js, dw_glider.js, ...
  version date July 2004 
*/
var slidedOut = false;
var slidedIn = true;
dynObj.holder = {}; 
// constructor
function dynObj(id,x,y,w,h) {
	var el = dynObj.getElemRef(id);
	if (!el) return;  this.id = id; 
	dynObj.holder[this.id] = this; this.animString = "dynObj.holder." + this.id;
	var px = window.opera? 0: "px";
	this.x = x || 0;	if (x) el.style.top = this.x + px;
	this.y = y || 0;	if (y) el.style.top = this.y + px;
	this.w = w || el.offsetWidth || 0;	this.h = h || el.offsetHeight || 0;
	// if w/h passed, set style width/height
	if (w) el.style.width = w + px; if (h) el.style.height = h + px;
}

dynObj.getElemRef = function(id) { 
	var el = document.getElementById? document.getElementById(id): null;
	return el;
} 

dynObj.getInstance = function(id) {
	var obj = dynObj.holder[id];
	if (!obj) obj = new dynObj(id);
	else if (!obj.el) obj.el = dynObj.getElemRef(id);
	return obj;
}

dynObj.prototype.shiftTo = function(x,y) {
	var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
	if (el) {
		if (x != null) el.style.top = (this.x = x) + "px";
		//if (y != null) el.style.top =  el.style.top;
	}
}

dynObj.prototype.shiftBy = function(x,y) { this.shiftTo(this.x+x, this.y+y); }

dynObj.prototype.show = function() { 
	var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
	if (el) el.style.visibility = "visible"; 
}
dynObj.prototype.hide = function() { 
	var el = this.el? this.el: dynObj.getElemRef(this.id)? dynObj.getElemRef(this.id): null;
	if (el) el.style.visibility = "hidden"; 
}


// for time-based animations
// resources: www.13thparallel.org and www.youngpup.net (accelimation)
var dw_Bezier = {
	B1: function (t) { return t*t*t },
	B2: function (t) { return 3*t*t*(1-t) },
	B3: function (t) { return 3*t*(1-t)*(1-t) },
	B4: function (t) { return (1-t)*(1-t)*(1-t) },
	// returns current value based on percentage of time passed
	getValue: function (percent,startVal,endVal,c1,c2) {
		return endVal * this.B1(percent) + c2 * this.B2(percent) + c1 * this.B3(percent) + startVal * this.B4(percent);
	}
}

// adapted from accelimation.js by Aaron Boodman of www.youngpup.net
dw_Animation = {
	instances: [],
	add: function(fp) {
		this.instances[this.instances.length] = fp;
		if (this.instances.length == 1) this.timerID = window.setInterval("dw_Animation.control()", 10);
	},
	
	remove: function(fp) {
		for (var i = 0; this.instances[i]; i++) {
			if (fp == this.instances[i]) {
				this.instances = this.instances.slice(0,i).concat( this.instances.slice(i+1) );
				break;
			}
		}
		if (this.instances.length == 0) {
			window.clearInterval(this.timerID);	this.timerID = null;
		}
	},
	
	control: function() {
		for (var i = 0; this.instances[i]; i++) {
			if (typeof this.instances[i] == "function" ) this.instances[i]();
			else eval(this.instances[i]);
		}
	}
}

/*************************************************************************
  This code is from Dynamic Web Coding at www.dyn-web.com
  Copyright 2003-4 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

/*
  dw_glide.js - requires dw_lib.js
  version date July 2004 
*/

// acc is number between -1 and 1 ( -1 full decelerated, 1 full accelerated, 0 linear, i.e. no acceleration)
dynObj.prototype.slideTo = function (destX,destY,slideDur,acc,endFn) {
  if (!document.getElementById) return;
  this.slideDur = slideDur || .0001; var acc = -acc || 0;
  if (endFn) this.onSlideEnd = endFn;
  // hold destination values (check for movement on 1 axis only)
 	if (destX == null) this.destX = this.x;	else this.destX = destX;
  if (destY == null) this.destY = this.y; else this.destY = destY;
  this.startX = this.x; this.startY = this.y;
	this.st = new Date().getTime();
	// control points for bezier-controlled slide (see www.youngpup.net accelimation)
  this.xc1 = this.x + ( (1+acc) * (this.destX-this.x)/3 );
	this.xc2 = this.x + ( (2+acc) * (this.destX-this.x)/3 );
  this.yc1 = this.y + ( (1+acc) * (this.destY-this.y)/3 );
	this.yc2 = this.y + ( (2+acc) * (this.destY-this.y)/3 );
	this.sliding = true;
  this.onSlideStart();
  dw_Animation.add(this.animString + ".doSlide()");
}

dynObj.prototype.doSlide = function() {
	if (!this.sliding) return;	
	var elapsed = new Date().getTime() - this.st;
	if (elapsed < this.slideDur) {
    var x = dw_Bezier.getValue(elapsed/this.slideDur, this.startX, this.destX, this.xc1, this.xc2);
    var y = dw_Bezier.getValue(elapsed/this.slideDur, this.startY, this.destY, this.yc1, this.yc2);
		this.shiftTo( Math.round(x) ,Math.round(y) );
		this.onSlide();
	} else {	// if time's up
    dw_Animation.remove(this.animString + ".doSlide()");
		this.shiftTo(this.destX,this.destY);
		this.onSlide();
		this.sliding = false;
		this.onSlideEnd();
	}
}

dynObj.prototype.slideBy = function(dx,dy,slideDur,acc,endFn) {
	var destX=this.x+dx; var destY=this.y+dy;
	this.slideTo(destX,destY,slideDur,acc,endFn);
}

dynObj.prototype.onSlideStart = function () {}
dynObj.prototype.onSlide = function () {}
dynObj.prototype.onSlideEnd = function () { if (this.el) this.el = null; }

/*
		dw_glider.js - requires dw_lib.js
		glide to maintain window location on scroll
		version date: September 2003 

		This code is from Dynamic Web Coding at www.dyn-web.com
    See Terms of Use at http://www.dyn-web.com/bus/terms.html
    Permission granted to use this code 
    as long as this entire notice is included.	
    
    Resources: ypChaser by Aaron Boodman (www.youngpup.net)
    DHTML chaser tutorial at DHTML Lab - www.webreference.com/dhtml		
*/

Glider.holder = [];
function Glider(id,x,y,w,h,d,ac) {
	this.glideDur = d || 1000; this.origX = x; this.origY = y; this.ac = -ac || 0;
	this.baseObj = dynObj;
	this.baseObj(id,x,y,w,h);
  Glider.holder[Glider.holder.length] = this;
  if (!Glider.winHt) Glider.winHt = getWinHeight();
}
Glider.prototype = new dynObj;
Glider.prototype.onGlideInit = function () {}

Glider.prototype.checkGlider = function() {
	var destY = getScrollY() + this.origY;
	if (destY != this.y) {
		if (destY != this.dy) {
			this.dy = destY;
			this.glideInit();
      this.onGlideInit();
		} 
		this.glide();
	}
}

Glider.prototype.glideInit = function() {
	this.gt = new Date().getTime();
	var distY = this.dy - this.y;
	if ( Math.abs(distY) > Glider.winHt ) {	// distance greater than window height?
		this.gsy = (distY > 0)? this.dy - Glider.winHt: this.dy + Glider.winHt;
	} else this.gsy = this.y;
  this.g_yc1 = this.gsy + ( (1+this.ac) * (this.dy - this.gsy)/3 );
	this.g_yc2 = this.gsy + ( (2+this.ac) * (this.dy - this.gsy)/3 );
}

Glider.prototype.glide = function() {
	var elapsed = new Date().getTime() - this.gt;
  if (elapsed < this.glideDur) {
    var y = dw_Bezier.getValue( elapsed/this.glideDur, this.gsy, this.dy, this.g_yc1, this.g_yc2 );
    this.shiftTo(null,y);
  } else this.shiftTo(null,this.dy);
}

Glider.control = function() {
  for (var i=0; Glider.holder[i]; i++) {
    var curObj = Glider.holder[i];
    //if (curObj) curObj.checkGlider();
  }
}
//Glider.timer = setInterval("Glider.control()",20);
dw_Animation.add(Glider.control);

// returns height of window
function getWinHeight() {
	var winHt = 0;
	if (window.innerHeight) winHt = window.innerHeight;
	else if (document.documentElement && document.documentElement.clientHeight) 
		winHt = document.documentElement.clientHeight;
	else if (document.body && document.body.clientHeight) 
		winHt = document.body.clientHeight;
	return winHt;
}	

// Geeft breedte
function getWinWidth() {
	var winWt = 0;
	if (window.innerWidth) winWt = window.innerWidth;
	else if (document.documentElement && document.documentElement.clientWidth) 
		winWt = document.documentElement.clientWidth;
	else if (document.body && document.body.clientWidth) 
		winWt = document.body.clientWidth;
	return winWt;
}	

// returns amount of vertical scroll
function getScrollY() {
	var sy = 0;
	if (document.documentElement && document.documentElement.scrollTop)
		sy = document.documentElement.scrollTop;
	else if (document.body && document.body.scrollTop) 
		sy = document.body.scrollTop; 
	else if (window.pageYOffset)
		sy = window.pageYOffset;
	else if (window.scrollY)
		sy = window.scrollY;
	return sy;
}

// onresize, get window height
//if (window.addEventListener)
  //window.addEventListener("resize", function(){ Glider.winHt = getWinHeight(); }, "false");
//else if (window.attachEvent)
  //window.attachEvent("onresize", function(){ Glider.winHt = getWinHeight(); } );

function initGlideLyr() {
	
	var results = 0;
	var firstres = 0;
	var docBody;
	var rExp;
	// exclude op < 7 (???)
	//alert("init");
	if(tmptimerrunning) {
		window.clearTimeout(tmptimertest);
		tmptimerrunning = false;
	}
	
	/*while(results < 0 || firstres == 0) {
		docBody = document.frames.mylistiframe.document.body.innerHTML;
		//alert(docBody);
		rExp = /"<!-- INIT -->"/g;
		results = docBody.search(rExp);
		firstres = 1;
	}*/
	
	var i, el, ua = navigator.userAgent;
	if ( (i = ua.indexOf("Opera")) != -1 ) { if ( parseFloat(ua.substr(i+6,4)) < 7 ) return; }
	
	var glideLyrs = new Array();
	// arguments: id, amount to be visible (left offset calculated), top
	// set width in style sheet (width and height are null here)
	// duration of glide onscroll, accel (-1 to 1, -1 decelerates)  
	//alert(document.getElementById('glideDiv0').offsetHeight);
	glideLyrs[0] = new Glider('glideDiv0',0,0,null,null,1000, 1);
	
	for (i=0; glideLyrs[i]; i++) {
		// hold amount to be left visible 
		glideLyrs[i].xOff = glideLyrs[i].x;
		if ( !glideLyrs[i].y ) // position based on previous glideLyrs height and position
			if ( glideLyrs[i-1] ) glideLyrs[i].y = glideLyrs[i-1].y + glideLyrs[i-1].h + 2;	
		if(glideLyrs[i].y < 0) glideLyrs[i].y = 0;
		//alert(glideLyrs[i].y);
		glideLyrs[i].shiftTo( -(glideLyrs[i].h - top.document.getElementById("slidedivLabel").offsetHeight), glideLyrs[i].y );
		
		glideLyrs[i].show();
		el = dynObj.getElemRef( glideLyrs[i].id );
		if (el) {
			el.onclick = slideIntoView;
			//el.onmouseover = slideIntoView;
			//el.onmouseout = slideOutOfView;
		}
	}
	//var position = (getWinWidth() / 2) - 75;
	var position = 26;
	top.document.getElementById("glideDivWrap").style.left = position;
}



function moveDivPosition() {
	var position = (getWinWidth() / 2) - 75;
	if(top.document.getElementById("glideDivWrap")){
		top.document.getElementById("glideDivWrap").style.left = position;
	}
}

function slideIntoView() {
	//NEW STUFF TO CLICK
	el = dynObj.getElemRef( this.id );
	el.onclick = slideOutOfView;
	//END NEW STUFF TO CLICK
	if(slidedOut == false) {
		/*top.document.frames.mylistiframe.location.href = "../documents/local_list.php?reload=slideIntoView";*/
		/*top.document.getElementById('mylistiframe').location.href = "../documents/local_list.php?reload=slideIntoView";*/
		top.mylistiframe.location = "../documents/local_list.php?reload=slideIntoView";
		slidedOut = true;
	}
	var glideLyr = dynObj.getInstance(this.id);
	//alert(document.getElementById('glideDiv0').style.visibility);
	//document.getElementById('glideDiv0').style.visibility = 'visible';
	if(tmptimerrunning) window.clearTimeout(tmptimertest);
	if(initTimeoutRunning) window.clearTimeout(initTimeout);
	glideLyr.slideTo(0, 0, 250, -1);
	top.document.getElementById('pbxupimg').style.visibility = 'visible';
	top.document.getElementById('pbxdownimg').style.visibility = 'hidden';
	top.document.getElementById('pbxupimg').style.display = '';
	top.document.getElementById('pbxdownimg').style.display = 'none';
}


function searchforslideout() {
	//var text = top.document.frames.mylistiframe.document.body.innerHTML;
	var text = top.mylistiframe.document.body.innerHTML;
	var found = 0;
	//alert(parent.frames.mylistiframe.document.body.innerHTML);
	result=text.search("<!-- slideOutOfView -->")
	//alert("result: " + result)
	if(result >= 0) {
		found = 1;
	}
	//alert("found: " + found);
	return found;
}

function slideOutOfView(e) {
	
	
	var glideLyr = dynObj.getInstance(this.id);
	var docBody;
	var rExp;
	var results = 0;
	var firstres = 0;
	e = e? e: window.event;
	var toEl = e.relatedTarget? e.relatedTarget: e.toElement;
	//if ( toEl != glideLyr.el && !contained(toEl, glideLyr.el) ) {
		//parent.frames.mylistiframe.location.href = "../documents/local_list.php?reload=slideOutOfView";
		glideLyr.slideTo( -(glideLyr.h - top.document.getElementById("slidedivLabel").offsetHeight), null, 300, -.8);
		//alert(top.document.getElementById("slidedivLabel").offsetHeight);
		slidedOut = false;
		
		/*
		var i = 0;
		
		while(results == 0 || firstres == 0) {
			docBody = document.frames.mylistiframe.document.body.innerHTML;
			rExp = new RegExp("<!-- slideOutOfView -->","i");
			results = docBody.match(rExp);
			if(results == null) results = 0;
			if(i == 10000) {
				alert(i);
				die;
			}
			i++;
			firstres = 1;
		}
		*/
		
		tmptimertest = setTimeout("initGlideLyr();",1000);
		//top.document.frames.mylistiframe.location.href = "../documents/local_list.php?reload=INIT";
		top.mylistiframe.location = "../documents/local_list.php?reload=INIT";
		tmptimerrunning = true;
		top.document.getElementById('pbxdownimg').style.visibility = 'visible';
		top.document.getElementById('pbxupimg').style.visibility = 'hidden';
		top.document.getElementById('pbxdownimg').style.display = '';
		top.document.getElementById('pbxupimg').style.display = 'none';
	//}
}

// returns true if oNode is contained by oCont (container)
function contained(oNode, oCont) {
	if (!oNode) return; // in case alt-tab away while hovering (prevent error)
	while ( oNode = oNode.parentNode ) if ( oNode == oCont ) return true;
	return false;
}
//end glider code

//showtip


function StartClock(popuur1, popmin1, popuur2, popmin2, popuur3, popmin3, popuur4, popmin4) {
	KillClock();

	if (popmin1 < 5){
		popuur1 = popuur1-1;
		popmin1 = (popmin1-5)+60;
	}
	else
		popmin1 = popmin1-5;
	
	if (popmin2 < 5){
		popuur2 = popuur2-1;
		popmin2 = (popmin2-5)+60;
	}
	else
		popmin2 = popmin2-5;
		
	if (popmin3 < 5){
		popuur3 = popuur3-1;
		popmin3 = (popmin3-5)+60;
	}
	else
		popmin3 = popmin3-5;
	
	if (popmin4 < 5){
		popuur4 = popuur4-1;
		popmin4 = (popmin4-5)+60;
	}
	else
		popmin4 = popmin4-5;
		
	UpdateClock(popuur1, popmin1, popuur2, popmin2, popuur3, popmin3, popuur4, popmin4);  
}



function KillClock() {	
	if(clock) {
		clearTimeout(clockID);
		clock  = false;
	}
}

//popup 5 minuten nadat de laatste prestatie is stopgezet en daarna popup om de 5 minuten,

function UpdateClock2(popuur1, popmin1) {
	
	var tDate = new Date();
	var hours = tDate.getHours();
	var minutes = tDate.getMinutes();
	var seconds = tDate.getSeconds();
	var popupsec = 1;
	
	var nextpopup1 = popmin1 + 10;
	if (nextpopup1 >= 60)
		var nextpopup1 = nextpopup1 - 60;
		
	var nextpopup2 = nextpopup1 + 10;
	if (nextpopup2 >= 60)
		var nextpopup2 = nextpopup2 - 60;
		
	var nextpopup3 = nextpopup2 + 10;
	if (nextpopup3 >= 60)
		var nextpopup3 = nextpopup3 - 60;
		
	var nextpopup4 = nextpopup3 +10;
	if (nextpopup4 >= 60)
		var nextpopup4 = nextpopup4 - 60;
		
	var nextpopup5 = nextpopup4 +10;
	if (nextpopup4 >= 60)
		var nextpopup5 = nextpopup5 - 60;
	
	
	if (((hours >= popuur1 && minutes >= popmin1 && seconds == popupsec)||(hours > popuur1 && seconds == popupsec)) && (minutes==popmin1 || minutes==nextpopup1 || minutes==nextpopup2 || minutes==nextpopup3 || minutes==nextpopup4 || minutes==nextpopup5)){
		KillClock();
		var winl = (screen.width - 600) / 2;
		var wint = (screen.height - 400) / 2;
		window.open(popupurl2,'reminder', 'width=200,height=100,top='+winl+',left='+wint+',menubars=no,alwaysRaised=yes,resizable=no,scrollbars=no,titlebar=no,toolbar=no,locationbar=no');
		window.location.reload();
	}
	
	clockID = setTimeout("UpdateClock2(" + popuur1 +"," + popmin1 + ")", 1000);
	clock  = true;
}

function StartClock2(popuur1, popmin1) {
	KillClock();
	UpdateClock2(popuur1, popmin1);  
}

function showtip(current,e,text){
	if (document.all){
	thetitle=text.split('<br>');
	if (thetitle.length>1){
		thetitles='';
		
		for (i=0;i<thetitle.length;i++)
			thetitles+=thetitle[i];
			current.title=thetitles;
		}
		else
			current.title=text;
	}
	else if (document.layers){
		document.tooltip.document.write('<layer bgColor="white" style="border:1px solid black;font-family: "Verdana", "Arial", "Helvetica", sans-serif;font-size:10px;">'+text+'</layer>');
		document.tooltip.document.close();
		document.tooltip.left=e.pageX+5;
		document.tooltip.top=e.pageY+5;
		document.tooltip.visibility="show";
	}
}

function hidetip(){
    if (document.layers)
	document.tooltip.visibility="hidden";
}

function select_sub(){
	submenu = new Array(2);
	submenu[1] = new Array(8);
	submenu[1][0] = "Beratung/Besprechung int/ext/tel";
	submenu[1][1] = "Briefing/Rebriefing";
	submenu[1][2] = "Ausarbeitung der Konzeption/Strategie";
	submenu[1][3] = "Budgetierung und Zeitplanung";
	submenu[1][4] = "Marktanalyse";
	submenu[1][5] = "Präsentation";
	submenu[1][6] = "Präsentationsvorbereitung";
	submenu[1][7] = "Neubriefing";

	submenu[2] = new Array(9);
	submenu[2][0] = "Projektbesprechnung";
	submenu[2][1] = "Projektplanung/-überwachung";
	submenu[2][2] = "Recherche und Beschaffung von ...";
	submenu[2][3] = "Produktionsüberwachung";
	submenu[2][4] = "Archivierung von ...";
	submenu[2][5] = "Autorenkorrekturen";
	submenu[2][6] = "Presseausendungen und Konfektionierung";
	submenu[2][7] = "Organisation von ...";
	submenu[2][8] = "Produktionsberatung";

	submenu[3] = new Array(14);
	submenu[3][0] = "Entwicklung der zentralen Idee";
	submenu[3][1] = "Visuelle Ausarbeitung der Idee";
	submenu[3][2] = "Headline und Copy";
	submenu[3][3] = "Datenbank-Design";
	submenu[3][4] = "Expose und Storyboard";
	submenu[3][5] = "Illustration";
	submenu[3][6] = "Konzeption Navigation";
	submenu[3][7] = "Konzeption Screen Design";
	submenu[3][8] = "Software-Analyse und  -Design";
	submenu[3][9] = "Präsentationsvorbereitung";
	submenu[3][10] = "Konzeptionelle Ausarbeitung der Idee";
	submenu[3][11] = "Projektbesprechung";
	submenu[3][12] = "Autorenkorrektur";
	submenu[3][13] = "Ausarbeitung der Konzeption / Strategie";

	submenu[4] = new Array(21);
	submenu[4][0] = "Animation";
	submenu[4][1] = "Arbeitsvorbereitung";
	submenu[4][2] = "CD-Premastering";
	submenu[4][3] = "Datenpflege, Archivierung";
	submenu[4][4] = "Dokumentation";
	submenu[4][5] = "Einrichtzeiten";
	submenu[4][6] = "Ton-, Video-, und Fotoregie";
	submenu[4][7] = "Lauftest";
	submenu[4][8] = "Lektorat/Korrekturlesen";
	submenu[4][9] = "Mediendatenbank Aufbau/Ergänzung/Pflege";
	submenu[4][10] = "Programmierung";
	submenu[4][11] = "HTML-Bearbeitung";
	submenu[4][12] = "Redaktion/Übersetzung ienes Manuskripts";
	submenu[4][13] = "Redaktionskontakt wegen Veröffentlichung mit ...";
	submenu[4][14] = "Text-, Bildintegration (Rein-Layout)";
	submenu[4][15] = "Texten von ...";
	submenu[4][16] = "Tondigitalisierung/-bearbeitung";
	submenu[4][17] = "Videodigitalisierung/-bearbeitung";
	submenu[4][18] = "Projektbesprechnung (Briefing/Rebriefing)";
	submenu[4][19] = "Autorenkorrektur";
	submenu[4][20] = "Grafische Ausarbeitung von ...";

	submenu[5] = new Array(13);
	submenu[5][0] = "Scan-Highend";
	submenu[5][1] = "Bildbearbeitung Highend";
	submenu[5][2] = "Scan-Layout";
	submenu[5][3] = "Texterfassung";
	submenu[5][4] = "Belichtung";
	submenu[5][5] = "Proof";
	submenu[5][6] = "Arbeitsvorbereitung";
	submenu[5][7] = "Datenpflege, Archivierung";
	submenu[5][8] = "Dokumentation";
	submenu[5][9] = "Lektorat/Korrekturlesen";
	submenu[5][10] = "Text-/Bildintegration (Rein-Zeichnung)";
	submenu[5][11] = "Projektbesprechnung";
	submenu[5][12] = "Autorenkorrektur";
	
	if (document.forms[0].actionid.value != 0){
		if (document.forms[0].actionid.value == 1){
			for (i=0;i<document.forms[0].subactionid.length;i++){
				document.forms[0].subactionid.options[i] = null;
			}
					 
			for (i=0;i<submenu[1].length;i++){
				k = submenu[1][i];
				p = new Option(k);
				document.forms[0].subactionid.options[i] = p;
				document.forms[0].subactionid.options[i].value = i;
			}
		}
		if (document.forms[0].actionid.value == 2){
			
			for (i=0;i<=document.forms[0].subactionid.length;i++){
				document.forms[0].subactionid.options[i] = null;
			}
			for (i=0;i<submenu[2].length;i++){
				k = submenu[2][i];	
				p = new Option(k);
				document.forms[0].subactionid.options[i] = p;
				document.forms[0].subactionid.options[i].value = i;
			}
		}
		if (document.forms[0].actionid.value == 3){
			
			for (i=0;i<=document.forms[0].subactionid.length;i++){
				document.forms[0].subactionid.options[i] = null;
			}
			for (i=0;i<submenu[3].length;i++){
				k = submenu[3][i];	
				p = new Option(k);
				document.forms[0].subactionid.options[i] = p;
				document.forms[0].subactionid.options[i].value = i;
			}
		}
		if (document.forms[0].actionid.value == 4){
			
			for (i=0;i<=document.forms[0].subactionid.length;i++){
				document.forms[0].subactionid.options[i] = null;
			}
			for (i=0;i<submenu[4].length;i++){
				k = submenu[4][i];	
				p = new Option(k);
				document.forms[0].subactionid.options[i] = p;
				document.forms[0].subactionid.options[i].value = i;
			}
		}
		if (document.forms[0].actionid.value == 5){
			
			for (i=0;i<=document.forms[0].subactionid.length;i++){
				document.forms[0].subactionid.options[i] = null;
			}
			for (i=0;i<submenu[5].length;i++){
				k = submenu[5][i];	
				p = new Option(k);
				document.forms[0].subactionid.options[i] = p;
				document.forms[0].subactionid.options[i].value = i;
			}
		}
	}
	else if (document.forms[0].actionid.value == 0){
		for (i=0;i<=10;i++){
			document.forms[0].subactionid.options[i] = null;
		}
		for (i=0;i<=10;i++){
			document.forms[0].subactionid.options[i] = null;
		}
		for (i=0;i<=10;i++){
			document.forms[0].subactionid.options[i] = null;
		}
		
		p = new Option('Kein Teilbereich');
		document.forms[0].subactionid.options[0] = p;
		document.forms[0].subactionid.options[0].value = 0;
	}
}	

function UpdateClock(popuur1, popmin1, popuur2, popmin2, popuur3, popmin3, popuur4, popmin4) {
			
		var tDate = new Date();
	var hours = tDate.getHours();
	var minutes = tDate.getMinutes();
	var seconds = tDate.getSeconds();
	var popupsec = 1;
	
	if (((hours == popuur1) && (minutes == popmin1) && (seconds == popupsec)) || ((hours == popuur2) && (minutes == popmin2) && (seconds == popupsec)) || ((hours == popuur3) && (minutes == popmin3) && (seconds == popupsec)) ||((hours == popuur4) && (minutes == popmin4) && (seconds == popupsec))){
		KillClock();
		var winl = (screen.width - 600) / 2;
		var wint = (screen.height - 400) / 2;
		window.open(popupurl,'reminder', 'width=200,height=100,top='+winl+',left='+wint+',menubars=no,alwaysRaised=yes,resizable=no,scrollbars=no,titlebar=no,toolbar=no,locationbar=no');
		window.location.reload();
	}
	
	clockID = setTimeout("UpdateClock(" + popuur1 +"," + popmin1 + "," + popuur2 +"," + popmin2 + "," + popuur3 +"," + popmin3 + "," + popuur4 +"," + popmin4 + ")", 1000);
	clock  = true;
}

function opencomment(url) {
	var yes = 1;
	var no  = 0;
	
	var menubar = no;      // The File, Edit, View Menus
	var scrollbars = yes;   // Horizontal and vertical scrollbars
	var locationbar = no;  // The location box with the site URL
	var directories = no;  // the "What's New", "What Cool" links
	var resizable = no;    // Can the window be resized?
	var statusbar = no;    // Status bar (with "Document: Done")
	var toolbar = no;      // Back, Forward, Home, Stop toolbar
	
	windowprops = "height=400,width=600";
	windowprops += 	(menubar ? ",menubars" : "") +
					(scrollbars ? ",scrollbars" : "") +
					(locationbar ? ",location" : "") +
					(directories ? ",directories" : "") +
					(resizable ? ",resizable" : "") +
					(statusbar ? ",status" : "") +
					(toolbar ? ",toolbar" : "");
	
	windowcomm = window.open(url,'windowcomm',windowprops);
	
}


function makePart() {
	ids = "";
	separator = ".";
	var to_form = eval('document.nd.elements[\"participants[]\"]');
	for(i=0; i < to_form.length; i++) {
		if(ids!="") ids = ids+separator+to_form.options[i].value;
		else ids = to_form.options[i].value;
	}
	document.nd.parts.value = ids;	
	
	return;
}

function testAvail(datum) {
	ids = "";
	separator = ".";
	var to_form = eval('document.nd.elements[\"participants[]\"]');
	var app_start = eval('document.nd.elements[\"appointment_start\"]');
	start = app_start.options[app_start.selectedIndex].value;
	var app_end = eval('document.nd.elements[\"appointment_end\"]');
	end = app_end.options[app_end.selectedIndex].value;
	for(i=0; i < to_form.length; i++) {
		if(ids!="") ids = ids+separator+to_form.options[i].value;
		else ids = to_form.options[i].value;
	}
	if(ids=="") {
		alert("You must select at least one participant!");
	}
	else {
		params = "parts="+ids+"&datum="+datum+"&from="+start+"&to="+end;
		window.open("../calendar/collisions.php?"+params,"collisions","width=700,height=300,resizable=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,scrollbars=yes,status=no,toolbar=no,history=no");
	}
	return;
}

/*ontwikkeling*/
function addPlace(rooturl,mod) {
	var dummy = "";

	switch(mod) {
        case "todo"     :
            dummy  = document.nd.location.value;
            break;
        case "todo2"    :
            dummy = document.nd.locationint.value;
            break;
        case "calendar" :
            dummy  = document.nd.location.value;
            break;
        case "support"  :
            dummy  = document.nd.location.value;
            break;
        case "contact"  :
            dummy  = document.f1.location.value;
            break;
        case "contact2"  :
            dummy  = document.f1.location2.value;
            break;
        case "crm"      :
            dummy  = document.f1.location.value;
            break;
        case "shipping"      :
            dummy  = document.f1.location.value;
            break;
		case "phonelist"	:
			dummy = document.f1.compname.value;
			break;
    }

    var url = rooturl + "/modules/general/companies.php?funk=addLocation&mod="+ mod + "&dummy=" + dummy + "&search=true"
	window.open(url,"companies","width=700,height=300,resizable=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,scrollbars=yes,status=no,toolbar=no,history=no");
}

function addPlace2(rooturl,mod,projid) {
	var dummy = "";

	switch(mod) {
        case "todo"     :
            dummy  = document.nd.location.value;
            break;
        case "todo2"    :
            dummy = document.nd.locationint.value;
            break;
        case "calendar" :
            dummy  = document.nd.location.value;
            break;
        case "support"  :
            dummy  = document.nd.location.value;
            break;
        case "contact"  :
            dummy  = document.f1.location.value;
            break;
        case "contact2"  :
            dummy  = document.f1.location2.value;
            break;
        case "crm"      :
            dummy  = document.f1.location.value;
            break;
        case "shipping"      :
            dummy  = document.f1.location.value;
            break;
		case "phonelist"	:
			dummy = document.f1.compname.value;
			break;
    }

    var url = rooturl + "/modules/general/companies.php?funk=addLocation&mod="+ mod + "&dummy=" + dummy + "&search=true&projid=" + projid;
	window.open(url,"companies","width=700,height=300,resizable=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,scrollbars=yes,status=no,toolbar=no,history=no");
}

function addIntPlace(rooturl,mod) {
    var dummy;

    switch(mod) {
        case "todo"     :
            dummy  = document.nd.location.value;
            break;
        case "todo2"    :
            dummy = document.nd.locationint.value;
            break;
        case "calendar" :
            dummy  = document.nd.location.value;
            break;
        case "support"  :
            dummy  = document.nd.location.value;
            break;
        case "contact"  :
            dummy  = document.f1.location.value;
            break;
        case "crm"      :
            dummy  = document.f1.location.value;
            break;
    }

	var url = rooturl + "/modules/general/companies.php?funk=addLocation&mod="+ mod + "&dummy=" + dummy + "&search=true"
	window.open(url,"companies","width=700,height=300,resizable=yes,directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,scrollbars=yes,status=no,toolbar=no,history=no");
}
function addLocation(id,location,type){
	opener.document.nd.locationid.value = id;
	opener.document.nd.location.value = location;
	opener.document.nd.locationtype.value = type;
	window.close();
}

var IE = document.all?true:false;
var tempX = 0;
var tempY = 0;
function getMouseX(e) {
	if (IE) {
		tempX = event.clientX + document.body.scrollLeft;
	} else {
		tempX = e.pageX;
	}  
	if (tempX < 0){tempX = 0;}
	return tempX
}

function getMouseY(e) {
	if (IE) {
		tempY = event.clientY + document.body.scrollTop;
	} else {
		tempY = e.pageY;
	}
	tempY = tempY;
	if (tempY < 0){tempY = 0;}  
	return tempY
}

function smartOptionFinder(sToChar,oSelect) {
	var arrOpt = oSelect.options
	var iLen = arrOpt.length
	for (var i = 0; i < iLen ; i++) {
		sTest  = arrOpt[i].text;
		if (sTest.toUpperCase().indexOf(sToChar.toUpperCase()) > -1) {
			arrOpt[i].selected = true;
			break;
		}
	}
}

function smartOptionFinderMultiple(sToChar,oSelect) {
	var arrOpt = oSelect.options
	var iLen = arrOpt.length
	for (var i = 0; i < iLen ; i++) {
		sTest  = arrOpt[i].text;
		if (sTest.toUpperCase().indexOf(sToChar.toUpperCase()) > -1) {
			arrOpt[i].selected = true;
			break;
		}
		else arrOpt[i].selected = false;
	}
	for (var t = (i+1); t < iLen ; t++) {
		arrOpt[t].selected = false;
	}
}

function webmailpopup(url) {
	var yes = 1;
	var no  = 0;
	
	var menubar = no;      // The File, Edit, View Menus
	var scrollbars = no;   // Horizontal and vertical scrollbars
	var locationbar = no;  // The location box with the site URL
	var directories = no;  // the "What's New", "What Cool" links
	var resizable = yes;    // Can the window be resized?
	var statusbar = no;    // Status bar (with "Document: Done")
	var toolbar = no;      // Back, Forward, Home, Stop toolbar
	
	windowprops = "top=0,left=0,height=" + screen.height + ",width=" + screen.width;
	windowprops += 	(menubar ? ",menubars" : "") +
					(scrollbars ? ",scrollbars" : "") +
					(locationbar ? ",location" : "") +
					(directories ? ",directories" : "") +
					(resizable ? ",resizable" : "") +
					(statusbar ? ",status" : "") +
					(toolbar ? ",toolbar" : "");
	
	webmailpopupwin = window.open(url,'webmailpopupwin',windowprops);
	webmailpopupwin.focus();
}
