function go(action)
{
	switch(action)
	{
		case "getprice":
		SaveAvailability(action);
		break
		case "personal":
		document.frmPrice.submit();
		break;
		case "options":
		if(validatePersonal())
		{
			document.frmPersonal.submit();
		}
		break;
		case "confirm":		
		document.frmOptions.submit();		
		break;
		case "saveorder":		
		document.frmConfirm.submit();		
		break;
	}
}

function checkIfNan(id)
{
	if(isNaN(document.getElementById(id).value))
	{
		alert("Hier kan alleen een getal ingevuld worden");
		document.getElementById(id).value = 1;
		document.getElementById("option_" + id).checked = true;	
		return false;
	}
	else
	{
		if(document.getElementById(id).value > 0)
		{
			document.getElementById("option_" + id).checked = true;	
			document.getElementById("checked_" + id).value = 1;
		}
		else
		{
			document.getElementById("option_" + id).checked = false;
		}
		
		return true;
	}
}

function setAmount(id)
{
	if(document.getElementById("option_" + id).checked)
	{
		document.getElementById("checked_" + id).value = 1;
		document.getElementById(id).value =  document.getElementById(id).value == "" ? 1 : document.getElementById(id).value;
	}
	else
	{
		document.getElementById("checked_" + id).value = 0;
		document.getElementById(id).value = "";
	}	
}

