function strpos (haystack, needle, offset) 
{ 
	var i = (haystack+'').indexOf(needle, (offset ? offset : 0)); 
	return i === -1 ? false : i; 
}

function frm(getal,aantalDecimalen)
{
	var result;
	var tt;
	result=(Math.round(getal*(Math.pow(10,aantalDecimalen))))/(Math.pow(10,aantalDecimalen));
	result+=""; // maak er tekst van
	result=result.replace(".",",");
	
	if(!strpos(result,","))
	{
		result+=",";
		for(tt=0;tt<aantalDecimalen;tt++)
		{
			result+="0";
		}
	}
	else
	{
		for(tt=0;tt<aantalDecimalen-(result.length-strpos(result,",",0)-1);tt++)
		{
			result+="0";
		}
	}
	return result;
}

function getVal(strValue)
{
	strValue=strValue.replace(",",".");
	var strValidSet = "0123456789.";
	var strFinal =""
   for(i = 0; i < strValue.length; i++)     
   {
        strChar = strValue.charAt(i);
        if (strValidSet.indexOf(strChar) != -1) 
        {
           strFinal = strFinal + strChar;
        }
   }
	iValue = parseFloat(strFinal)
}

function Select_Value_Set(SelectName, Value) {
  for(index = 0; 
    index < SelectName.length; 
    index++) {
   if(SelectName[index].value == Value)
     SelectName.selectedIndex = index;
   }
}

function trim(value) {
  value = value.replace(/^\s+/,''); 
  value = value.replace(/\s+$/,'');
  return value;
}

function sLeft(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function Trim(value) {
  value = value.replace(/^\s+/,''); 
  value = value.replace(/\s+$/,'');
  return value;
}

function isNumeric(vTestValue)
{
	// put the TEST value into a string object variable
	var sField = new String(Trim(vTestValue));
	
	// check for a length of 0 - if so, return false
	if(sField.length==0) { return false; }
	else if(sField.length==1 && (sField.charAt(0) == '.' || sField.charAt(0) == ',')) { return false; }
	
	// loop through each character of the string
	for(var x=0; x < sField.length; x++) {
		// if the character is < 0 or > 9, return false (not a number)
		if((sField.charAt(x) >= '0' && sField.charAt(x) <= '9') || sField.charAt(x) == '.' || sField.charAt(x) == ',') { /* do nothing */ }
		else { return false; }
	}
	
	// made it through the loop - we have a number
	return true;
}

function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
}


