var isDOM=document.getElementById?1:0,isIE=document.all?1:0,isNS4=navigator.appName=='Netscape'&&!isDOM?1:0,isOp=self.opera?1:0,isDyn=isDOM||isIE||isNS4;function getRef(i,p){p=!p?document:p.navigator?p.document:p;return isIE?p.all[i]:isDOM?(p.getElementById?p:p.ownerDocument).getElementById(i):isNS4?p.layers[i]:null};function getSty(i,p){var r=getRef(i,p);return r?isNS4?r:r.style:null};if(!self.LayerObj)var LayerObj=new Function('i','p','this.ref=getRef(i,p);this.sty=getSty(i,p);return this');function getLyr(i,p){return new LayerObj(i,p)};function LyrFn(n,f){LayerObj.prototype[n]=new Function('var a=arguments,p=a[0],px=isNS4||isOp?0:"px";with(this){'+f+'}')};LyrFn('x','if(!isNaN(p))sty.left=p+px;else return parseInt(sty.left)');LyrFn('y','if(!isNaN(p))sty.top=p+px;else return parseInt(sty.top)');if(typeof addEvent!='function'){var addEvent=function(o,t,f,l){var d='addEventListener',n='on'+t,rO=o,rT=t,rF=f,rL=l;if(o[d]&&!l)return o[d](t,f,false);if(!o._evts)o._evts={};if(!o._evts[t]){o._evts[t]=o[n]?{b:o[n]}:{};o[n]=new Function('e','var r=true,o=this,a=o._evts["'+t+'"],i;for(i in a){o._f=a[i];r=o._f(e||window.event)!=false&&r;o._f=null}return r');if(t!='unload')addEvent(window,'unload',function(){removeEvent(rO,rT,rF,rL)})}if(!f._i)f._i=addEvent._i++;o._evts[t][f._i]=f};addEvent._i=1;var removeEvent=function(o,t,f,l){var d='removeEventListener';if(o[d]&&!l)return o[d](t,f,false);if(o._evts&&o._evts[t]&&f._i)delete o._evts[t][f._i]}}function FSMenu(myName,nested,cssProp,cssVis,cssHid){this.myName=myName;this.nested=nested;this.cssProp=cssProp;this.cssVis=cssVis;this.cssHid=cssHid;this.cssLitClass='highlighted';this.menus={root:new FSMenuNode('root',true,this)};this.menuToShow=[];this.mtsTimer=null;this.showDelay=0;this.switchDelay=125;this.hideDelay=500;this.showOnClick=0;this.hideOnClick=true;this.animInSpeed=0.2;this.animOutSpeed=0.2;this.animations=[]};FSMenu.prototype.show=function(mN){with(this){menuToShow.length=arguments.length;for(var i=0;i<arguments.length;i++)menuToShow[i]=arguments[i];clearTimeout(mtsTimer);if(!nested)mtsTimer=setTimeout(myName+'.menus.root.over()',10)}};FSMenu.prototype.hide=function(mN){with(this){clearTimeout(mtsTimer);if(menus[mN])menus[mN].out()}};FSMenu.prototype.hideAll=function(){with(this){for(var m in menus)if(menus[m].visible&&!menus[m].isRoot)menus[m].hide(true)}};function FSMenuNode(id,isRoot,obj){this.id=id;this.isRoot=isRoot;this.obj=obj;this.lyr=this.child=this.par=this.timer=this.visible=null;this.args=[];var node=this;this.over=function(evt){with(node)with(obj){if(isNS4&&evt&&lyr.ref)lyr.ref.routeEvent(evt);clearTimeout(timer);clearTimeout(mtsTimer);if(!isRoot&&!visible)node.show();if(menuToShow.length){var a=menuToShow,m=a[0];if(!menus[m]||!menus[m].lyr.ref)menus[m]=new FSMenuNode(m,false,obj);var c=menus[m];if(c==node){menuToShow.length=0;return}clearTimeout(c.timer);if(c!=child&&c.lyr.ref){c.args.length=a.length;for(var i=0;i<a.length;i++)c.args[i]=a[i];var delay=child?switchDelay:showDelay;c.timer=setTimeout('with('+myName+'){menus["'+c.id+'"].par=menus["'+node.id+'"];menus["'+c.id+'"].show()}',delay?delay:1)}menuToShow.length=0}if(!nested&&par)par.over()}};this.out=function(evt){with(node)with(obj){if(isNS4&&evt&&lyr&&lyr.ref)lyr.ref.routeEvent(evt);clearTimeout(timer);if(!isRoot&&hideDelay>=0){timer=setTimeout(myName+'.menus["'+id+'"].hide()',hideDelay);if(!nested&&par)par.out()}}};if(this.id!='root')with(this)with(lyr=getLyr(id))if(ref){if(isNS4)ref.captureEvents(Event.MOUSEOVER|Event.MOUSEOUT);addEvent(ref,'mouseover',this.over);addEvent(ref,'mouseout',this.out);if(obj.nested){addEvent(ref,'focus',this.over);addEvent(ref,'click',this.over);addEvent(ref,'blur',this.out)}}};FSMenuNode.prototype.show=function(forced){with(this)with(obj){if(!lyr||!lyr.ref)return;if(par){if(par.child&&par.child!=this)par.child.hide();par.child=this}var offR=args[1],offX=args[2],offY=args[3],lX=0,lY=0,doX=''+offX!='undefined',doY=''+offY!='undefined';if(self.page&&offR&&(doX||doY)){with(page.elmPos(offR,par.lyr?par.lyr.ref:0))lX=x,lY=y;if(doX)lyr.x(lX+eval(offX));if(doY)lyr.y(lY+eval(offY))}if(offR)lightParent(offR,1);visible=1;if(obj.onshow)obj.onshow(id);lyr.ref.parentNode.style.zIndex='2';setVis(1,forced)}};FSMenuNode.prototype.hide=function(forced){with(this)with(obj){if(!lyr||!lyr.ref||!visible)return;if(isNS4&&self.isMouseIn&&isMouseIn(lyr.ref))return show();if(args[1])lightParent(args[1],0);if(child)child.hide();if(par&&par.child==this)par.child=null;if(lyr){visible=0;if(obj.onhide)obj.onhide(id);lyr.ref.parentNode.style.zIndex='1';setVis(0,forced)}}};FSMenuNode.prototype.lightParent=function(elm,lit){with(this)with(obj){if(!cssLitClass||isNS4)return;if(lit)elm.className+=(elm.className?' ':'')+cssLitClass;else elm.className=elm.className.replace(new RegExp('(\\s*'+cssLitClass+')+$'),'')}};FSMenuNode.prototype.setVis=function(sh,forced){with(this)with(obj){if(lyr.forced&&!forced)return;lyr.forced=forced;lyr.timer=lyr.timer||0;lyr.counter=lyr.counter||0;with(lyr){clearTimeout(timer);if(sh&&!counter)sty[cssProp]=cssVis;var speed=sh?animInSpeed:animOutSpeed;if(isDOM&&speed<1)for(var a=0;a<animations.length;a++)animations[a](ref,counter,sh);counter+=speed*(sh?1:-1);if(counter>1){counter=1;lyr.forced=false}else if(counter<0){counter=0;sty[cssProp]=cssHid;lyr.forced=false}else if(isDOM){timer=setTimeout(myName+'.menus["'+id+'"].setVis('+sh+','+forced+')',50)}}}};FSMenu.animSwipeDown=function(ref,counter,show){if(show&&(counter==0)){ref._fsm_styT=ref.style.top;ref._fsm_styMT=ref.style.marginTop;ref._fsm_offT=ref.offsetTop||0}var cP=Math.pow(Math.sin(Math.PI*counter/2),0.75);var clipY=ref.offsetHeight*(1-cP);ref.style.clip=(counter==1?((window.opera||navigator.userAgent.indexOf('KHTML')>-1)?'':'rect(auto,auto,auto,auto)'):'rect('+clipY+'px,'+ref.offsetWidth+'px,'+ref.offsetHeight+'px,0)');if(counter==1||(counter<0.01&&!show)){ref.style.top=ref._fsm_styT;ref.style.marginTop=ref._fsm_styMT}else{ref.style.top=((0-clipY)+(ref._fsm_offT))+'px';ref.style.marginTop='0'}};FSMenu.animFade=function(ref,counter,show){var done=(counter==1);if(ref.filters){var alpha=!done?' alpha(opacity='+parseInt(counter*100)+')':'';if(ref.style.filter.indexOf("alpha")==-1)ref.style.filter+=alpha;else ref.style.filter=ref.style.filter.replace(/\s*alpha\([^\)]*\)/i,alpha)}else ref.style.opacity=ref.style.MozOpacity=counter/1.001};FSMenu.animClipDown=function(ref,counter,show){var cP=Math.pow(Math.sin(Math.PI*counter/2),0.75);ref.style.clip=(counter==1?((window.opera||navigator.userAgent.indexOf('KHTML')>-1)?'':'rect(auto,auto,auto,auto)'):'rect(0,'+ref.offsetWidth+'px,'+(ref.offsetHeight*cP)+'px,0)')};FSMenu.prototype.activateMenu=function(id,subInd){with(this){if(!isDOM||!document.documentElement)return;var fsmFB=getRef('fsmenu-fallback');if(fsmFB){fsmFB.rel='alternate stylesheet';fsmFB.disabled=true}var a,ul,li,parUL,mRoot=getRef(id),nodes,count=1;var lists=mRoot.getElementsByTagName('ul');for(var i=0;i<lists.length;i++){li=ul=lists[i];while(li){if(li.nodeName.toLowerCase()=='li')break;li=li.parentNode}if(!li)continue;parUL=li;while(parUL){if(parUL.nodeName.toLowerCase()=='ul')break;parUL=parUL.parentNode}a=null;for(var j=0;j<li.childNodes.length;j++)if(li.childNodes[j].nodeName.toLowerCase()=='a')a=li.childNodes[j];if(!a)continue;var menuID=myName+'-id-'+count++;if(ul.id)menuID=ul.id;else ul.setAttribute('id',menuID);var sOC=(showOnClick==1&&li.parentNode==mRoot)||(showOnClick==2);var evtProp=navigator.userAgent.indexOf('Safari')>-1||isOp?'safRtnVal':'returnValue';var eShow=new Function('with('+myName+'){var m=menus["'+menuID+'"],pM=menus["'+parUL.id+'"];'+(sOC?'if((pM&&pM.child)||(m&&m.visible))':'')+' show("'+menuID+'",this)}');var eHide=new Function('e','if(e.'+evtProp+'!=false)'+myName+'.hide("'+menuID+'")');addEvent(a,'mouseover',eShow);addEvent(a,'focus',eShow);addEvent(a,'mouseout',eHide);addEvent(a,'blur',eHide);if(sOC)addEvent(a,'click',new Function('e',myName+'.show("'+menuID+'",this);if(e.cancelable&&e.preventDefault)e.preventDefault();e.'+evtProp+'=false;return false'));if(subInd)a.insertBefore(subInd.cloneNode(true),a.firstChild)}if(isIE&&!isOp){var aNodes=mRoot.getElementsByTagName('a');for(var i=0;i<aNodes.length;i++){addEvent(aNodes[i],'focus',new Function('e','var node=this.parentNode;while(node){if(node.onfocus)node.onfocus(e);node=node.parentNode}'));addEvent(aNodes[i],'blur',new Function('e','var node=this.parentNode;while(node){if(node.onblur)node.onblur(e);node=node.parentNode}'))}}if(hideOnClick)addEvent(mRoot,'click',new Function(myName+'.hideAll()'));menus[id]=new FSMenuNode(id,true,this)}};var page={win:self,minW:0,minH:0,MS:isIE&&!isOp,db:document.compatMode&&document.compatMode.indexOf('CSS')>-1?'documentElement':'body'};page.elmPos=function(e,p){var x=0,y=0,w=p?p:this.win;e=e?(e.substr?(isNS4?w.document.anchors[e]:getRef(e,w)):e):p;if(isNS4){if(e&&(e!=p)){x=e.x;y=e.y};if(p){x+=p.pageX;y+=p.pageY}}if(e&&this.MS&&navigator.platform.indexOf('Mac')>-1&&e.tagName=='A'){e.onfocus=new Function('with(event){self.tmpX=clientX-offsetX;self.tmpY=clientY-offsetY}');e.focus();x=tmpX;y=tmpY;e.blur()}else while(e){x+=e.offsetLeft;y+=e.offsetTop;e=e.offsetParent}return{x:x,y:y}};if(isNS4){var fsmMouseX,fsmMouseY,fsmOR=self.onresize,nsWinW=innerWidth,nsWinH=innerHeight;document.fsmMM=document.onmousemove;self.onresize=function(){if(fsmOR)fsmOR();if(nsWinW!=innerWidth||nsWinH!=innerHeight)location.reload()};document.captureEvents(Event.MOUSEMOVE);document.onmousemove=function(e){fsmMouseX=e.pageX;fsmMouseY=e.pageY;return document.fsmMM?document.fsmMM(e):document.routeEvent(e)};function isMouseIn(sty){with(sty)return((fsmMouseX>left)&&(fsmMouseX<left+clip.width)&&(fsmMouseY>top)&&(fsmMouseY<top+clip.height))}}




