// This mapper code was developed by janjoris van der Lei info@lcpnet.com)
// http://www.lcpnet.com

koko=0
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function endit(){
zx=20;
zy=20;
ox1=MM_findObj("x1");ox2=MM_findObj("x2");oy1=MM_findObj("y1");oy2=MM_findObj("y2");
ocur_size=MM_findObj("cur_size");ocur_x=MM_findObj("cur_x");ocur_y=MM_findObj("cur_y");
oname=MM_findObj("cur_name");oicon=MM_findObj("cur_icon");
if (Number(ox1.value)!=0){
	ax=parseInt((((Number(ox1.value)-zx)/500)*Number(ocur_size.value))+Number(ocur_x.value));
	ay=parseInt((((Number(oy1.value)-zy)/500)*Number(ocur_size.value))+Number(ocur_y.value));
	if (Number(ox2.value)!=0){
	aw=parseInt((Number(ox2.value)-Number(ox1.value)));
	aw2=parseInt((Number(oy2.value)-Number(oy1.value)));

	aw=parseInt(aw* Number(ocur_size.value)/500);
	aw2=parseInt(aw2* Number(ocur_size.value)/500);
	} else {
	aw=parseInt(Number(ocur_size.value)/2); 
	aw2=parseInt(Number(ocur_size.value)/2); 
	ax=ax-parseInt(aw/2)
	ay=ay-parseInt(aw/2)
	}
} else {
	aw=parseInt(Number(ocur_size.value)/2);
	aw2=parseInt(Number(ocur_size.value)/2);
	ax=Number(ocur_x.value)+parseInt(Number(ocur_size.value)/4);
	ay=Number(ocur_y.value)+parseInt(Number(ocur_size.value)/4);;
}

window.opener.document.all(window.opener.document.activeElement.sourceIndex-1).value=ax;
window.opener.document.all(window.opener.document.activeElement.sourceIndex+4).value=ay;
window.opener.document.all(window.opener.document.activeElement.sourceIndex+8).value=aw;
window.opener.document.all(window.opener.document.activeElement.sourceIndex+12).value=aw2;

window.close()
}
function setxy_down(arg_this){
	ox1=MM_findObj("x1");ox2=MM_findObj("x2");oy1=MM_findObj("y1");oy2=MM_findObj("y2");
	if (koko==0){
		koko= 1;
		oy1.value=event.y+document.body.scrollTop;
		ox1.value=event.x+document.body.scrollLeft;
		thediv=MM_findObj("Posdiv");
		thediv.style.left=ox1.value;thediv.style.top=oy1.value;
		thediv.style.width=5;thediv.style.height=5;}
	else{
		koko=0;
		if ((event.x+document.body.scrollLeft)>Number(ox1.value))
			{ox2.value=event.x+document.body.scrollLeft;} 
		else
			{ox2.value=ox1.value;ox1.value=event.x+document.body.scrollLeft;}
		if ((event.y+document.body.scrollTop)>Number(oy1.value))
			{oy2.value=event.y+document.body.scrollTop;} 
		else 
			{oy2.value=oy1.value;oy1.value=event.y+document.body.scrollTop;}
		thediv.style.left=ox1.value;thediv.style.top=oy1.value;
		thediv.style.width=ox2.value-ox1.value;
		thediv.style.height=oy2.value-oy1.value;}
}
function testeval(a){
eval(a.options[a.selectedIndex].value);
}
function ganu()
{
ocur_size=MM_findObj("cur_size");ocur_x=MM_findObj("cur_x");ocur_y=MM_findObj("cur_y");
theurl="/pop/mapimg.aspx?x="+ocur_x.value+"&y="+ocur_y.value+"&cat=1&xsize="+ocur_size.value;
theimg=MM_findObj("zeroimage");
theimg.src=theurl;
return false
}
function gostraat(a,b,c,cc)
{
	d=a;e=b;f=c;

	if(c>cc)
	{
	e=parseInt(e-((c-cc)/2));
	}
	else
	{
	f=cc;
	d=parseInt(d-((cc-c)/2));
	}
	ox1=MM_findObj("x1");ox2=MM_findObj("x2");oy1=MM_findObj("y1");oy2=MM_findObj("y2");
	ocur_size=MM_findObj("cur_size");ocur_x=MM_findObj("cur_x");ocur_y=MM_findObj("cur_y");
	theurl="/pop/mapimg.aspx?x="+d+"&y="+e+"&cat=1&xsize="+f;
	theimg=MM_findObj("zeroimage");
	theimg.src=theurl;
	ocur_x.value=d;
	ocur_y.value=e;
	ocur_size.value=f;
	thediv=MM_findObj("Posdiv");
	thediv.style.width=0;thediv.style.height=0;koko=0;
	ox1.value=0;ox2.value=0;oy1.value=0;oy2.value=0;koko=0;
}
function zoom() {
// setting voor de offset, dit is design afhankelijk

zx=20;
zy=20;
ox1=MM_findObj("x1");ox2=MM_findObj("x2");oy1=MM_findObj("y1");oy2=MM_findObj("y2");
ocur_size=MM_findObj("cur_size");ocur_x=MM_findObj("cur_x");ocur_y=MM_findObj("cur_y");
oname=MM_findObj("cur_name");oicon=MM_findObj("cur_icon");
if (Number(ox1.value)!=0){
	ax=parseInt((((Number(ox1.value)-zx)/500)*Number(ocur_size.value))+Number(ocur_x.value));
	ay=parseInt((((Number(oy1.value)-zy)/500)*Number(ocur_size.value))+Number(ocur_y.value));
	if (Number(ox2.value)!=0){
	aw=parseInt((Number(ox2.value)-Number(ox1.value)));
	aw2=parseInt((Number(oy2.value)-Number(oy1.value)));
	if (aw2>aw) {aw=aw2}
	aw=parseInt(aw* Number(ocur_size.value)/500);
	} else {
	aw=parseInt(Number(ocur_size.value)/2); 
	ax=ax-parseInt(aw/2)
	ay=ay-parseInt(aw/2)
	}

} else {
	aw=parseInt(Number(ocur_size.value)/2);
	ax=Number(ocur_x.value)+parseInt(Number(ocur_size.value)/4);
	ay=Number(ocur_y.value)+parseInt(Number(ocur_size.value)/4);;
}
theurl="/pop/mapimg.aspx?x="+(ax)+"&y="+(ay)+"&cat=1&xsize="+aw+"&naam="+oname.value+"&icoon="+oicon.value;
theimg=MM_findObj("zeroimage");
theimg.src=theurl;
ocur_x.value=ax;ocur_y.value=ay;ocur_size.value=aw;
thediv=MM_findObj("Posdiv");
thediv.style.width=0;thediv.style.height=0;koko=0;
ox1.value=0;ox2.value=0;oy1.value=0;oy2.value=0;koko=0;
}