function validatePersonal()
{
	var ThisForm = document.frmPersonal;
  	var blnValid = true;
  	var strError = "";	
  	
  	if(ThisForm.Initials.value == "")
  	{		
		strError += "Voorletters zijn verplicht \n";
		blnValid = false;
	}	
  	if(ThisForm.LastName.value == "")
  	{		
		strError += "Achternaam is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.Address.value == "")
  	{		
		strError += "Adres is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.PostalCode.value == "")
  	{		
		strError += "Postcode is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.City.value == "")
  	{		
		strError += "Woonplaats is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.Country.value == "")
  	{		
		strError += "Land is verplicht \n";
		blnValid = false;
	}			
  	if(ThisForm.Telephone.value == "")
  	{		
		strError += "Telefoonnummer is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.Email.value == "")
  	{		
		strError += "Email is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.BirthDay.value == "" || ThisForm.BirthMonth.value == "" || ThisForm.BirthYear.value == "")
  	{		
		strError += "Geboortedatum is niet compleet \n";
		blnValid = false;
	}
	if(ThisForm.Nationality.value == "")
  	{		
		strError += "Nationaliteit is verplicht \n";
		blnValid = false;
	}
	if(blnValid)
	{	  
  		return true;
	}
	else
	{
	  alert(strError);
	}  
}

function pricePerSelected()
{	
  var ThisForm = document.frmTaxes;	                      
  ThisForm.pricePer.value = ThisForm.drdPricePer.options[ThisForm.drdPricePer.options.selectedIndex].value;
  
}
function pricePerSelected2()
{	
  var ThisForm = document.frmTarifs;	                      
  ThisForm.pricePer.value = ThisForm.drdPricePer.options[ThisForm.drdPricePer.options.selectedIndex].value;
  
}
function periodSelected()
{	
  var ThisForm = document.frmTarifs;	                      
  ThisForm.period.value = ThisForm.drdPeriod.options[ThisForm.drdPeriod.options.selectedIndex].value;
  
}

function SaveTarif(action)
{
	var ThisForm = document.frmTarifs;
  	var blnValid = true;
  	var strError = "";
  	
  	if(ThisForm.period.value == "")
  	{		
		strError += "Periode is verplicht \n";
		blnValid = false;
	}	
	if(ThisForm.price.value == "")
  	{		
		strError += "Prijs is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.pricePer.value == "")
  	{		
		strError += "Prijs per is verplicht \n";
		blnValid = false;
	}
	
	if(blnValid)
	{
		var Regex = /(^(0|[1-9][0-9]*)$)|((^(0?|[1-9][0-9]*)\.(0*[1-9][0-9]*)$)|(^[1-9]+[0-9]*\.0+$)|(^0\.0+$))/
		if(!Regex.test(ThisForm.price.value))
		{
			strError += "Prijs is ongeldig \n";
			blnValid = false;
		}

	}
	if(blnValid)
	{	  
  		ThisForm.btnAction.value = action ;
		ThisForm.submit();
	}
	else
	{
	  alert(strError);
	}  
}

function delTarif(id)
{
	if(!confirm("Weet je zeker dat je dit item wilt verwijderen?"))
	{
		return;
	}
	else
	{
		document.location.href='index.php?pageid=37&itemid=1&action=edit&go=tarifs&subid=' + id + '_delTarif';
	}
}


function SaveTax(action)
{
	var ThisForm = document.frmTaxes;
  	var blnValid = true;
  	var strError = "";
  	
  	if(ThisForm.nameNL.value == "")
  	{		
		strError += "Naam (NL) is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.nameEN.value == "")
  	{		
		strError += "Naam (EN) is verplicht \n";
		blnValid = false;
	}	
	if(ThisForm.price.value == "")
  	{		
		strError += "Prijs is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.pricePer.value == "")
  	{		
		strError += "Prijs per is verplicht \n";
		blnValid = false;
	}
	if(blnValid)
	{
		var Regex = /(^(0|[1-9][0-9]*)$)|((^(0?|[1-9][0-9]*)\.(0*[1-9][0-9]*)$)|(^[1-9]+[0-9]*\.0+$)|(^0\.0+$))/
		if(!Regex.test(ThisForm.price.value))
		{
			strError += "Prijs is ongeldig \n";
			blnValid = false;
		}

	}
	if(blnValid)
	{	  
  		ThisForm.btnAction.value = action ;
		ThisForm.submit();
	}
	else
	{
	  alert(strError);
	}  
}


function delTax(id)
{
	if(!confirm("Weet je zeker dat je dit item wilt verwijderen?"))
	{
		return;
	}
	else
	{
		document.location.href='index.php?pageid=37&itemid=1&action=edit&go=taxes&subid=' + id + '_delTax';
	}
}

function checkDecimalSeperator(id)
{
	if(event.keyCode == 188)
	{
		document.getElementById(id).value = document.getElementById(id).value.replace(",", ".");
	}	
}

function delOption(id)
{
	if(!confirm("Weet je zeker dat je dit item wilt verwijderen?"))
	{
		return;
	}
	else
	{
		document.location.href='index.php?pageid=37&itemid=1&action=edit&go=options&subid=' + id + '_delOption';
	}
}


function SaveOption(action)
{
	var ThisForm = document.frmOptions;
  	var blnValid = true;
  	var strError = "";
  	
  	if(ThisForm.nameNL.value == "")
  	{		
		strError += "Naam (NL) is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.nameEN.value == "")
  	{		
		strError += "Naam (EN) is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.descriptionNL.value == "")
  	{		
		strError += "Omschrijving (NL) is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.descriptionEN.value == "")
  	{		
		strError += "Omschrijving (EN) is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.price.value == "")
  	{		
		strError += "Prijs is verplicht \n";
		blnValid = false;
	}
	if(blnValid)
	{
		var Regex = /(^(0|[1-9][0-9]*)$)|((^(0?|[1-9][0-9]*)\.(0*[1-9][0-9]*)$)|(^[1-9]+[0-9]*\.0+$)|(^0\.0+$))/
		if(!Regex.test(ThisForm.price.value))
		{
			strError += "Prijs is ongeldig \n";
			blnValid = false;
		}

	}
	if(blnValid)
	{	  
  		ThisForm.btnAction.value = action ;
		ThisForm.submit();
	}
	else
	{
	  alert(strError);
	}  
}

function SaveAvailability(action)
{
	var ThisForm = document.frmAvailability;
  	var blnValid = true;
  	var strError = "";
  	
  	if(ThisForm.InputStart.value == "")
  	{		
		strError += "Begindatum is verplicht \n";
		blnValid = false;
	}
	if(ThisForm.InputEnd.value == "")
  	{		
		strError += "Einddatum is verplicht \n";
		blnValid = false;
	}
	
	if(blnValid)
	{
		var datum1  = back_date(ThisForm.InputStart.value);
        var datum2  = back_date(ThisForm.InputEnd.value);
        var vandaag = new Date("yyyy-MM-dd");
        if  (isNaN(datum1) || isNaN(datum2)) 
        {
	          strError += "Een datum bestaat uit twee cijfers voor de dag en maand \n en 4 voor het jaar, gescheiden door een \"/\" (forward slash).";
	          ThisForm.InputStart.focus();
	          blnValid = false;
        }

        if (isNaN(datum2) ) 
        {
              //alert(f.returnDate);
              strError += "Een datum bestaat uit twee cijfers voor de dag en maand \n en 4 voor het jaar, gescheiden door een \"/\" (forward slash).";
              ThisForm.InputEnd.focus();
              blnValid = false;
        }
        if(datum2 <= datum1)
        {
        	strError += "Begindatum kan niet groter of gelijk zijn dan de einddatum.";
	        blnValid = false;
        }
        
	}

	if(blnValid)
	{	  
  		ThisForm.btnAction.value = action ;
		ThisForm.submit();
	}
	else
	{
	  alert(strError);
	}  
	
}

function delAvailability(id)
{
	if(!confirm("Weet je zeker dat je dit item wilt verwijderen?"))
	{
		return;
	}
	else
	{
		document.location.href='index.php?pageid=37&itemid=1&action=edit&go=availability&subid=' + id + '_delAvailability';
	}
}

function Save(action)
{
	var ThisForm = document.frmAccodetails;
	  var blnValid = true;
	  var strError = "";	
		
		if(action == "cancel")
		{
		  blnValid = true;	  
		}
		else
		{	  
			if(ThisForm.accoName.value == "")
		  	{		
				strError += "Naam is verplicht \n";
				blnValid = false;
			}  
		}
			
		if(blnValid)
		{	  
	  		ThisForm.btnAction.value = action ;
			ThisForm.submit();
		}
		else
		{
		  alert(strError);
		}  
}

/*
function Save(action)
{	
	WYSIWYG.stripHTML('DescriptionNL');
	WYSIWYG.stripHTML('DescriptionEN');
	WYSIWYG.stripHTML('DescriptionDU');
	WYSIWYG.stripHTML('AccoDescriptionNL');
	WYSIWYG.stripHTML('AccoDescriptionEN');
	WYSIWYG.stripHTML('AccoDescriptionDU');
	WYSIWYG.stripHTML('AccoPropertiesNL');
	WYSIWYG.stripHTML('AccoPropertiesEN');
	WYSIWYG.stripHTML('AccoPropertiesDU');	
    WYSIWYG.updateTextArea('DescriptionNL');
    WYSIWYG.updateTextArea('DescriptionEN');
    WYSIWYG.updateTextArea('DescriptionDU');
    WYSIWYG.updateTextArea('AccoDescriptionNL');
	WYSIWYG.updateTextArea('AccoDescriptionEN');
	WYSIWYG.updateTextArea('AccoDescriptionDU');
	WYSIWYG.updateTextArea('AccoPropertiesNL');
	WYSIWYG.updateTextArea('AccoPropertiesEN');
	WYSIWYG.updateTextArea('AccoPropertiesDU');
  
  
	var ThisForm = document.frmAccodetails;
  var blnValid = true;
  var strError = "";	
	
	if(action == "cancel")
	{
	  blnValid = true;	  
	}
	else
	{	  
		if(ThisForm.name.value == "")
	  	{		
			strError += "Naam is verplicht \n";
			blnValid = false;
		}  
	}
		
	if(blnValid)
	{	  
  		ThisForm.btnAction.value = action ;
		ThisForm.submit();
	}
	else
	{
	  alert(strError);
	}  
}
*/



//aan te passen
vanaf_links = 100;
vanaf_boven = 100;
grootste_breedte  = 800+20;//afmetingen van het grootste beeld +20
grootste_hoogte = 800+20;  //afmetingen van het grootste beeld +20
//hieronder niets wijzigen
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+grootste_breedte+',height='+grootste_hoogte+',left='+vanaf_links+',top='+vanaf_boven;
var optIE='scrollbars=no,width=150,height=100,left='+vanaf_links+',top='+vanaf_boven;
function popBeeld(BeeldURL,BeeldTitel){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Bezig met inladen ...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function aanpassen_aan_beeldgrootte(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["BeeldNaam"].width;');writeln('window.innerHeight=document.images["BeeldNaam"].height;}}');
writeln('function maak_titel(){document.title="'+BeeldTitel+'";}');writeln('</sc'+'ript>');
writeln('</head><body bgcolor=000000 scroll="no" onload="aanpassen_aan_beeldgrootte();maak_titel();self.focus()" onblur="self.close()">');
writeln('<img name="BeeldNaam" src='+BeeldURL+' style="display:block"></body></html>');
close();		
}}

