function checkForm(k)
{   
    var gvnaam, gnaam, gtel, gemail, gjaar, geuro, gurl, gmessage, goptreden, gaantal;
    with(window.document.gf)
    {
        gvnaam    = vnaam;
		gnaam    = naam;
        gtel     = tel;
        gemail   = email;
		gmessage = p;
		goptreden = optreden;
		gaantal   = aantal;
		 }
	 var i=0, a, b, c, d, k, m;
	
	 if(trim(gvnaam.value) == '' )
	 { 
	   i++; 
	   a=1;
	   document.getElementById("1").style.backgroundColor="#FFD6D5";
	 }
	
	if(trim(gnaam.value) == '' )
    {
        i++;
		b=1;
		document.getElementById("2").style.backgroundColor="#FFD6D5";  
    }
	
	if(trim(gemail.value) == '' || !isEmail(trim(gemail.value)))
    {
        i++;
		c=1;
		document.getElementById("3").style.backgroundColor="#FFD6D5";
        
    }
	if(trim(gtel.value) == '' )
    {
        i++;
		d=1;
		document.getElementById("4").style.backgroundColor="#FFD6D5";    
    }
	
	if(a!=1){ document.getElementById("1").style.backgroundColor="#FFFFFF";}
	if(b!=1){ document.getElementById("2").style.backgroundColor="#FFFFFF";}
	if(c!=1){ document.getElementById("3").style.backgroundColor="#FFFFFF";}
	if(d!=1){ document.getElementById("4").style.backgroundColor="#FFFFFF";}
	
	
	if ( i > 1)
	{ alert("Controleert u aub de gemerkte velden. ");
	
	 if(a==1){gvnaam.focus()}
	 
	 else if(b==1){gnaam.focus()}
	 
	 else if(c==1){gemail.focus()}
	 
	 else if(a==1){gtel.focus()}
	 
	 return false
	
	}
	
	
	
	
	else
	
	
    if(trim(gvnaam.value) == ''  && i==1)
    {
        alert("Controleer aub het veld 'Voorletters/ voornaam'. ");
		document.getElementById("1").style.backgroundColor="#FFD6D5";
        gvnaam.focus();
		
        return false;
    }
    else if(trim(gnaam.value) == ''  && i==1)
    {
        alert("Controleer aub het veld 'Naam'. ");
		document.getElementById("2").style.backgroundColor="#FFD6D5";
        gnaam.focus();
        return false;
    }
	
	 else if(trim(gemail.value) == '' || !isEmail(trim(gemail.value)) && i==1)
    {
        alert("Controleer aub uw email-adres. ");
		document.getElementById("3").style.backgroundColor="#FFD6D5";
        gemail.focus();
        return false;
    }
	
	else if(trim(gtel.value) == ''  && i==1)
    {
        alert("Controleer aub uw telefoonnummer. ");
		document.getElementById("4").style.backgroundColor="#FFD6D5";
        gtel.focus();
        return false;
    }
    
	else if (goptreden.selectedIndex !=0 && gaantal.selectedIndex=='')
	{
		 alert("Selecter aub het aantal kaartjes. "); 
	     return false;
		 
	}
	
    else if (trim(gmessage.value) == '' && k==0)
	{
		 alert("Voer aub uw reservering, vraag of opmerking in. "); 
	     return false;
		 
	}
	 
	
	else
	{
	//alert(goptreden.options[1].value);
	//alert(m);
	//alert(gaantal.value);
	//alert(goptreden.value);
	
    return true;
	
    }
}
function trim(str)
{
    return str.replace(/^\s+|\s+$/g,'');
}

function trimR(str)
{
    return str.replace(/\s+$/g,'');
}


function isEmail(str)
{
    var regex = /^[-_.a-z0-9]+@(([-a-z0-9]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i;
    return regex.test(str);
}
function isUrl(str) {
        var regex = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i;
        return regex.test(str);
}


function isPrijs(str) {
	     var regex = /^\d{1}[\d,\.]{0,4}$/i;
		 return regex.test(str);
}
		 
function isVNaam(str) {
	     var regex = /^[A-Za-z][A-za-z-.\']*$/i;
		 return regex.test(str);
}


function isNaam(str) {
	     var regex = /^[A-za-z-.\'\s]*$/i;
		 return regex.test(str);
}




function isNummer(str) {
var	g=document.gf.tel.value;
	if (g.indexOf('-')!= -1 || g.indexOf(' ')!= -1)
	    
	
	{
	     var regex = /^[0-9][-0-9\s]{10,14}$/i;
		 return regex.test(str);
    }
	else
	{
		
		 var regex = /^[0-9][0-9]{9,14}$/i;
		 return regex.test(str);
		 }
	
	
}


function addemoticos(smilie)
{
    document.gf.p.value += ' ' + smilie + ' ';
}
function addhtml(html)
{
    document.gf.p.value += ' ' + html + ' ';
}

function addhtml2(html)
{
    document.gf.tijd.value += ' ' + html + ' ';
}


