function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function loadMenu(o, i)
{
	if (o!=null && i!=null)
		disableMenu (o, i);
	MM_preloadImages('../navigation/home.jpg','../navigation/home.zw.gif',					'../navigation/organisatie.gif','../navigation/organisatie.zw.gif','../navigation/verblijven.gif','../navigation/verblijven.zw.gif','../navigation/inschrijving.gif','../navigation/inschrijving.zw.gif','../navigation/beleid.gif','../navigation/beleid.zw.gif','../navigation/personeel.gif','../navigation/personeel.zw.gif','../navigation/contact.gif','../navigation/contact.zw.gif','../navigation/speelhoek.gif','../navigation/speelhoek.zw.gif');
}


function disableMenu(o, i)
{
	x=MM_findObj(o);
	
	x.style.filter="blendTrans(duration=1)";
	x.style.filter="blendTrans(duration=CrossFadeDuration)";
	x.filters.blendTrans.Apply();
	x.src = i;
	x.filters.blendTrans.Play();
	
	x.oSrc=i;

}

extArray = new Array(".jpg", ".png", ".bmp");

function setFileName(fileString, descName) 
{
	  allowSubmit = false;
    if (!fileString) return;
    while (fileString.indexOf("\\") != -1)
    fileString = fileString.slice(fileString.indexOf("\\") + 1);
    ext = fileString.slice(fileString.indexOf(".")).toLowerCase();
    for (var i = 0; i < extArray.length; i++) 
    {
    	if (extArray[i] == ext) 
    	{ 
    		allowSubmit = true; break; 
    	}
    }
    o=document.getElementById(descName);
    if (o!=null) o.value=fileString.slice(0,fileString.indexOf("."));
    
    if (allowSubmit) return true;
    else
	    alertString = "Please only upload fileStrings that end in types:  "
	    + (extArray.join("  ")) + "\nPlease select a new "
	    + "fileString to upload and submit again.";
    return true;
}

function checkTheBox(checkboxName, checkM) 
{
    o=document.getElementById(checkboxName);
    if (o!=null) o.checked=checkM;
}

function addRow(wt, counterName, descName)
{
	newNames = new Array();
	myArray=wt.name.split('_');
	myName=myArray[0];
	myCount=myArray[1];
	myCount++;
	
	o=document.getElementById(myName+'_'+(myCount));
	if (o==null)
	{
		document.getElementById(counterName).value=myCount;		
		mytable=wt.parentNode.parentNode.parentNode.parentNode;
		mytablebody=wt.parentNode.parentNode.parentNode;
		lastRow = mytablebody.rows(mytablebody.rows.length-1);
		
		mytr=wt.parentNode.parentNode;
		newtr=mytr.cloneNode(true);
		
		mytablebody.removeChild(lastRow);
		mytablebody.appendChild(newtr);
		mytablebody.appendChild(lastRow);
		
		myCols = newtr.cells.length;
		for(i=0;i<myCols;i++)
		{
			child=newtr.cells(i).firstChild;
			while (child!=null)
			{
				if (child.name)
				{
					myArray=child.name.split('_');
					newname='';
					for(j=0;j<(myArray.length-1);j++)
					{
						newname=newname+myArray[j]+'_';
					}
					newname=newname+myCount;
					newtr.cells(i).firstChild.name = newname;
					newtr.cells(i).firstChild.id = newname;
					newNames[i]=newname;
				}
				child=child.firstChild;
			}
		}		
	}
	setFileName(wt.value, descName+'_'+(myCount-1));
	return newNames;
}

function isLastRow(wt, counterName)
{
	newNames = new Array();
	myArray=wt.name.split('_');
	myName=myArray[0];
	myCount=myArray[1];
	currentCount=document.getElementById(counterName).value;
	
	return (currentCount==myCount);
	
}

function setValues (newNames)
{
	for (var i = 0; i < newNames.length; i++) 
  {
  		o=document.getElementById(newNames[i]);    	
    	if (o) o.value='';
  }
}

