function openFoto(item) {
	//var venster = window.open('popup_foto.asp?i='+item,'venster','width=340px,height=475px,scrollbars=0');
	//venster.focus();
	popPage('Images','popup_foto.asp?i='+item, 'pop_'+item);
}

function openFotoWWI(item) {
	popPage('Images','popup_foto.asp?wwi='+item, 'pop_'+item);
}

function changeImage(afb) {
	document.getElementById("popupimage").src = '../content_images/large/' + afb;
}	

function openHelp(item) {
	//var venster = window.open('popup_help.asp?i='+item,'venster','width=440px,height=475px,scrollbars=1');
	//venster.focus();
	popPage('help','popup_help.asp?i='+item, 'pop_'+item);
}

function openTerugboek(item) {
	//var venster = window.open('popup_terugboekgarantie.asp?i='+item,'venster','width=540px,height=555px,scrollbars=1');
	//venster.focus();
	popPage('terugboekgarantie','popup_terugboekgarantie.asp?i='+item, 'pop_'+item);
}

function copyValues(soort) {
	if (soort == "prive") {
		document.frmProfile.aflever_adres.value = document.frmProfile.adres.value;
		document.frmProfile.aflever_postcode.value = document.frmProfile.postcode.value;
		document.frmProfile.aflever_plaats.value = document.frmProfile.plaats.value;
		document.frmProfile.aflever_land.value = document.frmProfile.land.value;
	}
	else {
		document.frmProfile.aflever_adres.value = document.frmProfile.zakelijk_adres.value;
		document.frmProfile.aflever_postcode.value = document.frmProfile.zakelijk_postcode.value;
		document.frmProfile.aflever_plaats.value = document.frmProfile.zakelijk_plaats.value;
		document.frmProfile.aflever_land.value = document.frmProfile.zakelijk_land.value;
	}
}

//WP
function openBoxWP(divid) {
	if (document.getElementById(divid).style.display =="block"){
		document.getElementById(divid).style.display ="none";
	}
	else {
		document.getElementById(divid).style.display ="block";
	}
}

//register and profile
function showHide() {
	if (document.frmProfile.prive_zakelijk[0].checked == true) {
		document.getElementById("bedrijfsgegevens").style.display ="none";
		document.getElementById("copycompany").style.display ="none";
	}
	else if (document.frmProfile.prive_zakelijk[1].checked == true) {
		document.getElementById("bedrijfsgegevens").style.display ="block";
		document.getElementById("copycompany").style.display ="block";
	}
}	

// controle en check of actie daadwerkelijk uitgevoerd mag worden
function confirmDelete(tekst){
	var agree=confirm(tekst);
	if (agree)
		return true ;
	else
		return false ;
}

// controle en check of actie daadwerkelijk uitgevoerd mag worden
function confirmAction(tekst){
	var agree=confirm(tekst);
	if (agree)
		return true ;
	else
		return false ;
}

function berekenDatum(invoerdatum, jaren) {
	if (jaren) {
		var d=new Date() 
		var eindjaar = eval(eval(d.getYear()) + eval(jaren));
		d.setYear(eindjaar)
		var dag = d.getDate();
		var maand = d.getMonth();
		var jaar = d.getYear();
		document.formulier.terugkoopgarant_datum.value = dag+'-'+(maand+1)+'-'+jaar;
	}
}

function submitPortForm(actie) {
	if (actie != "") {
		document.frmport.action = actie;
		document.frmport.submit();
	}
}

function showTR(id){
	if (document.getElementById && document.createTextNode) {
		var tr=document.getElementById(id);
		if (tr) {
	  		if (tr.style.display == 'none') {
				// To make tr tags disappear
				// we set display to none, as usual
				// to make them appear again
				// we set style to block for IE
				// but for firefox we use table-row
				try {
			  		tr.style.display='table-row';
				} catch(e) {
				  tr.style.display = 'block';
				}
		  	}
		  	else {
				tr.style.display = 'none';
	  		}
	  	}     
	}
}


/* CHECKBOXES aan of uitvinken*/
function Check(chk)
{
	if(document.frmport.Check_All.value=="Check All"){
		for (i = 0; i < chk.length; i++)
			chk[i].checked = true ;
			document.frmport.Check_All.value="UnCheck All";
	}
	else {
		for (i = 0; i < chk.length; i++)
			chk[i].checked = false ;
			document.frmport.Check_All.value="Check All";
	}
}


//CHECK INPUT ON BID, no comma!
function checkNumeric(objName,minval, maxval,comma,period,hyphen)
{
	var numberfield = objName;
	if (chkNumeric(objName,minval,maxval,comma,period,hyphen) == false)
	{
		numberfield.select();
		numberfield.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function chkNumeric(objName,minval,maxval,comma,period,hyphen)
{
// only allow 0-9 be entered, plus any values passed
// (can be in any order, and don't have to be comma, period, or hyphen)
// if all numbers allow commas, periods, hyphens or whatever,
// just hard code it here and take out the passed parameters
var checkOK = "0123456789" + comma + period + hyphen;
var checkStr = objName;
var allValid = true;
var decPoints = 0;
var allNum = "";

for (i = 0;  i < checkStr.value.length;  i++)
{
ch = checkStr.value.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{	
alertsay = "U kunt alleen hele bedragen invullen, geen cijfers achter de komma.\n"
alertsay = alertsay + "\nPlease insoert only rounded numbers, no comma."
alert(alertsay);
return (false);
}

// set the minimum and maximum
var chkVal = allNum;
var prsVal = parseInt(allNum);
if (chkVal != "" && !(prsVal >= minval && prsVal <= maxval))
{
alertsay = "Please enter a value greater than or "
alertsay = alertsay + "equal to \"" + minval + "\" and less than or "
alertsay = alertsay + "equal to \"" + maxval + "\" in the \"" + checkStr.name + "\" field."
alert(alertsay);
return (false);
}
}
//  End -->


