var ie = (document.all) ? true : false;
function toggleMenu(id){
	if(document.getElementById("menu_"+id)){
		if (currentMenu != "") {
			if (document.getElementById("menu_"+currentMenu)) {
				document.getElementById("menu_"+currentMenu).style.display="none";
				//document.getElementById("button_"+currentMenu).src="/lib/images/button_off.gif";
			}
		}
		currentMenu = id;
		document.getElementById("menu_"+currentMenu).style.display="";
		//document.getElementById("button_"+currentMenu).src="/lib/images/button_on.gif";
	}
}

function init(){
	toggleMenu(currentMenu);
	initRollover();
}

function printWindow(u){
	var leftPos = (screen.availWidth-700) / 2
	var topPos = (screen.availHeight-400) / 2 
	var printWindow = window.open(u,'printWindow', 'scrollbars=yes,resizable=yes,status=yes,toolbar=no,width=700,height=400,top=' + topPos + ',left=' + leftPos);
	printWindow.focus();
}

function printPage(){
	url = document.location + ((document.location.search) ? "&print=true" : "?print=true")
	printWindow(url);
}

function showSearchObj(show) {
	if (ie) {
		document.all['zoeken'].style.top = 10;
		document.all['zoeken'].style.left = document.body.offsetWidth-160;
		document.all['zoeken'].style.display = show;
		if (show != 'none') {document.zoekpopup.query.value='';document.zoekpopup.query.focus();}
	} else {
		document.location = '/zoeken';
	}
}
	
function download(id) {
	document.downloader.location = '/download.asp?id='+id;
}

function emailPage(pagina){
	var url = escape(document.location);
	var leftPos = (screen.availWidth-500) / 2
	var topPos = (screen.availHeight-380) / 2 
	var uploadWindow = window.open('/maillink.asp?url='+url+'&pagina='+escape(pagina),'myWindow', 'scrollbars=no,resizable=yes,status=yes,toolbar=no,width=500,height=380,top=' + topPos + ',left=' + leftPos);
	uploadWindow.focus();
}

function setHomepage(kid) {
	if (confirm("Weet u zeker dat u dit kantoor wilt instellen als 'Mijn notaris'?")) {
		document.location = "/setCookie.asp?kid="+kid;
	}
}

function visitHomepage(kid) {
	document.location = "/kantoor/default.asp?kid="+kid;
}

function toggleTip(){
	var tip = document.getElementById("tip");
	if (tip){
		if (tip.style.display !=""){
			tip.style.display = "";
		} else {
			tip.style.display = "none";
		}
	}
}

function deleteCookie(kid) {
	if (confirm("Weet u zeker dat u 'Mijn kantoor' wilt verwijderen?")){
		document.location = "deleteCookie.asp?kid="+kid;
	}
}

function showMap(pl, marker) {
	newWindow = window.open("http://tools.locatienet.com/location/map.asp?config_id=1493&street=&zipcode="+pl+"&city=&country=NL&zoom=0&markertext="+escape(marker)+"&css=http://www.netwerknotarissen.nl/lib/css/style.css&logo=http://www.netwerknotarissen.nl/lib/images/logolocatienet.gif&language=dutch", "MAP", 'scrollbars=yes,status=yes,resizable=yes,toolbar=yes,width=650,height=500');
}

function winpopup(urlname, boxname, boxresize, boxscrollbar, boxwidth, boxheight) {
	thefile = urlname;
	var boxleft = (screen.availWidth-boxwidth) / 2
	var boxtop = (screen.availHeight-boxheight) / 2 
   	var popup = window.open(thefile, boxname,"dependent=yes,toolbar=no,location=no,directories=0,status=0,menubar=no,scrollbars=" + boxscrollbar + ",width=" + boxwidth + ",height=" + boxheight +",resizable=" + boxresize + ",top=" + boxtop + ",left=" + boxleft);
	popup.location=thefile;
	popup.focus();
}
	
function viewPicture(pic) {
	PicWin = window.open('/image_view.asp?pic='+pic,'PicWin','scrollbars=no,width=400,height=275');
	PicWin.focus();
}

Xoffset = 0;    // modify these values to ...
Yoffset = 13;    // change the popup position.

var old,skn,iex = (document.all),yyy=-1000;
var ns4 = document.layers;
var ns6 = document.getElementById&&!document.all;
var ie4 = document.all;

function initRollover() {
	if (ns4)
		skn=document.dek
	else if (ns6)
		skn=document.getElementById("dek").style
	else if (ie4)
		skn=document.all.dek.style
	if(ns4)document.captureEvents(Event.MOUSEMOVE);
	else{
		skn.visibility="visible"
		skn.display="none"
	}
	document.onmousemove=get_mouse;
}

function popup(msg){
	var content="<table cellspacing=0 class=rollover width=300><tr><td>"+msg+"</td></tr></table>";
	yyy=Yoffset;
	if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"}
	if(ns6){document.getElementById("dek").innerHTML=content;skn.display=''}
	if(ie4){document.all("dek").innerHTML=content;skn.display=''}
}

function get_mouse(e){
	var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
	skn.left=x+Xoffset;
	var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
	skn.top=y+yyy;
}

function kill(){
	yyy=-1000;
	if(ns4){skn.visibility="hidden";}
	else if (ns6||ie4)
	skn.display="none"
}
function showFotoDB(url,id) {
	WindowInfo = window.open(url+'/image_view.asp?id='+id+'&db=true','Image','scrollbars=no,width=100,height=100');
	WindowInfo.focus();
}