function setDataType(cValue)
  {
    // THIS FUNCTION CONVERTS DATES AND NUMBERS FOR PROPER ARRAY
    // SORTING WHEN IN THE SORT FUNCTION
    var isDate = new Date(cValue);
    if (isDate == "NaN")
      {
        if (isNaN(cValue))
          {
            // THE VALUE IS A STRING, MAKE ALL CHARACTERS IN
            // STRING UPPER CASE TO ASSURE PROPER A-Z SORT
            cValue = cValue.toUpperCase();
            return cValue;
          }
        else
          {
            // VALUE IS A NUMBER, TO PREVENT STRING SORTING OF A NUMBER
            // ADD AN ADDITIONAL DIGIT THAT IS THE + TO THE LENGTH OF
            // THE NUMBER WHEN IT IS A STRING
            var myNum;
            myNum = String.fromCharCode(48 + cValue.length) + cValue;
            return myNum;
          }
        }
  else
      {
        // VALUE TO SORT IS A DATE, REMOVE ALL OF THE PUNCTUATION AND
        // AND RETURN THE STRING NUMBER
        //BUG - STRING AND NOT NUMERICAL SORT .....
        // ( 1 - 10 - 11 - 2 - 3 - 4 - 41 - 5  etc.)
        var myDate = new String();
        myDate = isDate.getFullYear() + " " ;
        myDate = myDate + isDate.getMonth() + " ";
        myDate = myDate + isDate.getDate(); + " ";
        myDate = myDate + isDate.getHours(); + " ";
        myDate = myDate + isDate.getMinutes(); + " ";
        myDate = myDate + isDate.getSeconds();
        //myDate = String.fromCharCode(48 + myDate.length) + myDate;
        return myDate ;
      }
  }
  
function sortTable(col, tableNameToSort)
  {
  	var tableToSort=document.getElementById(tableNameToSort);
  	
    var iCurCell = col + tableToSort.cols;
    var totalRows = tableToSort.rows.length;
    var bSort = 0;
    var colArray = new Array();
    var oldIndex = new Array();
    var indexArray = new Array();
    var bArray = new Array();
    var newRow;
    var newCell;
    var i;
    var c;
    var j;
    // ** POPULATE THE ARRAY colArray WITH CONTENTS OF THE COLUMN SELECTED
    for (i=1; i < tableToSort.rows.length; i++)
      {
        colArray[i - 1] = setDataType(tableToSort.cells(iCurCell).innerText);
        iCurCell = iCurCell + tableToSort.cols;
      }
    // ** COPY ARRAY FOR COMPARISON AFTER SORT
    for (i=0; i < colArray.length; i++)
      {
        bArray[i] = colArray[i];
      }
    // ** SORT THE COLUMN ITEMS
    //alert ( colArray );
    colArray.sort();
    //alert ( colArray );
    for (i=0; i < colArray.length; i++)
      { // LOOP THROUGH THE NEW SORTED ARRAY
        indexArray[i] = (i+1);
        for(j=0; j < bArray.length; j++)
          { // LOOP THROUGH THE OLD ARRAY
            if (colArray[i] == bArray[j])
              {  // WHEN THE ITEM IN THE OLD AND NEW MATCH, PLACE THE
                // CURRENT ROW NUMBER IN THE PROPER POSITION IN THE
                // NEW ORDER ARRAY SO ROWS CAN BE MOVED ....
                // MAKE SURE CURRENT ROW NUMBER IS NOT ALREADY IN THE
                // NEW ORDER ARRAY
                for (c=0; c<i; c++)
                  {
                    if ( oldIndex[c] == (j+1) )
                    {
                      bSort = 1;
                    }
                      }
                      if (bSort == 0)
                        {
                          oldIndex[i] = (j+1);
                        }
                          bSort = 0;
                        }
          }
    }
  // ** SORTING COMPLETE, ADD NEW ROWS TO BASE OF TABLE ....
  for (i=0; i<oldIndex.length; i++)
    {
      newRow = tableToSort.insertRow();
      for (c=0; c<tableToSort.cols; c++)
        {
          newCell = newRow.insertCell();
          newCell.innerHTML = tableToSort.rows(oldIndex[i]).cells(c).innerHTML;
        }
      }
  //MOVE NEW ROWS TO TOP OF TABLE ....
  for (i=1; i<totalRows; i++)
    {
      tableToSort.moveRow((tableToSort.rows.length -1),1);
    }
  //DELETE THE OLD ROWS FROM THE BOTTOM OF THE TABLE ....
  for (i=1; i<totalRows; i++)
    {
      tableToSort.deleteRow();
    }
  }

function clickTab(buttonPrefix, divPrefix, tabNumber)
{
	
	i=1;	
	b=document.getElementById(buttonPrefix+i); 
	t=document.getElementById(divPrefix+i); 	
	while (b!=null && t!=null)
	{
		if (i==tabNumber)		
		{
			t.style.display='';
			b.className='btnOn';
		}
		else
		{
			t.style.display='none';
			b.className='btnOff';
		}
			
		i++;
		b=document.getElementById(buttonPrefix+i); 
		t=document.getElementById(divPrefix+i); 
	}
}

_uacct = "UA-3126202-1";
urchinTracker();
