// pulib.js ©2011
// Javavascript bibliotheek voor eigen projecten
// include met <script src='/pulib.js'></script>
// losse projecten kunnen desgewenst worden gekaderd in setSmall() oid

// Fonts komen in een apart bestand dat hier geladen wordt.
// Het vermaledijde MS-IE wenst geen MS truetypefonts toe te staan.
// Zij hebben een nieuw (betalen graag) .eot fonttype bedacht. Vandaar:

if (isIE())
{ document.write("<style> @import url(/fonts_ie.css); </style>");
  if (!sessionStorage.pagecount)
  { alert('Uw browser, Internet Explorer, wijkt af van de W3C-norm. Het kan zijn dat u niet de juiste opmaak ziet.');
    sessionStorage.pagecount=1;
   }
}


if (!isIE()) { document.write("<style> @import url(/fonts.css); </style>"); }


//////// HULPROUTINES ////////

// verkorte schrijfwijze voor document.writeln
function writeln(arg){document.writeln(arg);}

// geeft true als pulib gevonden is
function isPulib() { return true;}

// toont het type van een object middels zijn naam: objectid
function showObjectType(objectID) {alert(document.getElementById(objectID));}

// geeft true als de browser IE is
function isIE() {$b=navigator.appName; if ($b=='Microsoft Internet Explorer') return true; else return false;}

// kijkt of de cookies aan staan
function isCookieOn() {if (navigator.cookieEnabled) return true; else return false;}

// geeft true als bij 1920x1080
function isHD() {if (screen.availWidth==1920 && screen.availHeight==1080) return true; else return false;}
function setHD(){window.resizeTo(1920,1080);}

// geeft true als kleiner of gelijk 1280x1024 (hoogresolutie 4:3)
function isNormal() {if (screen.availWidth<=1280 || screen.availHeight<=1024) return true; else return false;}
function setNormal(){window.resizeTo(1280,1024);}

// geeft true als kleiner of gelijk dan 1024x768 (oude resolutie 4:3)
function isOld() {if (screen.availWidth<=1024 || screen.availHeight<=768) return true; else return false;}
function setOld(){window.resizeTo(1024,768);}

// geeft true als kleiner of gelijk 800x600
function isSmall() {if (screen.availWidth<=800 || screen.availHeight<=600) return true; else return false;}
function setSmall(){window.resizeTo(800,600);}

// geeft schermhoogte/breedte in pixels
function getScreenHeight() {return (screen.availHeight);}
function getScreenWidth()  {return (screen.availWidth);}

// toont een .txt of .html bestand in een popup venster
function toonBestand(bestand,breedte)
{if (bestand==null) {alert('Geen bestand opgegeven'); return}
 if (breedte==null) breedte=600;
 hoogte=3*breedte/4;
 t=window.open(bestand,'','width='+breedte+',height='+hoogte+',scrollbars=yes');
 t.window.focus();
}

// toont een foto in een popup venster met sluitknop
function toonFoto(foto,onderschrift,breedte){
var fotostijl ='<style> img   {border: 0px solid; -moz-box-shadow: 10px 10px 5px #888888; }</style>';
var tabelstijl='<style> table {font-family:"verdana"; font-size: 10px; letter-spacing:1px; padding:1px;} </style>';
var tdstijl   ='<style> td    {text-align:left; vertical-align:top; padding: 15px;} </style>';
tmp=window.open('Fotovenster','fotovenster','height=768,width='+breedte);
tmp.document.write('<html><head><title>foto</title>');
tmp.document.write(fotostijl);
tmp.document.write(tabelstijl);
tmp.document.write(tdstijl);
tmp.document.write('</head><body>');
tmp.document.write('<table><tr><td width=300><center><input type="button" value="Sluit dit venster" onClick="self.close()" ></center><br/><br/>');
tmp.document.write(onderschrift+'</td><td><img src='+foto+' /></td></tr></table>');
tmp.document.write('<body></html>');
tmp.document.close();
tmp.window.focus();
}

