//open window function
function open_window(page){
		var new_url = "http://216.120.232.80/add_notes.php?page="+ page
		open(new_url, "new_window", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=300, height=315")

		//window.new_window.close()
	}

//menu script
var submenu = new Array();
var tmr = new Array();
var adj = new Array();
var last_zIndex = 10000;
var lastOverId = '';

// EXAMPLE CONFIG
var menuWidth 		= 150;			//width of submenu in pixels
var alignSubmenu 	= 'bottom';		//bottom or right side of the main button.
var useLastItemCSS	= true;			//generate last menu item too
									//if false, it will behave as a normal item
									//and the css menuItemLast class will not be used

//Submenu syntax menu1, menu1_1, menu1_1_1, etc

//fisrt submenu tree
//submenu['home'] = new Array();
//submenu['home'][0] = menuItem('my own website','http://www.daantje.nl','_top');
//submenu['home'][1] = menuItem('other sites');
	//submenu['menu1_1'] = new Array();
	//submenu['menu1_1'][0] = menuItem('google','http://www.google.nl','demoFrame');
	//submenu['menu1_1'][1] = menuItem('/.','http://www.slashdot.org','demoFrame');
	//submenu['menu1_1'][2] = menuItem('Open in _BLANK:');
		//submenu['menu1_1_2'] = new Array();
		//submenu['menu1_1_2'][0] = menuItem('check test','http://www.google.nl','_blank');
		//submenu['menu1_1_2'][1] = menuItem('test again','http://www.slashdot.org','_blank');
//submenu['home'][2] = menuItem('This should be the last one');

//data acquisition submenu tree
submenu['menu1'] = new Array();
submenu['menu1'][0] = menuItem('Project Design','data_acqui_project.php','_self');


//data processing submenu tree
//submenu['data_process'] = new Array();
//submenu['data_process'][0] = menuItem('project 1','http://www.daantje.nl','_self');
//submenu['data_process'][1] = menuItem('project 2');

//safety submenu tree
//submenu['safety'] = new Array();
//submenu['safety'][0] = menuItem('project 1','http://www.daantje.nl','_self');
//submenu['safety'][1] = menuItem('project 2');

//investor submenu tree
//submenu['investor'] = new Array();
//submenu['investor'][0] = menuItem('project 1','http://www.daantje.nl','_self');
//submenu['investor'][1] = menuItem('project 2');

//human submenu tree
submenu['menu2'] = new Array();


//Safety submenu tree
submenu['menu3'] = new Array();



//contacts submenu tree
//submenu['contacts'] = new Array();
//submenu['contacts'][0] = menuItem('project 1','http://www.daantje.nl','_self');
//submenu['contacts'][1] = menuItem('project 2');

// END OF EXAMPLE CONFIG


//build or unhide submenu div...
function buildSubmenu(obj,text){
	lastOverId = obj.id;

	//get common part of div id
	menuPath = obj.id.split('_');

	//unset mousout of parent menus and make sure they are visible...
	x = "div";
	for(i=0;i<menuPath.length;i++){
		x+= '_' + menuPath[i];
		if(document.getElementById(x)){
			if(tmr[x])
				window.clearTimeout(tmr[x]);
			document.getElementById(x).style.visibility = 'visible';
		}
	}

	//check if we have a submenu of the obj...
	//if(submenu[obj.id]){
		//check if allready build...
		c = document.getElementById('div_' + obj.id);
		if(c){
			//unhide...
			c.style.visibility = 'visible';
			c.style.zIndex = last_zIndex++;
		}else{
			//calc position of mouseover
			d = obj;
			if(d){
				L_pos = d.offsetLeft + d.offsetWidth - 1;
				T_pos = d.offsetTop + 0;
				while(d.offsetParent){
					d = d.offsetParent;
					L_pos+= d.offsetLeft;
					T_pos+= d.offsetTop;
				}
			}

			//patch first submenu to go right below the main buttons...
			if(obj.className.indexOf('menuItem') < 0 && alignSubmenu == 'bottom'){
				L_pos-= obj.offsetWidth;
				T_pos+= obj.offsetHeight;
			}

			//build new div
			subObj = document.createElement('div');
			subObj.id = 'div_' + obj.id;
			subObj.className = 'submenu';
			subObj.style.position = 'absolute';
			subObj.style.zIndex = last_zIndex++;
			subObj.style.width = menuWidth;
			subObj.style.top = T_pos - 20;
			subObj.style.left = L_pos - 154;

			//write div to the body...
			document.getElementsByTagName('body')[0].appendChild(subObj);

			//build html for submenu
			content = "";
			m = submenu[obj.id];
			

			//insert new menu
			subObj.innerHTML = "<div onmouseout=\"hideSubmenu(this)\"><table cellpadding='2' width='150'><tr><td width='150' class='border_popup'><span class='blue_body_text'>" + text + "</span></td><tr></table></div>";

			//make all just made div's the same width...
			for(i=0;i<adj.length;i++)
				document.getElementById(adj[i]).style.width = subObj.style.width;
		}
	//}
}

//hide a submebu div
function hideSubmenu(obj){
	//get common part of div id
	closePath = obj.id.split('_');

	//hide path
	x = "div";
	for(i=0;i<closePath.length;i++){
		x+= '_' + closePath[i];
		if(document.getElementById(x))
			tmr[x] = window.setTimeout("document.getElementById('"+x+"').style.visibility = 'hidden';",500);
		//The timeout above is needed for MSIE browsers... Or else the menu's will disapear on EVERY mousout!!!
		//Please get a normal browser like Firefox, Mozilla or Opera!!
	}
}

//add an menu item to the config array (called in the config lines)
function menuItem(txt,url,tar){
	return new Array(txt,url,tar);
}

//*** Patch for firefox bug with focus on mouseover...
//		This function should be called onMouseOver of every iFrame that's under the menu structure.
function iFramePatch(){
	if(!document.all && lastOverId)
		hideSubmenu(document.getElementById(lastOverId));
}

//*** Now a patch for MSIE lag of CSS2 compliance!!
if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')==-1){
	document.onmouseover = function(){
		obj = event.srcElement;
		if(obj.className == 'menuItemFirst' || obj.className == 'menuItem' || obj.className == 'menuItemLast')
			obj.className+='Over';
	}
	document.onmouseout = function(){
		obj = event.srcElement;
		if(obj.className == 'menuItemFirstOver' || obj.className == 'menuItemOver' || obj.className == 'menuItemLastOver')
			obj.className = obj.className.substring(0,(obj.className.length - 4));
	}
}
//*** End of msie patch