function zoom_out()
{	
	ocur_size=MM_findObj("cur_size");ocur_x=MM_findObj("cur_x");ocur_y=MM_findObj("cur_y");
	ox1=MM_findObj("x1");ox2=MM_findObj("x2");oy1=MM_findObj("y1");oy2=MM_findObj("y2");
	oname=MM_findObj("cur_name");oicon=MM_findObj("cur_icon");
	ax=Number(ocur_x.value)-parseInt(0.5*Number(ocur_size.value));
	ay=Number(ocur_y.value)-parseInt(0.5*Number(ocur_size.value));
	if (ax<0) {ax=0};
	if (ay<0) {ay=0};
	aw=Number(ocur_size.value)*2;
	theurl="/pop/mapimg.aspx?x="+ax+"&y="+ay+"&cat=1&xsize="+aw+"&naam="+oname.value+"&icoon="+oicon.value;
	theimg=MM_findObj("zeroimage");
	theimg.src=theurl;
	ocur_x.value=ax;
	ocur_y.value=ay;
	ocur_size.value=aw;
	thediv=MM_findObj("Posdiv");
	thediv.style.width=0;thediv.style.height=0;koko=0;
	ox1.value=0;ox2.value=0;oy1.value=0;oy2.value=0;koko=0;
}

function go_xx(a,b){
	ox1=MM_findObj("x1");ox2=MM_findObj("x2");oy1=MM_findObj("y1");oy2=MM_findObj("y2");
	ocur_size=MM_findObj("cur_size");ocur_x=MM_findObj("cur_x");ocur_y=MM_findObj("cur_y");
	ax=Number(ocur_x.value);
	ay=Number(ocur_y.value);
	aw=Number(ocur_size.value);
	ax=parseInt((Number(b)*Number(aw))+Number(ax))
	ay=parseInt((Number(a)*Number(aw))+Number(ay))
	theurl="/pop/mapimg.aspx?x="+ax+"&y="+ay+"&cat=1&xsize="+aw;
	theimg=MM_findObj("zeroimage");
	theimg.src=theurl;
	ocur_x.value=Number(ax);
	ocur_y.value=Number(ay);
	ocur_size.value=Number(aw);
	thediv=MM_findObj("Posdiv");
	thediv.style.width=0;thediv.style.height=0;koko=0;
	ox1.value=0;ox2.value=0;oy1.value=0;oy2.value=0;koko=0;
}
function go_nw(){go_xx(-0.5,-0.5)}
function go_no(){go_xx(-0.5,0.5)}
function go_n(){go_xx(-0.5,0)}
function go_w(){go_xx(0,-0.5)}
function go_o(){go_xx(0,0.5)}
function go_zw(){go_xx(0.5,-0.5)}
function go_z(){go_xx(0.5,0)}
function go_zo(){go_xx(0.5,0.5)}

