bName = navigator.appName;
bVer = parseInt(navigator.appVersion);
browserVer = 2;
if      (bName == "Netscape" && bVer >= 3) browserVer = 1;


function alg_confirm(theQuery)
{
	
  var text = "weet u zeker dat u wilt:";
//  var theQuery = 'DEFINITEVE MAIL VERZENDEN?';
  var is_confirmed = confirm(text + '\n\n' + theQuery);   
  if (is_confirmed) 
    {
		return true;
	}       
  return false;
}

function ref_confirm(fn,theQuery)
{
  var text = "weet u zeker dat u wilt:";
  var is_confirmed = confirm(text + '\n\n' + theQuery);   
  if (is_confirmed) 
    {
    document.location.replace(fn);
    }
  return (false);
}

function floatMenu()
{
  if(document.documentElement.scrollTop)
  {
    sy = document.documentElement.scrollTop;
  }
  else
  {
    sy = document.body.scrollTop;
  }

  var temp = sy + startY;
  var newY = temp.toString() + "px";

  var elem = document.getElementById("menu");
  elem.style.top = newY;
}

//window.onscroll = floatMenu;


function scherm(){
if (window.innerHeight) {
	theWidth=window.innerWidth;    }
else if (document.documentElement && document.documentElement.clientHeight) {
	theWidth=document.documentElement.clientWidth;    }
else if (document.body) {
	theWidth=document.body.clientWidth;    } 

w1 = window.screen.availWidth;
if (w1 > 950 && theWidth < 950)
  {  window.top.moveTo(0,0);window.resizeTo(window.screen.availWidth,window.screen.availHeight)  }
if (window.innerHeight) {
	theHeight=window.innerHeight;    }
else if (document.documentElement && document.documentElement.clientHeight) {
	theHeight=document.documentElement.clientHeight;    }
else if (document.body) {
	theHeight=document.body.clientHeight;} 
return (theHeight);
}

function afrond(str,nDecim)
{
if (nDecim == 0)
   {str=Math.round(str*1)/1;}
else if (nDecim == 1)
   {str=Math.round(str*10)/10;}
else 
   {str=Math.round(str*100)/100;}

return str;
}

function checkCR(evt) {
  var evt  = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  if ((evt.keyCode == 13) && (node.type=="radio")) {return false;}
  if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
  if ((evt.keyCode == 13) && (node.type=="password")) {return false;}
  if ((evt.keyCode == 13) && (node.type=="checkbox")) {return false;}

  if (node.type=="file")
    {return false;}
  if (browserVer == 1)
    {toets = evt.charCode;
     if ( (toets == 0) && (node.type=="text") )
       {return true;}
    }
  else
    {toets = evt.keyCode;}
  if (node.type=="text")
    {
	str=node.value;
	// functies verschillend in ie en netscape
    if (browserVer == 1)
      {lNospace=evt.target.getAttribute("nospace");
	  lDecim=evt.target.getAttribute("decim");
	  lRond=evt.target.getAttribute("rond");
	  lAlleen_lezen=evt.target.getAttribute("alleen_lezen");
      }
    else
      {lNospace=evt.srcElement.getAttribute("nospace");
	  lDecim=evt.srcElement.getAttribute("decim");
	  lRond=evt.srcElement.getAttribute("rond");
	  lAlleen_lezen=evt.srcElement.getAttribute("alleen_lezen");
	  }

    if (node.id=="alleen_lezen" || null != lAlleen_lezen) 
      {return false;}

    if (null != lNospace && toets == 32) 
      {return false;}

    if (node.id=="rond" || null != lRond)
      {
      if ( (toets < 48) || (toets > 57))
        {return false;}
      }

	if (node.id == "postcode")
      {
      oke = false;
      if (str.length < 4)
        {if ( (toets >= 48) && (toets <= 57) )
          {oke = true;}
        }
      else
        {
        if ( (toets >= 65) && (toets <= 90) ) 
          {oke = true;}
        
        if ( (toets >= 97) && (toets <= 122) ) 
          {oke = true;}
        }
      return oke;
      }

    if (node.id == "huisnr")
      {
      oke = false;
      // cijfer kan overal staan
      if ( (toets >= 48) && (toets <= 57) ) 
        {oke = true;}
      //1e positie moet een cijfer zijn
      if (str.length > 0)
        {
        if ( (toets >= 65) && (toets <= 90) ) 
          {oke = true;}
        if ( (toets >= 97) && (toets <= 122) ) 
          {oke = true;}
        // alleen spaties en verbindingsstreepje toestaan
        if ( (toets == 45) || (toets == 32) ) 
          {oke = true;}
        }
      return oke;
      }

//negatief getal toestaan als streepje eerste positie is
    if ( (toets == 45) && (null != lDecim || null != lRond) )
      {
      if (str.length > 0)
         {return false;}
      }
    // comma wijzigen in punt
    if (node.id=="decim" || null != lDecim) 
      {
      if ( (toets < 44) || (toets > 57))
        {return false;}
      // slash
      if (toets == 47)
        {return false;}
      // maar een punt toestaan
      if (toets == 46)
        {
         ind=str.indexOf(".")
         if (ind >= 0)
           {return false;}
        }
      // comma wijzigen in punt (als er al niet een punt in staat)
      if (toets == 44)
        {
         ind=str.indexOf(".")
         if (ind >= 0)
           {return false;}
        cAdd = '.';
        str += cAdd; 
        node.value=str; 
        return false;}
    }
    }
  }
  document.onkeypress = checkCR;