// negenregelig alertvenster
function merkOp(s1,s2,s3,s4,s5,s6,s7,s8,s9) {
var hoogte=100;
var b='<br/>';
var s='';
var h=0;
if (s1!=null) {s=s+s1+b; h++;}
if (s2!=null) {s=s+s2+b; h++;}
if (s3!=null) {s=s+s3+b; h++;}
if (s4!=null) {s=s+s4+b; h++;}
if (s5!=null) {s=s+s5+b; h++;}
if (s6!=null) {s=s+s6+b; h++;}
if (s7!=null) {s=s+s7+b; h++;}
if (s8!=null) {s=s+s8+b; h++;}
if (s9!=null) {s=s+s9+b; h++;}
hoogte=40+25*h; // beginhoogte en deltahoogte kan varieren per font.
t=window.open('Opmerking','','width=440,height='+hoogte)
t.document.write(s);
t.document.write("<br/><center><input type='button' value='Klik hier om dit venster te sluiten' onClick='window.close()' /></center>")
t.window.focus()
}

//////// Om via zoekmachines binnenkomers op een frame te herleiden, vervalt als er geen frames meer worden gebruikt
function isgearriveerd(){
var vanbuiten=(parent.frames.length==0);
if (vanbuiten) location.href='doorverwijzing.html';
}


////// DOM manipulatie

// haal de objecthandle van een object middels zijn naam: objectid
function getHandle(objectID) {return (document.getElementById(objectID));}

// toon of verberg een object via zijn id
function show(id)   {document.getElementById(id).style.visibility='visible';}
function hide(id)   {document.getElementById(id).style.visibility='hidden';}
function toon(id)   {document.getElementById(id).style.visibility='visible';}
function verberg(id){document.getElementById(id).style.visibility='hidden';}



// image dimensies
function img_getbreedte(id)  {return (document.getElementById(id).width);}
function img_gethoogte(id)   {return (document.getElementById(id).height);}
function img_sethoogte(id,h) {if (h==null) return; document.getElementById(id).height=h;}
function img_setbreedte(id,h){if (h==null) return; document.getElementById(id).width=h;}

function img_scale(id,factor)
{if (factor==null) return;
 h=document.getElementById(id).height; document.getElementById(id).height=factor*h;
 b=document.getElementById(id).width;  document.getElementById(id).width=factor*b;
}

function img_getsrc(id){return document.getElementById(id).src;}
function img_setsrc(id,src){document.getElementById(id).src=src;}

function img_getposx(id){return document.getElementById(id).offsetLeft;}
function img_getposy(id){return document.getElementById(id).offsetTop;}




// ******************************************************************
// TIP naar © Dynamic Drive DHTML code library (www.dynamicdrive.com)
// Gebruik: onMouseOver="tipaan('Deze tekst')"; onMouseOut="tipuit()"
// ******************************************************************

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false;
var tipobj=document.getElementById("dhtmltooltip");

function tipaan(tekst)
{ tipobj.innerHTML=tekst;
  tipobj.style.backgroundColor='darkblue';
  tipobj.style.color='white';
  tipobj.style.width='150'+'px';
  enabletip=true;
  return false;
}

function tipuit()
{ enabletip=false;
  tipobj.style.visibility="hidden";
  tipobj.style.left="-1000px";
  tipobj.style.backgroundColor='';
  tipobj.style.width='';
}




function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}



function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}


document.onmousemove=positiontip

</script>