//----------------------------------------------------
//bookmarktitel
function bookmarktitel()
{
	var locarray=document.location.href.split("?");
	var qs=locarray[1];
	//alert(document.title.replace(" ","%20"));
	var myregexp=/ /g;
	var dt=document.title.replace("Licata Vini - ","");
	qs=qs.replace("bm=1&ttl=" + dt.replace(myregexp,"%20") + "&","");
	document.location=locarray[0] + "?bm=1&ttl=" + dt + "&" + qs;
}
//----------------------
//bookmarktitel
function geefbookmarktitel()
{
	var myregexp=/ /g;
	var dt=document.title.replace("Licata Vini - ","");
	dt=dt.replace(myregexp,"%20");
	return dt;
}
//-->
//-------------------------------------------------------------------
<!-- code voor tooltips -->
<!-- BELANGRIJK: dit stukje code moet altijd binnen de body staan van de betreffende pagina om de tooltip weer te geven: <div id="mydiv" style="position: absolute;z-index:1;visibility: visible"></div>-->
var x1;
var y1;
//---------------------------------------------------------------------
function mouseMoven(ev){ 
    var mousePageX, mousePageY; 
    if(!ev)ev = window.event; 
    if(typeof ev.pageY == 'number'){  //mozilla,  Netscape, Opera 7 
        mousePageX = ev.pageX; 
        mousePageY = ev.pageY; 
    }else{  // IE, Opera <= 6 
        mousePageX = ev.clientX; 
        mousePageY = ev.clientY; 
        if(!self.opera){  //not Opera <= 6 
            if((!document.compatMode)|| 
              (document.compatMode == 'BackCompat')){ 
                mousePageX += document.body.scrollLeft; 
                mousePageY += document.body.scrollTop; 
            }else{ 
                mousePageX += document.documentElement.scrollLeft; 
                mousePageY += document.documentElement.scrollTop; 
            } 
        } 
    } 
    x1 = mousePageX;
		y1 = mousePageY; 
} 
//---------------------------------------------------
function setCookie(cookieName,cookieValue,cookiePath,cookieExpires)
{
	cookieValue=escape(cookieValue);
	
	if(cookieExpires=="")
	{
		var nowDate= new Date();
		nowDate.setMonth(nowDate.getMonth()+3);
		cookieExpires=nowDate.toGMTString();
	}
	
	if(cookiePath!="")
	{
	  cookiePath= ";Path=" + cookiePath;
	}
	document.cookie=cookieName + "=" + cookieValue + ";expires=" + cookieExpires + cookiePath;
}
//--------------------------------------------------------
function getCookieValue(cookieName)
{
	var cookieValue=document.cookie;
	var cookieStartAt=cookieValue.indexOf(" " + cookieName + "=");
	
	if(cookieStartAt == -1)
	{
		cookieStartAt=cookieValue.indexOf(cookieName + "=");
	}
	
	if(cookieStartAt==-1)
	{
		cookieValue=null;
	}
	else
	{
		cookieStartAt=cookieValue.indexOf("=", cookieStartAt) + 1;
		var cookieEndAt = cookieValue.indexOf(";", cookieStartAt);
		if(cookieEndAt==-1)
		{
			cookieEndAt=cookieValue.length;
		}
		cookieValue=unescape(cookieValue.substring(cookieStartAt,cookieEndAt));
	}
	return cookieValue;
}
//------------------------------------------------
// verwijs hier altijd met document.forms.elements naar het element en niet met document.getElementById !!!
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
//---------------------------------------------------
// verwijs hier altijd met document.forms.elements naar het element en niet met document.getElementById !!!
function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}
//---------------------------------------------------
function getHTTPObject() 
{
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
	if (window.XMLHttpRequest)
	{
	  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
		{
    	try 
			{
          // If IE7, Mozilla, Safari, etc: Use native object
          xmlhttp = new XMLHttpRequest()
			}
			catch (e) 
			{
    	  xmlhttp = false;
    	}
		}
  }
	else 	
	{
		if (window.ActiveXObject)
		{
      // ...otherwise, use the ActiveX control for IE5.x and IE6
  		  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    }
	}
  return xmlhttp;
}
//---------------------------------------------------
var tooltipTimeout;
function ShowTooltip(tekst,breedte,titel,ntop,nleft)
{
		//alert(tekst + "," + breedte + "," + titel + "," + ntop + "," + nleft);
		if(titel=="undefined" || titel==null)
		{
			titel="";
		}
		if(nleft=="undefined" || nleft==null || nleft==-1)
		{
			nleft=-1;
		}
		if(ntop=="undefined" || ntop==null || ntop==-1)
		{
			ntop=-1;
		}
		var myReg=/\\/g;
		tekst=tekst.replace(myReg,'',tekst);
		if(browser=="Netscape Navigator")
		{
			document.mylayer.innerHTML="";
			if(tekst=="" || tekst=="undefined"  || tekst.length<3)
			{
	    	document.mylayer.innerHTML="";
			}
			else
			{
			  if(breedte!=0)
				{
					myReg=/§/g;
					tekst=tekst.replace(myReg,"'",tekst);
		   	 	titel=titel.replace(myReg,"'",titel);
	   	 	  document.mylayer.innerHTML="<table width='" + breedte + "' cellspacing='0' cellpadding='2' style='border: 1px solid #C0C0C0; background-color: white; filter: progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=4);'><tr><td width='30' style='background-color: #c6cab3;'><img src='/images/knoppen/info.gif' width='22' height='22' border='0' alt=''></td><td style='background-color: #c6cab3;' align='left'><p class='txt'><b>" + unescape(titel) + "</b></p></td></tr><tr><td colspan='2'><p class='txt'>" + unescape(tekst) + "</p></td></tr></table>";
				}
				else
				{
					myReg=/§/g;
					tekst=tekst.replace(myReg,"'",tekst);
		   	 	titel=titel.replace(myReg,"'",titel);
				  document.mylayer.innerHTML="<table cellspacing='0' cellpadding='2' style='border: 1px solid #C0C0C0; background-color: white; filter: progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=4);'><tr><td width='30' style='background-color: #c6cab3;'><img src='/images/knoppen/info.gif' width='22' height='22' border='0' alt=''></td><td style='background-color: #c6cab3;' align='left'><p class='txt'><b>" + unescape(titel) + "</b></p></td></tr><tr><td colspan='2'><p class='txt'>" + unescape(tekst) + "</p></td></tr></table>";
				}
			}
			if(nleft=="undefined" || nleft==null || nleft==-1)
			{
				if(x1>window.width/2)
				{
			  	document.mylayer.left=x1+15-document.mylayer.left;
				}
				else
				{
					document.mylayer.left=x1+15;
				}
			}
			else
			{
				document.mylayer.left=nleft;
			}
			if(ntop=="undefined" || ntop==null || ntop==-1)
			{
	 	  	document.mylayer.top=y1+15;
			}
			else
			{
				document.mylayer.top=ntop;
			}
		}
		else
		{
			mydiv.innerHTML="";
			if(tekst=="" || tekst=="undefined"  || tekst.length<3)
			{
	    	mydiv.innerHTML="";
			}
			else
			{
			  var myRegExp=/\\/g;
			  if(breedte!=0)
				{
					myReg=/§/g;
					tekst=tekst.replace(myReg,"'",tekst);
		   	 	titel=titel.replace(myReg,"'",titel);
					mydiv.innerHTML="<table width='" + breedte + "' cellspacing='0' cellpadding='2' style='border: 1px solid #C0C0C0; background-color: white; filter: progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=4);'><tr><td width='30' style='background-color: #c6cab3; filter:alpha(opacity=95);'><img src='/images/knoppen/info.gif' width='22' height='22' border='0' alt=''></td><td style='background-color: #c6cab3;' align='left'><p class='txt'><b>" + unescape(titel) + "</b></p></td></tr><tr><td colspan='2'><p class='txt'>" + unescape(tekst) + "</p></td></tr></table>";
				}
				else
				{
					myReg=/§/g;
					tekst=tekst.replace(myReg,"'",tekst); // was white en F2F1E5
		   	 	titel=titel.replace(myReg,"'",titel);
		   	 	mydiv.innerHTML="<table cellspacing='0' cellpadding='2' style='border: 1px solid #C0C0C0; background-color: white; filter: progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=4);'><tr><td width='30' style='background-color: #c6cab3; filter:alpha(opacity=95);'><img src='/images/knoppen/info.gif' width='22' height='22' border='0' alt=''></td><td style='background-color: #c6cab3;' align='left'><p class='txt'><b>" + unescape(titel) + "</b></p></td></tr><tr><td colspan='2'><p class='txt'>" + unescape(tekst) + "</p></td></tr></table>";
				}
			}
			if(browser=="Mozilla Firefox")
			{
				if(nleft=="undefined" || nleft==null || nleft==-1)
				{
					if(x1>window.outerWidth-400)
					{
			  		mydiv.style.left=x1-mydiv.offsetWidth/2;
					}
					else
					{
						mydiv.style.left=x1+10;
					}
				}
				else
				{
					mydiv.style.left=nleft;
				}
				if(ntop=="undefined" || ntop==null || ntop==-1)
				{
					if(y1>window.outerHeight-100)
					{
						//alert(window.outerHeight);
			  		mydiv.style.top=y1-10-mydiv.offsetHeight;
					}
					else
					{
						mydiv.style.top=y1+10;
					}
				}
				else
				{
					mydiv.style.top=ntop;
				}
			}
			else
			{
				if(nleft=="undefined" || nleft==null || nleft==-1)
				{
					if(x1>document.body.clientWidth-400)
					{
			  		mydiv.style.pixelLeft= event.clientX + document.body.scrollLeft-mydiv.clientWidth/2;
					}
					else
					{
						mydiv.style.pixelLeft= event.clientX + document.body.scrollLeft+10;
					}
				}
				else
				{
				  mydiv.style.pixelLeft=nleft;
				}
				if(ntop=="undefined" || ntop==null || ntop==-1)
				{
					if(y1>document.body.clientHeight-150)
					{
			  		mydiv.style.pixelTop= event.clientY + document.body.scrollTop-10-mydiv.clientHeight;
					}
					else
					{
						mydiv.style.pixelTop= event.clientY + document.body.scrollTop+10;
					}
				}
				else
				{
					mydiv.style.pixelTop=ntop;
				}
			}
		}
		
}
//---------------------------------------------------
function ShowTooltip2(tekst,breedte,titel,ntop,nleft)
{
		clearTimeout(tooltipTimeout);
		var myRegExp=/,/g;
		titel=titel.replace(myRegExp,"%2C");
		tekst=tekst.replace(myRegExp,"%2C");
		var myRegExp2=/,/g;
		titel=titel.replace(myRegExp2,"%2C");
		tekst=tekst.replace(myRegExp2,"%2C");
		//alert("ShowTooltip2('" + tekst + "'," + breedte + ",'" + titel + "'," + ntop + "," + nleft + ")");
		tooltipTimeout=setTimeout("ShowTooltip2(\"" + tekst + "\"," + breedte + ",\"" + titel + "\"," + ntop + "," + nleft + ")",500);
}
//---------------------------------------------------
function HideTooltip()
{
	if(browser=="Netscape Navigator")
	{
		document.mylayer.innerHTML="";
	}
	else
	{	
	  mydiv.innerHTML="";
	}
}
//-------------------------------------------------------
document.onmousemove = mouseMoven; 
//-------------------------------------------------------
var schermbreed=0;
function schermbreedte()
{
	if(browser=="Netscape Navigator")
	{
		schermbreed=window.width;
	}
	else if(browser=="Mozilla Firefox")
	{
		schermbreed=window.outerWidth;
	}
	else
	{
		schermbreed=document.body.clientWidth;
	}
}
//-->


 // this function is needed to work around 
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   

 function zebra(id) {

    // the flag we'll use to keep track of 
    // whether the current row is odd or even
    var even = false;
  
    // if arguments are provided to specify the colours
    // of the even & odd rows, then use the them;
    // otherwise use the following defaults:
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
    // obtain a reference to the desired table
    // if no such table exists, abort
    var table = document.getElementById(id);
    if (! table) { return; }
    
    // by definition, tables can have more than one tbody
    // element, so we'll have to get the list of child
    // &lt;tbody&gt;s 
    var tbodies = table.getElementsByTagName("tbody");

    // and iterate through them...
    for (var h = 0; h < tbodies.length; h++) {
    
     // find all the &lt;tr&gt; elements... 
      var trs = tbodies[h].getElementsByTagName("tr");
      
      // ... and iterate through them
      for (var i = 0; i < trs.length; i++) {

        // avoid rows that have a class attribute
        // or backgroundColor style
        if (! hasClass(trs[i]) &&
            ! trs[i].style.backgroundColor) {
 		  
          // get all the cells in this row...
          var tds = trs[i].getElementsByTagName("td");
        
          // and iterate through them...
          for (var j = 0; j < tds.length; j++) {
        
            var mytd = tds[j];

            // avoid cells that have a class attribute
            // or backgroundColor style
            if (! hasClass(mytd) &&
                ! mytd.style.backgroundColor) {
        
              mytd.style.backgroundColor =
                even ? evenColor : oddColor;
            
            }
          }
        }
        // flip from odd to even, or vice-versa
        even =  ! even;
      }
    }
  }

