String.prototype.trim = function() {
	a = this.replace(/^\s+/, '');
	return a.replace(/\s+$/, '');
};
function popupWindow( Page, Width, Height )
{
	popWindow = window.open( Page,"popWindow","width="+(Width*1+18)+",height="+(Height*1+18)+",scrollbars=0,left="+((screen.width-Width/2))+",top="+((screen.height-Height/2))).focus();
}

function checkMail(form_name,email_field)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test( eval("document."+form_name+"."+email_field+".value" )))
		return true;
	else
		return false;
}

function validateContactForm()
{

	x=document.contact;
	Fields=new Array("letters", "last_name", "email");

	for(i=0;i<Fields.length;i++)
	{
		
		if(eval("x."+Fields[i]+".value.trim()")=="")
		{
			
			al='De volgende velden moeten ingevuld worden c.q. correct ingevuld worden:\n';
			for(j=0;j<Fields.length;j++)
			{
				if(eval("x."+Fields[j]+".value.trim()")=="")
					switch(Fields[j])
					{
						case "letters": al=al+' *  Voorletters\n'; break;
						case "last_name": al=al+' *  Achternaam\n'; break;
						case "email": al=al+' *  E-mailadres\n'; break;						
						default:  break;
					}
			}
			
			alert(al);		
			eval("x."+Fields[i]+".focus()");
			return false;
		}
	}
	if(x.ocupation[4].checked && x.ocupation_text.value.trim()=="")
	{
		alert('Please enter your ocupation.');
		x.ocupation_text.focus();
		return false;
	}
	if(!checkMail('contact','email'))
	{
		alert('Invalid e-mail address');
		x.email.focus();
		return false;
	}
	
	x.submit();
	
}

function changeImage(){
	  if (document.all){
	      document.images.image.style.filter="blendTrans(duration=2)";
	      document.images.image.style.filter="blendTrans(duration=crossFadeDuration)";
	      document.images.image.filters.blendTrans.Apply();
	   }
	   document.images.image.src = preLoad[j].src;
	   if(preLoad[j].speed != 0) slideShowSpeed = preLoad[j].speed*1000;
	   else slideShowSpeed = 5000;
	   if (document.all){
	      document.images.image.filters.blendTrans.Play();
	   }
	   j = j + 1;
	   if (j > (p-1)) j=0;
	   t = setTimeout('changeImage()', slideShowSpeed);
}
function changeActMenu( Status , Act)
{
	if(Status == 'on') {
    document.getElementById('li'+Act).className="active";
  }else{
    document.getElementById('li'+Act).className="notActive";
  }
}