function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function clearValue(element,initValue) {
if (element.value == initValue) {
element.value="";
}
}

function countryGo(CountryFlag) {
	document.forms.CountryPicker2.CountryCode.value = CountryFlag
//	if (document.forms.CountryPicker2.StoreCookie.checked == true) {
//		document.forms.CountryPicker2.StoreCookie.value = "YES"
//	} else {
//		document.forms.CountryPicker2.StoreCookie.checked = true
//		document.forms.CountryPicker2.StoreCookie.value = "NO"
//	}
	document.forms.CountryPicker2.submit()
}

function alertMessage1(){
if (confirm("This application should only be completed by companies in the Netherlands. If you are a European company please select Cancel and follow the link provided for the appropriate application form."))
	{
	parent.window.location="?Section=Klant worden&SubSection=Klant worden&PageName=Cash+account+application"
	}
}

function alertMessage2(){
if (confirm("This application should only be completed by companies in the Netherlands. If you are a European company please select Cancel and follow the link provided for the appropriate application form."))
	{
	parent.window.location="?Section=Becoming+a+customer&SubSection=Becoming+a+customer&PageName=Credit+account+application"
	}
}

<!-- JavaScript to set a Cookie to expire after a set period of time

numDays = 2;  //Days 'till Cookie expires.