/*


<figure onmouseover="hide('f')" onmouseout="show('f')" >
  <img id='f' src="familie_in_tuin.gif" width=200px />
  <figcaption>De familie Uljé</figcaption>
</figure>
<aside>Dit staat erbuiten</aside>


 <fieldset class='br300'>
<legend>Urenverantwoording</legend>
<table>
<thead><tr><th>Links</th><th>Rechts</th><tr></thead>
<tbody>
<tr><td>1</td><td>a</td></tr>
<tr><td>2</td><td>b</td></tr>
<tr><td>3</td><td>c</td></tr>
<tr><td>4</td><td>d</td></tr>
</tbody>
<tfoot><tr><td>Voet</td><td>veld</td></tr></tfoot>
</table>
</fieldset>











// =============================================================================
// objectpositie
// =============================================================================
function objectpositielinks(objectID)
{var dom=findDOM(objectID,0);
 var domstijl=findDOM(objectID,1);
 if (domstijl.left)       return domstijl.left;
 if (domstijl.pixelLeft)  return domstijl.pixelLeft;
 if (dom.offsetLeft)      return dom.offsetLeft;}

function objectpositieboven(objectID)
{var dom=findDOM(objectID,0);
 var domstijl=findDOM(objectID,1);
 if (domstijl.top)       return domstijl.top;
 if (domstijl.pixelTop)  return domstijl.pixelTop;
 if (dom.offsetTop)      return dom.offsetTop;}

function objectpositierechts(objectID)
{ return objectpositielinks(objectID)+objectbreedte(objectID);}

function objectpositieonder(objectID)
{ return objectpositieboven(objectID)+objecthoogte(objectID);}

function toonobjectpositie(objectID)
{alert('Positie van object '+objectID+' linksboven, rechtsonder: '+
        objectpositielinks(objectID)+', '+objectpositieboven(objectID)+'; '+
        objectpositierechts(objectID)+', '+objectpositieonder(objectID))}

function verspringnaar(objectID,x,y)
{ var domstijl=findDOM(objectID,1);domstijl.left=x; domstijl.top=y;}

function verschuifnaar(objectID,xx,yy,steps)
{var domstijl=findDOM(objectID,1);
 var x=objectpositielinks(objectID);
 var y=objectpositieboven(objectID);
 var dx=(xx>x) ? +xx/x : -xx/x;
 var dy=(yy-y) ? +yy/y : -yy/y;
 var i=0;
 while (i<steps)
 { x=x+dx; y=y+dy; domstijl.left=x; domstijl.top=y; i++;}
}

function verplaats(objectID,dx,dy)
{var dom=findDOM(objectID,0);
 var domstijl=findDOM(objectID,1);
 if (domstijl.pixelLeft)
    {domstijl.pixelLeft+=dx; domstijl.pixelTop+=dy;}
 else {if (dom.offsetTop!=null)
            {var xx=dom.offsetLeft; domstijl.left=dx+xx;
             var yy=dom.offsetTop;  domstijl.top =dy+yy;}
        else dom.moveBy(dx,dy);
 }}


// =============================================================================
// object zichtbaarheid
// =============================================================================
function zetzichtbaarheid(objectID, stand)
{var dom=findDOM(objectID,1); dom.visibility=stand;}

function zichtbaarheid(objectID)
{var dom=findDOM(objectID,1);
 if   ((dom.visibility=='show')||(dom.visibility=='visible'))
      {return 'visible'}
 else {return 'hidden';}}

function tokkelzichtbaarheid(objectID)
{if   (zichtbaarheid(objectID)=='visible')
      {zetzichtbaarheid(objectID,'hidden')}
 else {zetzichtbaarheid(objectID,'visible')}}

// geeft vertikale scrollpositie nog nakijken
function scrollposy()
{if (window.pageXOffset!=null) return window.pageXOffset;
 if (document.body.scrollTop!=null) return document.body.scrollTop;
 return (null);
}

// geef horizontale scrollpositie nog nakijken
function scrollposx()
{if (window.pageYOffset!=null) return window.pageYOffset;
 if (document.body.scrollLeft!=null) return document.body.scrollLeft;
 return (null);
}






// ========================================
// ===  Empatheia heftruckcursus begin  ===
// ========================================

function toon(nr)
{ var dom=findDOM('p'+nr,1);  dom.visibility='visible';
  var dom=findDOM('b'+nr,1);  dom.visibility='visible';
  var dom=findDOM('o'+nr,1);  dom.visibility='visible';
}

function verberg(nr)
{ var dom=findDOM('p'+nr,1);  dom.visibility='hidden';
  var dom=findDOM('b'+nr,1);  dom.visibility='hidden';
  var dom=findDOM('o'+nr,1);  dom.visibility='hidden';
}

function toontekst(nr)
{ var dom=findDOM('t'+nr,1);  dom.visibility='visible';
}

function verbergtekst(nr)
{ var dom=findDOM('t'+nr,1);  dom.visibility='hidden';
}


function setcookie()
{ document.cookie='cursus=heftruck';
  document.cookie='cursist=4985676712341';
}

function unsetcookie()
{ document.cookie='cursus=';
  document.cookie='cursist=';
}


function ziecookie()
{ alert(document.cookie);
}


function _isheftruckcookie()
{ }

// var cookies = document.cookie.split(/; /g);
// if  (cookies[0] !== 'cursus=heftruck') location.href='../opvang.html';




// ========================================
// ===  Empatheia heftruckcursus  einde ===
// ========================================







function openWindow(contentURL,windowName,windowWidth,windowHeight) {
    widthHeight = 'height=' + windowHeight + ',width=' + windowWidth;
    newWindow = window.open(contentURL,windowName,widthHeight);
    newWindow.focus()
}

function closeWindow() {
    if (newWindow != null)  {
     newWindow.close();
     newWindow = null;
    }
}

function toggleWindow(contentURL,windowName,windowWidth,windowHeight) {
    if (newWindow == null) {
        widthHeight = 'HEIGHT=' + windowHeight + ',WIDTH=' + windowWidth;
        newWindow = window.open(contentURL,windowName,widthHeight);
        newWindow.focus()
    }
    else {
                newWindow.close();
                newWindow = null;
    }
}





function toonfoto(nummer)
{ document.foto.src='g_'+nummer+'.jpg';
}

function toonplus(nummer)
{ document.plusfoto.src='plus_'+nummer+'.png';
  document.plusfoto.style.visibility='visible';
}

function wisplus(nummer)
{ document.plusfoto.style.visibility='hidden';
}





/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
*
* Geeft een zwevend informatiebalkje dat meegaat met de muisbeweging
* Aanroepen bijvoorbeeld met
* <p onMouseover="ddrivetip('...hier komt de tekst...','achtergrondkleur', breedte)";
* onMouseout="hideddrivetip()"  >
* vergeet niet een style voor #dhtmltooltip op te zetten
***********************************************/