function open_zoek()
{
testObject = eval("document.zoeken.zoektekst");
inhoud = testObject.value;
fn = "?zoektekst=";
fn += inhoud;
location.href = fn;
}

function runSlideShow(nr){

if (!stopped){
   document.images.SlideShow1.src = preLoad[j].src
   document.images.SlideShow1.lnk = preLoad[j].lnk
//   document.images.SlideShow1.style.filter="blendTrans(duration=.5)"
//   document.images.SlideShow1.filters.blendTrans.Apply()
   document.images.SlideShow1.onclick=B_LdLnk
   document.images.SlideShow1.onmouseover=B_Stp
   document.images.SlideShow1.onmouseout=B_Rstrt

   if (stopped){
     t = setTimeout('runSlideShow()', 0);
     }
   else {
     t = setTimeout('runSlideShow()', slideShowSpeed)
	 }
   j += 1;
   if (j > p-1) j=1
   }

}

function B_LdLnk()
{if(this.lnk)
   {
   stopped=false;
   B_open(this.lnk);
   }
}

//function B_Stp(){if(this.src)stopped=true}
function B_Stp()
{
  if(this.src)
  	{stopped=true;}
}

function B_Rstrt()
{
  if(this.src)
	{stopped=false}
}


function B_open(page)
{
//  var cWindow = "_blank";
//  window.open(page, cWindow);
  if (page > '')
    {location.href=page;}
}

function setPointer(theRow, theRowNum, theAction)
{
var theCells = theRow.cells
var rowCellsCnt  = theCells.length;

if (theAction == "over") 
  {
  for (c = 0; c < rowCellsCnt; c++) 
    {
    cField = theCells[c]
    DagStyle = eval("cField.style");
    DagStyle.color="#000000";
    }
  }

if (theAction == "out") 
  {
  for (c = 0; c < rowCellsCnt; c++) 
    {
    cField = theCells[c]
    DagStyle = eval("cField.style");
    DagStyle.color = "#333333";
    }
  }
}

function img_change(obj,img)
{
obj.src = img;
}