var expire = new Date()
expire.setTime (expire.getTime() + (numDays * 24 * 3600000));

// name is a string of the name of your cookie
// value is the value corresponding to name
function SetCookie(name, value) {
 var expString = "; expires=" + expire.toGMTString();
 document.cookie = name + "=" + escape(value) + expString;
}

// returns value of cookie or null if cookie does not exist
function GetCookie(name) {
 var result = null;
 var myCookie = " " + document.cookie + ";";
 var searchName = " " + name + "=";
 var startOfCookie = myCookie.indexOf(searchName);
 var endOfCookie;
 if (startOfCookie != -1) {
  startOfCookie += searchName.length; // skip past name of cookie
  endOfCookie = myCookie.indexOf(";", startOfCookie);
  result = unescape(myCookie.substring(startOfCookie, endOfCookie));
 }
 return result;
}

function saveValue(element){
  if ((element.type == "text")
  || (element.type == "password")
  || (element.type == "textarea")
  || (element.type == "radio")) {
   val = element.value;
  } else if (element.type.indexOf("select") != -1) {
   val = "";
   for(k=0;k<element.length;k++)
    if (element.options[k].selected)
     val += k+" ";
  } else if (element.type == "checkbox") {
   val = element.checked;
  }
  SetCookie("memory_"+element.form.name+"_"+element.name,val);
    SetCookie("memory_"+element.form.name+"2_"+element.name,val);
 }

