function Check(ok,sForm,field,r,msg) {
	if (ok==true) {
			v = eval('document.' + sForm + '.' + field + '.value')
         v = v.toLowerCase()
			eval('ok=(' + r + ')')
			if (ok==false) {
				eval('document.' + sForm + '.' + field + '.focus()')
			   eval('document.' + sForm + '.' + field + '.className="InputAttention"' )
				alert(msg)
				}
			}
		return ok
	}
   
function MaximizeInput(obj,len)
{
if ( obj.value.length > len-1 )
   {
   obj.value = obj.value.substring(0,len-1);
   }
}

// Use like this: <INPUT onKeyDown="return NumericCheck( event )"> - AVS
function NumericCheck( objEvent ) {
   var keyCode = objEvent.which ? objEvent.which : objEvent.keyCode;
   //alert( keyCode )
   return (  ( (keyCode >= '0'.charCodeAt()) && (keyCode <= '9'.charCodeAt()) ) || (keyCode < ' '.charCodeAt()) || (keyCode == 37) || (keyCode == 39) || (keyCode == 46) || ( (keyCode>=96) && (keyCode<=105)  )   );
   }

// Use like this: <INPUT onKeyDown="return CheckChars( event, 'ABCDEFGHIJKLMNOPQRSTUVXYZ' )"> - AVS
function CheckChars( objEvent, strCharlist ) {
   var keyCode = objEvent.which ? objEvent.which : objEvent.keyCode;
   //alert( keyCode )
   return ( (strCharlist.indexOf(String.fromCharCode(keyCode)) >= 0 ) || (keyCode == 37) || (keyCode == 39) || (keyCode == 8) || (keyCode == 46) || ( (keyCode>=96) && (keyCode<=105) )  );
   }
   
function openWin( windowURL, windowName, width, height, iScrollBars ) {
   var winleft = (screen.width - width) / 2;
   var winUp = (screen.height - height) / 2;
   MyWin =  window.open( windowURL, windowName, 'width=' + width + ',height=' + height + ',left=' + winleft + ',top=' + winUp + ',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=' + iScrollBars + ',resizable=1' ) ;
   if (parseInt(navigator.appVersion) >= 4) { MyWin.focus() }
   }
   
function openImg( windowURL, windowName, width, height, iScrollBars ) {
   var winleft = (screen.width - width) / 2;
   var winUp = (screen.height - height) / 2;
   windowURL = '/imgloader.asp?' + windowURL;
   MyWin =  window.open( windowURL, windowName, 'width=' + width + ',height=' + height + ',left=' + winleft + ',top=' + winUp + ',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=' + iScrollBars + ',resizable=1' ) ;
   if (parseInt(navigator.appVersion) >= 4) { MyWin.focus() }
   }

function openImg2( windowURL, AdId, windowName, width, height, iScrollBars ) {
   // Met next functie
   var winleft = (screen.width - width) / 2;
   var winUp = (screen.height - height) / 2;
   windowURL = '/imgloader.asp?ImageId=' + windowURL + '&AdId=' + AdId;
   MyWin =  window.open( windowURL, windowName, 'width=' + width + ',height=' + height + ',left=' + winleft + ',top=' + winUp + ',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=' + iScrollBars + ',resizable=1' ) ;
   if (parseInt(navigator.appVersion) >= 4) { MyWin.focus() }
   }
   
// Function to ask first before going to an url using a button
// Usage   : <INPUT TYPE=button onClick="Ask( 'Zullen we naar Google gaan?', 'http://www.google.com/' ) ">
function Ask( p_strQuestion, p_strUrl ) {
    blnOk = confirm( p_strQuestion )
    if (blnOk) { document.location.href = p_strUrl }
    }

// Remove other frames and make me this only page - AVS
function KillFrames()
   {
   if (top.frames.length!=0) top.location=self.document.location;
   }
   
function ChangeImage( strImageName, strImagePath ) {
	if (document.images) {
      b = new Image()
      b.src = strImagePath
      document[ strImageName ].src = b.src
      }
   }
   
function SetCookie(name,value) {
	var theCookie = name + "=";
	theCookie = theCookie + escape(value);
	document.cookie = theCookie;
}

function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
	}
   
function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
		}
	return "";
	}
   
function NoSpam( p_strUser, p_strDomain1, p_strDomain2 ) {
   s = p_strUser + '@' + p_strDomain1 + '.' + p_strDomain2
   document.write( '<a href=' + 'mailto:' + s + '>' + s + '</a>' ) }
   
function isEmail( url ) {
	var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o
	if (url != null && url != "") {
		a = url.lastIndexOf("@");
		b = url.lastIndexOf(".");
		c = url.indexOf(":");
		d = url.indexOf("/");
		e = url.substring(0,a);
		f = e.indexOf("@");
		g = url.substring(a+1,url.length);
		h = g.indexOf("[");
		i = g.indexOf("]");
		j = g.indexOf("<");
		k = g.indexOf(">");
		l = url.substring(a+1,b);
		m = url.substring(b+1,url.length);
		n = url.substring(0,a);
		p = url.indexOf(",");
		q = url.indexOf(" ");		
		r = url.indexOf("@.");		
		o = 0;
		if (a > b) {o++};
		if (c != -1) {o++};
		if (d != -1) {o++};		
		if (f != -1) {o++};
		if (h != -1) {o++};
		if (i != -1) {o++};
		if (j != -1) {o++};
		if (k != -1) {o++};
		if (m.length < 2) {o++};
		if (n.length < 1) {o++};
		if (p != -1) {o++};
		if (q != -1) {o++};		
		if (r != -1) {o++};		
		if (o == 0) {
			return true; }
		else {
			return false; }
		}
	else {
	 	return false; }
	}
   
function isUrl( url )
{
   var b;
   b = url.lastIndexOf(".");
   return (b>0);
}

function validatePostalCode(strPC) 
{
   return typeof strPC == 'string'
   ?strPC.match(/[1-9][0-9]{3} ?[a-zA-Z]{2}/)==strPC
   :false;
}

function Trim(s) 
{
  while (s.substring(0,1) == ' ') 
  {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') 
  {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function TrimInput(obj)
{
   obj.value = Trim(obj.value)
}

function ShowLayer(id)
{
   //document.getElementById(id).style.visibility = "visible";      
   document.getElementById(id).style.display = "";  
   
  //var val;
  //val = (vis != 'none')?'none':((document.all && !window.opera)?'inline':'table-row');
  //document.getElementById('div'+id).style.display = val;
   
}

function HideLayer(id)
{
   //document.getElementById(id).style.visibility = "hidden";      
   document.getElementById(id).style.display = "none";  
}

function getElementById(id)
{
   var o = document.getElementById(id)
   if (o==null)
   {
      alert('Not found id: ' + id)
   }
   return o;
}

window.document.onload = KillFrames();
window.status='Design Wonen'