function isEmpty(str) {
            // Check whether string is empty.
			if (str.charAt(0)=="0" && str*1 == 0)
              {return true;}
 			  
            for (var intLoop = 0; intLoop < str.length; intLoop++)
               if (" " != str.charAt(intLoop))
                  return false;
            return true;
         }

         function checkRequired(f) {
            var strError = "";
			var obj_name = f.name;
			var mail_content = '<table><tr><td>&nbsp;';
			var radioArray = new Array();
			
            for (var intLoop = 0; intLoop<f.elements.length; intLoop++)
             {deze_naam = f.elements[intLoop].name;
			 checktype=f.elements[intLoop].type;
			 if (checktype == "radio")
			   {if (radioArray.length == 0)
			      {radioArray[0] = deze_naam;
				  mail_content += '<tr><td valign=top>' + deze_naam + ': ';
				  }
			    if (f.elements[intLoop].checked)
                  {radioArray[0] = 'ja';
				  mail_content += '<td valign=top>' + f.elements[intLoop].value ;
				  }
			   }
			 if (checktype != "radio" && radioArray.length > 0)
			   {if (radioArray[0] != 'ja')
			     {strError += "  " + radioArray[0] + "\n";
				 }
	             radioArray = new Array();
			   }
			 if (checktype == 'checkbox' )
			   {
				if (f.elements[intLoop].checked)
				  {mail_content += '<tr><td valign=top>' + deze_naam + ': ';
				  mail_content += '<td valign=top>ja';
				  }
			   }
			 else if (checktype != 'hidden' && checktype != 'submit')
			   {
			   if (checktype != "radio" && deze_naam != 'mailbody')
			     {mail_content += '<tr><td valign=top>' + deze_naam + ': ';
				 // softreturns in memo <br> van maken voor mailcontent
				  input = f.elements[intLoop].value;
				  if (checktype == 'textarea')
				    {output='';
					 for (i = 0; i < input.length; i++) 
				      {
                      if (input.charCodeAt(i) == 10) 
				        {
                        output += "<br>";
                        } 
			          else 
				        {
                        output += input.charAt(i);
					    }
                      }
					input=output
					}
				  mail_content += '<td valign=top>' + input;
				  }
			   if (null!=f.elements[intLoop].getAttribute("required") || null!=f.elements[intLoop].getAttribute("verplicht")) 
                  {
				  if (checktype != "radio" && isEmpty(f.elements[intLoop].value))
                     {strError += "  " + f.elements[intLoop].name + "\n";}
				  }
			   }
			}
            if ("" != strError) {
               alert("De volgende gegevens ontbreken:\n" + strError);
               return false;
            }
			else if (obj_name == 'mailform')
			  {
			  mail_content += '<tr><td>&nbsp;</table>';
			  testObject = eval("document.mailform.mailbody");
			  testObject.value = mail_content;
			  }
			return true;
         }

		 
function verzenden(user,fn)
{
funktie = "mai";
funktie += "lto:" + user + "@" + fn;
location.href=funktie;
}

function showBalloon(e,text,lengte){
	if (typeof(lengte) == "undefined")lengte=300;
	if(document.all)e = event;
	
	var obj = document.getElementById('balloon');
	var obj2 = document.getElementById('balloon_content');
    obj.style.zIndex = 100;

	obj2.innerHTML = text;
	obj.style.display = 'block';
	var leftPos = e.clientX + 10;
	var rightPos = e.clientX + lengte;
	var rightBorder=window.screen.availWidth-25;
	var botBorder=window.screen.availHeight;
	botBorder -= obj.offsetHeight;
	botBorder -= 150;
	var topPos = e.clientY +10;
	if (topPos > botBorder)topPos = botBorder;
	if (rightPos > rightBorder)leftPos=e.clientX - lengte;
	if(leftPos<0)leftPos = 0;
	obj.style.left = leftPos + 'px';
	obj.style.top = topPos + 'px';
	obj.style.width = lengte + 'px';
}	

function hideBalloon()
{
	document.getElementById('balloon').style.display = 'none';
	
}