function storedValues() {
 if (document.images) { // only do it in JavaScript 1.1 browsers
  for (i=0;i<document.forms.length;i++) {
   for (j=0;j<document.forms[i].elements.length; j++) {
    cookie_name = "memory_"+document.forms[i].name+"_"
     +document.forms[i].elements[j].name;
    val = GetCookie(cookie_name);
    if (val) {
     if ((document.forms[i].elements[j].type == "text")
     || (document.forms[i].elements[j].type == "password")
     || (document.forms[i].elements[j].type == "textarea")) {
      document.forms[i].elements[j].value = val;
     } else if (document.forms[i].elements[j].type.indexOf("select") != -1) {
      document.forms[i].elements[j].selectedIndex = -1;
      while (((pos = val.indexOf(" ")) != -1) && (val.length > 1)) {
       sel = parseInt(val.substring(0,pos));
       val = val.substring(pos+1,val.length);
       if (sel < document.forms[i].elements[j].length)
        document.forms[i].elements[j].options[sel].selected = true;
      }
     } else if (document.forms[i].elements[j].type == "checkbox") {
      document.forms[i].elements[j].checked = val;
     } else if (document.forms[i].elements[j].type == "radio") {
      if (document.forms[i].elements[j].value == val)
       document.forms[i].elements[j].checked = true;
     }
    }
   }
  }
 }
}
//Set the Cookie with expire date in the past - 2 days to get it for sure.
function DelEatCookie (name) {
  var expire = new Date();
  expire.setTime (expire.getTime() - 2 * 86400001);  //-2 days ago. Stale Cookie
  document.cookie = name + "=; expires=" + expire.toGMTString();
}
window.onload = storedValues;