//-----------------------------------------------------
function changeClass(id, newClass) 
{
	identity=document.getElementById(id);
	if(identity.className!=newClass)
	{
		identity.className=newClass;
	}
}
//
function makeFieldset(nBreedte,sKleur,sTitel,nTitelbreedte,sInhoud)
{
	//alert(sInhoud);
	var sFieldset="";
	sFieldset=sFieldset + "<table width=\'" + nBreedte + "\' border=\'0\' cellspacing=\'0\' cellpadding=\'0\' style=\'border-bottom-color: " + sKleur + "; border-bottom-style: solid; border-bottom-width: 1px;\'>";
	sFieldset=sFieldset + "<tr height=\'12\'>";
	sFieldset=sFieldset + "<td width=\'10\' style=\'border-bottom-color: " + sKleur + "; border-bottom-style: solid; border-bottom-width: 1px;\'><font style=\'font-family: Verdana; font-size: 1px;\'>&nbsp;</font></td>";
	sFieldset=sFieldset + "<td width=\'5\' rowspan=\'2\'><font style=\'font-family: Verdana; font-size: 1px;\'>&nbsp;</font></td>";
	sFieldset=sFieldset + "<td align=\'left\' rowspan=\'2\' width=\'" + nTitelbreedte + "\'><font color=\'" + sKleur + "\' style=\'font-family: Verdana; font-size: 10px;\'><b>" + sTitel + "</b></font></td>";
	sFieldset=sFieldset + "<td width=\'5\' rowspan=\'2\'><font style=\'font-family: Verdana; font-size: 1px;\'>&nbsp;</font></td>";
	sFieldset=sFieldset + "<td width=\'" + (nBreedte-nTitelbreedte-20) + "\' style=\'border-bottom-color: " + sKleur + "; border-bottom-style: solid; border-bottom-width: 1px;\'><font style=\'font-family: Verdana; font-size: 1px;\'>&nbsp;</font></td>";
	sFieldset=sFieldset + "</tr>";
	sFieldset=sFieldset + "<tr height=\'12\'>";
	sFieldset=sFieldset + "<td width=\'10\' style=\'border-left-color: " + sKleur + "; border-left-style: solid; border-left-width: 1px;\'><font style=\'font-family: Verdana; font-size: 1px;\'>&nbsp;</font></td>";
	sFieldset=sFieldset + "<td width=\'" + (nBreedte-nTitelbreedte-20) + "\' style=\'border-right-color: " + sKleur + "; border-right-style: solid; border-right-width: 1px;\'><font style=\'font-family: Verdana; font-size: 1px;\'>&nbsp;</font></td>";
	sFieldset=sFieldset + "</tr>";
	sFieldset=sFieldset + "<tr>";
	sFieldset=sFieldset + "<td colspan=\'5\' align=\'center\' style=\'border-left-color: " + sKleur + "; border-left-style: solid; border-left-width: 1px; border-right-color: " + sKleur + "; border-right-style: solid; border-right-width: 1px;\'>";
	sFieldset=sFieldset + "<table width=\'" + (nBreedte-20) + "\'><tr><td align=\'left\' valign=\'top\'><div id=\'fieldsetdiv\'>" + sInhoud + "</div></td></tr></table>";
	sFieldset=sFieldset + "<font style=\'font-family: Verdana; font-size: 5px;\'><br><br></font>";
	sFieldset=sFieldset + "</td>";
	sFieldset=sFieldset + "</tr>";
	sFieldset=sFieldset + "</table>";
	
	document.write(sFieldset);
}
// get the true offset of anything on NS4, IE4/5 & NS6, even if it's in a table!
function getAbsX(elt) { return (elt.x) ? elt.x : getAbsPos(elt,"Left"); }
function getAbsY(elt) { return (elt.y) ? elt.y : getAbsPos(elt,"Top"); }
function getAbsPos(elt,which) {
 iPos = 0;
 while (elt != null) {
  iPos += elt["offset" + which];
  elt = elt.offsetParent;
 }
 return iPos;
}


//EMAIL CHECKER
<!-- Changes:  Sandeep V. Tamhankar (stamhankar@hotmail.com) -->

/* 1.1.2: Fixed a bug where trailing . in e-mail address was passing
            (the bug is actually in the weak regexp engine of the browser; I
            simplified the regexps to make it work).
   1.1.1: Removed restriction that countries must be preceded by a domain,
            so abc@host.uk is now legal.  However, there's still the 
            restriction that an address must end in a two or three letter
            word.
     1.1: Rewrote most of the function to conform more closely to RFC 822.
     1.0: Original  */

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function emailCheck (emailStr) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	//alert("Email address seems incorrect (check @ and .'s)")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    //alert("The username doesn't seem to be valid.")
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!")
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	//alert("The domain name doesn't seem to be valid.")
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   //alert("The address must end in a three-letter domain, or two letter country.")
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
   //alert(errStr)
   return false
}

// If we've gotten this far, everything's valid!
return true;
}
//  End -->
// controleert maximale lengte van een textarea
// <textarea maxlength="50" onkeyup="return ismaxlength(this)"></textarea>
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}

