function SelectType(ArrayName,b) {
	if(document.kopen) {
		document.kopen.tid.length=0;
		var a = 0;
		for(i = 0; i < (typeArray[ArrayName].length/3); i++) {
			document.kopen.tid.length++;
			document.kopen.tid.options[i].value = typeArray[ArrayName][(i*3)];
			document.kopen.tid.options[i].text = typeArray[ArrayName][(i*3)+2];
			if(typeArray[ArrayName][(i*3)+1]==b) {
				document.kopen.th.value = b;
				a = typeArray[ArrayName][(i*3)];
			}
		}
		document.kopen.mid.value = ArrayName;
		document.kopen.tid.selectedIndex = a;
	}
}	

function SelectTypeVerkopen(ArrayName,b) {
	if(document.verkopen) {
		document.verkopen.type_id.length=0;
		var a = 0;
		for(i = 0; i < (typeArray[ArrayName].length/3); i++) {
			document.verkopen.type_id.length++;
			document.verkopen.type_id.options[i].value = typeArray[ArrayName][(i*3)];
			document.verkopen.type_id.options[i].text = typeArray[ArrayName][(i*3)+2];
			if(typeArray[ArrayName][(i*3)+1]==b) {
				document.verkopen.typeHack.value = b;
				a = typeArray[ArrayName][(i*3)];
			}
		}
		document.verkopen.mid.value = ArrayName;
		document.verkopen.type_id.selectedIndex = a;
	}
}

function SelectTypeVerkopen2(ArrayName,b) {
	if(document.verkopen2) {
		document.verkopen2.type_id.length=0;
		var a = 0;
		for(i = 0; i < (typeArray[ArrayName].length/3); i++) {
			document.verkopen2.type_id.length++;
			document.verkopen2.type_id.options[i].value = typeArray[ArrayName][(i*3)];
			document.verkopen2.type_id.options[i].text = typeArray[ArrayName][(i*3)+2];
			if(typeArray[ArrayName][(i*3)+1]==b) {
				document.verkopen2.typeHack.value = b;
				a = typeArray[ArrayName][(i*3)];
			}
		}
		document.verkopen2.mid.value = ArrayName;
		document.verkopen2.type_id.selectedIndex = a;
	}
}


function SelectWoonplaats(ArrayName,b) {
	document.advertentie.woonplaats_id.length=0;
	var a = 0;
	for(i = 0; i < (woonplaatsArray[ArrayName].length/3); i++) {
		document.advertentie.woonplaats_id.length++;
		document.advertentie.woonplaats_id.options[i].value = woonplaatsArray[ArrayName][(i*3)];
		document.advertentie.woonplaats_id.options[i].text = woonplaatsArray[ArrayName][(i*3)+2];
		if(woonplaatsArray[ArrayName][(i*3)+1]==b) {
			document.advertentie.woonplaatsHack.value = b;
			a = woonplaatsArray[ArrayName][(i*3)];
		}
	}
	document.advertentie.provincie_id.value = ArrayName;
	document.advertentie.woonplaats_id.selectedIndex = a;
}

function StoreTypeHack(x) {
	document.kopen.th.value = typeArray[document.kopen.mid.value][(x*3)+1];
}
function StoreTypeHackVerkopen(x) {
	document.verkopen.th.value = typeArray[document.verkopen.mid.value][(x*3)+1];
}
function StoreTypeHackVerkopen2(x) {
	document.verkopen2.th.value = typeArray[document.verkopen2.mid.value][(x*3)+1];
}

function StoreWoonplaatsHack(x) {
	document.advertentie.woonplaatsHack.value = woonplaatsArray[document.advertentie.provincie_id.value][(x*3)+1];
}

function StoreValuesToGreep() {
	if(document.greep) {
		document.greep.mid.value = document.kopen.mid.value;
		document.greep.th.value = document.kopen.th.value;
		document.greep.v.value = document.kopen.v.value;
	}
}

function StoreValuesToKopen() {
	document.kopen.bid.value = document.greep.bid.value;
	document.kopen.bmin.value = document.greep.bmin.value;
	document.kopen.bmax.value = document.greep.bmax.value;
}

function launchRemote(URL) {
	remote = window.open(URL,"remote","height=526,width=780,left=10,top=40,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,z-lock=0");
	remote.window.focus();
}
function launchRemoteF(URL) {
	remote = window.open(URL,"remote","height=600,width=500,left=100,top=0,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,z-lock=0");
	remote.window.focus();
}

function TabNext(obj,event,len,next_field){
    var obj_val;
    var field_length;
    if (event == "down"){
        field_length=obj.value.length;
    }
    else if (event == "up"){
        if (obj.value.length != field_length) {
            field_length=obj.value.length;
            if (field_length == len) {
                next_field.focus();
            }
        }
    }
}