/*

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip



function copyToClipboard(s)
{
    if( window.clipboardData && clipboardData.setData )
    {
        clipboardData.setData("Text", s);
    }
    else
    {
        // You have to sign the code to enable this or allow the action in about:config by changing
        user_pref("signed.applets.codebase_principal_support", true);
        netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

        var clip Components.classes['@mozilla.org/widget/clipboard;[[[[1]]]]'].createInstance(Components.interfaces.nsIClipboard);
        if (!clip) return;

        // create a transferable
        var trans = Components.classes['@mozilla.org/widget/transferable;[[[[1]]]]'].createInstance(Components.interfaces.nsITransferable);
        if (!trans) return;

        // specify the data we wish to handle. Plaintext in this case.
        trans.addDataFlavor('text/unicode');

        // To get the data from the transferable we need two new objects
        var str = new Object();
        var len = new Object();

        var str = Components.classes["@mozilla.org/supports-string;[[[[1]]]]"].createInstance(Components.interfaces.nsISupportsString);

        var copytext=meintext;

        str.data=copytext;

        trans.setTransferData("text/unicode",str,copytext.length*[[[[2]]]]);

        var clipid=Components.interfaces.nsIClipboard;

        if (!clip) return false;

        clip.setData(trans,null,clipid.kGlobalClipboard);
    }
}


       */
