/*****************************************************************/
/* Common gynzy functions */
/*****************************************************************/

function mailme(thename, thedomain, thesubject)
{
	thedomain = typeof(thedomain) != 'undefined' ? thedomain : 'gynzy.com';
	thesubject = typeof(thesubject) != 'undefined' ? '?Subject=' + escape(thesubject) : '';
	myname = thename + '&#64' + thedomain;
	document.write('<a href="ma'+'ilto:' + myname + thesubject + '">' + myname + '</a>');
}

/* JPD: Yeah, let's create a single function for default checks. later on...*/

function help_checkValues()
{
		if (
			(document.theform.naam.value == '') ||
			(document.theform.email.value == '') ||
			(document.theform.feedback.value == '')
			) 
			{
				alert('Vul aub alle velden in.');
			}
			else
			{
				document.theform.submit();
			}
}


function aanschaf_checkValues()
{
		if (
			(document.theform.naam.value == '') ||
			(document.theform.email.value == '') ||
			(document.theform.brin.value == '')
			) 
			{
				alert('Vul aub alle velden in.');
			}
			else
			{
				document.theform.submit();
			}
}


function aanschaf_checkValues2()
{
	termijn = '';
	borden = document.theform.borden.value;
	// Loop radio buttons
	for (var i=0; i < document.theform.termijn.length; i++)
	{
		if (document.theform.termijn[i].checked)
	    {
	    	termijn = document.theform.termijn[i].value;
	    }
   	}

	if (
		(borden == '') ||
		(borden == 0) ||
		(termijn == '')
		) 
		{
			alert('Vul aub alle velden in.');
		}
		else
		{
			
			// Check voorwaarden 
			if ((!document.theform.costs.checked) ||
				(!document.theform.otherterms.checked)
				)
			{
				alert('Ga aub akkoord met alle voorwaarden');
			}
			else
			{
				document.theform.submit();
			}
		}
}

function aanschaf_checkValuesFinal()
{
	schoolname = (document.theform.schoolname.value != 'Onbekend') ? document.theform.schoolname.value : '';
	address1 = (document.theform.address1.value != 'Onbekend') ? document.theform.address1.value : '';
	address2 = (document.theform.address2.value != 'Onbekend') ? document.theform.address2.value : '';
	address3 = (document.theform.address3.value != 'Onbekend') ? document.theform.address3.value : '';
	
	if (
		(schoolname == '') || (address1 == '') || (address2 == '') || (address3 == '') 
		) 
		{
			alert('Vul aub alle schoolgegevens in.');
		}
		else
		{
		
			// Check voorwaarden 
			if ((document.theform.signature_name.value == '') ||
				(document.theform.signature_date.value == '')
				)
			{
				alert('Onderteken aub het contract');
			}
			else
			{
				document.theform.submit();
			}
		}
}