// -->
<!--
function validateTel(string) {
    var Chars = "0123456789 -";

    for (var i = 0; i < string.length; i++) {
       if (Chars.indexOf(string.charAt(i)) == -1){
       alert('Your Phone Number is not valid. Please check that you have entered only numbers.');
       return false;
    }
  }
    return true;
} 
//-->
<!--
function validateFax(string) {
    var Chars = "0123456789 -";

    for (var i = 0; i < string.length; i++) {
       if (Chars.indexOf(string.charAt(i)) == -1){
       alert('Your Fax Number is not valid. Please check that you have entered only numbers.');
       return false;
    }
  }
    return true;
} 
//-->

<!-- JavaScript to copy a form field value form one form field to another on the same page

var DeliveryAddress = "";
var DeliveryPostcode = "";


function InitSaveVariables(form) {
DeliveryAddress = form.DeliveryAddress.value;
DeliveryPostcode = form.DeliveryPostcode.value;
}

function DeliverytoCompanyAdd(form) {

InitSaveVariables(form);
form.DeliveryAddress.value = form.CompanyAddress.value;
form.DeliveryPostcode.value = form.CompanyPostcode.value;

}



function FrontPage_Form2_Validator(theForm)
{

  if (theForm.AccountNumber.value == "")
  {
    alert("Please enter a value for the \"Account Number\" field.");
    theForm.AccountNumber.focus();
    return (false);
  }

  if (theForm.Contact.value == "")
  {
    alert("Please enter a value for the \"Contact Name\" field.");
    theForm.Contact.focus();
    return (false);
  }

  if (theForm.Telephone.value == "")
  {
    alert("Please enter a value for the \"Telephone Number\" field.");
    theForm.Telephone.focus();
    return (false);
  }

  if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"Email\" field.");
    theForm.email.focus();
    return (false);
  }
  return (true);
}

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 is invalid (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 is invalid.")
    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 is invalid.")
    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>4) {
   				// 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
}
}

