
<!--

//
// Environment info
//

//Operating System
var IS_WIN = (navigator.userAgent.indexOf("Win") >= 0);
var IS_MAC = (navigator.userAgent.indexOf("Mac") >= 0);
var IS_UNIX = (navigator.userAgent.indexOf("X11") >= 0);

//Browser Info
var IS_IE = (navigator.appName == "Microsoft Internet Explorer");
var IS_FF = (navigator.userAgent.indexOf("Firefox") >= 0);
var IS_NS = (navigator.vendor != "undefined" && 
     navigator.vendor == "Netscape");
var IS_MOZ = (navigator.userAgent.indexOf("Mozilla/5") >= 0);
var IS_NEW = ((IS_MOZ && parseInt(navigator.appVersion) >= 5) ||
       (IS_IE && parseInt(navigator.appVersion) >= 4));

//Object Support
var SUPPORTS_IMAGES = (typeof document.images != "undefined");

//Cookies
var COOKIES_ON = navigator.cookieEnabled;

// var url = "http://www.b58.nl/";
var ParentID = 0;
var ObjectID = this.document.all.Toggle;
var a_select = null;
var tr_select = null;
var tr_color;
var tr_display = (IS_IE) ? "block" : "table-row";

var Ajax = new XMLHttpRequest();

function AjaxReq(url,CallFunc) 
{
    Ajax.open('get',url);
    Ajax.onreadystatechange = function() 
    {
        if (Ajax.readyState != 4 ) return;
			
//		if (callback_args == null) callback_args = new Array();
//		var cb_params = new Array();
//		cb_params.push(Ajax);
//		for(var i=0;i<callback_args.length;i++)
//			cb_params.push(callback_args[i]);
//			
//		callback.apply(null, cb_params); 

        var F = window[CallFunc];
        if( F != null)
            F("Parameter");
        else
            AjaxUndefined(CallFunc);
    }
    Ajax.send(null);
}

function AjaxUndefined(Param)
{
        alert("AJAX requested function not defined: "+Param );
}

function AjaxFillDropdown(Param)
{
        alert("AJAX FillDropDown: "+Param );
}

function AjaxCallback(Param) {
        var responce = Ajax.responseText;
        alert("AJAX call State is OK.\r\n "+responce+"\r\n Func:"+Param );
}


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 printDate() 
{
    this.document.write("Vandaag is het:"+Date());
}

function swapit() 
{
    this.document.all.firsthead.style.background="000000"
}

function revert() 
{
    this.document.all.firsthead.style.background="00FF00"
}

function Toggle() 
{ 
    if( this.document.all.Toggle.style.display=="none")
		((ObjectID).style.display=tr_display );
	else
		((ObjectID).style.display="none");
}

function nop() {}

function Cat(form,p)
{
    var rValue = document.getElementById('domein').value
    rValue = rValue + '/iposweb.dll?'+ p;
    form.action = rValue;
    form.submit;
    // return rValue;
}

/*extArray = new Array(".gif", ".jpg", ".png");*/
function LimitAttach(form,file,extlist)
{
	allowSubmit = false;
	if( !file ) 
		return;
	while( file.indexOf("\\") != -1)
		file = file.slice(file.indexOf("\\") + 1);
		
	ext = file.slice(file.indexOf(".")).toLowerCase();
	if( extlist.indexOf(ext) > 0 )
		allowSubmit = true; 
	/*
	for (var i = 0; i < extArray.length; i++)
	{
		if (extArray[i] == ext)
		{ 
			allowSubmit = true; 
			break;
		}
	}(extArray.join("Â  "))
	*/
	if(	allowSubmit	)
		form.submit();
	else 
		alert("Alleen bestanden van de volgende type(s): "+ extlist +" zijn toegestaan !");
}

function Submit()
{
    form.submit();
}

function Uploadfile(form,pathfile,control)
{
	if( !pathfile ) 
		return;

	while( pathfile.indexOf("\\") != -1)
		pathfile = pathfile.slice(pathfile.indexOf("\\") + 1);
		
	control.value = pathfile;	
	/* alert("Control value is" + control.value); */
	form.submit();
}

function SetValueToControl(file,control)
{
	if( file ) 
	{
		while( file.indexOf("\\") != -1)
			file = file.slice(file.indexOf("\\") + 1);
 		control.value = file;
    /*alert("File:"+file);*/
  }
}


function Upload_Doc_jpg(form,pathfile,control,file,extlist,url,check)
{
	allowSubmit = true;
	if( file ) 
	{
		while( file.indexOf("\\") != -1)
			file = file.slice(file.indexOf("\\") + 1);
		
		ext = file.slice(file.indexOf(".")).toLowerCase();
		if( extlist.indexOf(ext) <= 0 )
		{
			allowSubmit = false;
			alert("Alleen bestanden van de volgende type(s): "+ extlist +" zijn toegestaan !");
		}
	}

	if( pathfile ) 
	{
		while( pathfile.indexOf("\\") != -1)
			pathfile = pathfile.slice(pathfile.indexOf("\\") + 1);
		control.value = pathfile;	
	}
	
	if( !file && !pathfile && !url && !check)
		allowSubmit = false;
		
	if(	allowSubmit	)
		form.submit();	
}

/* Highlight <a>..</a> */
function hl(what){
     if( a_select != null )
         a_select.className = '';
     a_select = what;
     a_select.className = 'active'
     
     /*    
     var p = what.parentNode;     
     var els = p.getElementsByTagName('a');
     for(i=0;i<els.length;i++){
          els[i].className = '';
     }
     what.className = 'active';*/
}

function selOn(ctrl,color) 
{
	//ctrl.style.backgroundColor = color;
}

function selOff(ctrl,color) 
{
   	//ctrl.style.backgroundColor = color;
}


function exenode(divID) 
{
	var  rvalue;
		rvalue = "Iposweb.dll?"+divID
return rvalue;
}

function getRefToDiv(divID,oDoc) {
	if( document.getElementById ) { return document.getElementById(divID); }
	if( document.all ) { return document.all[divID]; }
	if( !oDoc ) { oDoc = document; }
	if( document.layers ) {
		if( oDoc.layers[divID] ) {
			return oDoc.layers[divID];
		} else {
			for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
				y = getRefToDiv(divID,oDoc.layers[x].document);
			}
			return y;
		}
	}
	return false;
}


function ToggleNode(divID_as_a_string) {
	var myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) { window.alert('Nothing works in this browser'); return; }


	if( myReference.style.display=="none") 
	{ 
	    myReference.style.display = tr_display ; 
	} 
	else 
	{  
	    myReference.style.display = "none"; 
	}

/*
	if( myReference.style.visibility == "visible") 
	    myReference.style.visibility = 'hidden';   
	else					       
	    myReference.style.visibility = 'visible';  
*/
}


function showDiv(divID_as_a_string) {
	var myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) { window.alert('Nothing works in this browser'); return; }
	if( myReference.style ) { myReference.style.visibility = 'visible'; } else {
		if( myReference.visibility ) { myReference.visibility = 'show'; } else {
			window.alert('Nothing works in this browser'); return; } }
}

function hideDiv(divID_as_a_string) {
	var myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) { window.alert('Nothing works in this browser'); return; }
	if( myReference.style ) { myReference.style.visibility = 'hidden'; } else {
		if( myReference.visibility ) { myReference.visibility = 'hide'; } else {
			window.alert('Nothing works in this browser'); return; } }
}


function ExpandTableRowsLevels(TableID,Levels)
{
	var oTable = document.getElementById(TableID);
	var oRow, rp = 0, rows = oTable.rows;;
    while( oRow = rows.item(rp++) )
    	row.style.display = tr_display ;
}


function ExpandTableRows(TableID)
{
//	for( var oTable, a = 0; a < arguments.length; ++a)
//	{
//		oTable = document.getElementById(arguments[a]);
//    		var r = 0, row, rows = oTable.rows;
//     		while( row = rows.item(r++))
//			       row.style.display = "block";
//	}

	var oTable = document.getElementById(TableID);
	var rp = 0, row, rows = oTable.rows;
	while( row = rows.item(rp++))
	       row.style.display = tr_display ;	
}



/* STN -- Select Tree Node */
function STN(TableID,NodeID)
{    
    if( NodeID < 1 )
        return;
        
    var Element_ID, SplitPos, row,ir; // Parent, 
    if( tr_select != null )
        tr_select.style.backgroundColor = tr_color;
        
     oTable = getRefToDiv(TableID); 
     var oRows = oTable.rows;      
     if( oTable.rows )
     {
        ir = 0;   
        while( row = oRows.item(ir++) )
        {
	        Element_ID = row.id; // getAttribute("id");
	        Splitpos = Element_ID.indexOf(':');
	        //Parent = Element_ID.substring(0,Splitpos);
	        if( NodeID == Element_ID.substring(Splitpos+1) )
	        {
	            tr_select = row;
	            tr_color = tr_select.style.backgroundColor;
	            tr_select.style.backgroundColor = "#FFCC00";
	            
	            // window.alert('offsettop / clientTop = '+ tr_select.offsetTop + tr_select.clientTop);
	            if( tr_select.clientTop > 700 )          
	                tr_select.scrollIntoView (false);
	            return;
	        } 
	    } // end while
     }
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* TTN -- Toggle Tree Node  */
var oc, r, level;
function TTN(TableID,NodeID)
{
  oTable = getRefToDiv(TableID);
  var rows = oTable.rows;
  if( oTable.rows )
    {
      oc = "";
      r = 0;
      level = 0;
      IterateTTree(rows,NodeID)		
    }
}

function IterateTTree(oRows,NodeID)
{
  var Parent, Id, Element_ID, SplitPos, row; 
  level++;
  while( row = oRows.item(r++) )
  {
	Element_ID = row.id; // getAttribute("id");
	Splitpos = Element_ID.indexOf(':');
	Parent = Element_ID.substring(0,Splitpos);
   
	if( NodeID == Parent )
	{
	    if( oc == "" ) // Only once
	    {
			if( row.style.display == "none")
				oc = tr_display ;
			else	
				oc = "none";	    
	    } 
	    
		row.style.display = oc; // Set All sibblings	    	 
	    	    		
		if( oc == "none" ) // Close All Children
	    {	
			Id = Element_ID.substring(Splitpos+1);
			
		    if( Id != 0 )
				IterateTTree(oRows,Id); // Recursion
	    }	    
	}
	else
	{
		if( level > 1 )
		{
			r--;
			return;	
		}
	}
	
  } // end while
  
}




///////////////////////////////////////////////////////////////////////////////////////////////////////////////
var LTNlevel;
function LTN(TableID,TopNodeID,nLevel)
{
  oTable = getRefToDiv(TableID);
  var rows = oTable.rows;
  if( oTable.rows )
    {
      r = 0;
      LTNlevel = 0;
      IterateLTree(rows,TopNodeID,nLevel)		
    }
}

function IterateLTree(oRows,NodeID,nLevel)
{
  var Parent, Id, Element_ID, SplitPos, row; 
  
  //if( LTNlevel+1 > nLevel )
	//  return;
  
  LTNlevel++;  
  while( row = oRows.item(r++) )
  {
	Element_ID = row.id // getAttribute("id");
	Splitpos   = Element_ID.indexOf(':');
	Parent     = Element_ID.substring(0,Splitpos);
  

   
	if( NodeID == Parent ) 	
	{
		if( LTNlevel < nLevel )
			row.style.display = tr_display ; // Set All sibblings
		else
			row.style.display = "none";
		
		Id = Element_ID.substring(Splitpos+1);
		if( Id != 0 )
			IterateLTree(oRows,Id,nLevel); // Recursion								
	}
	else
	{
		if( LTNlevel > 1 )
		{
			r--;
			LTNlevel--;
			return;	
		}
	}
	
  } // end while
  LTNlevel--;
}

/* Google MAP functions  */

   var geocoder;
   var map;
   // var address = "Noorwegenstraat 32, Alphen aan den Rijn";

   // On page load, call this function
   function load(address)
   {
      // Create new map object
      map = new GMap2(document.getElementById("map"));
      map.addControl(new GSmallMapControl());
      map.addControl(new GMapTypeControl());

      // Create new geocoding object
      geocoder = new GClientGeocoder();

      // Retrieve location information, pass it to addToMap()
      geocoder.getLocations(address, addToMap);
   }

   // This function adds the point to the map

   function addToMap(response)
   {
      // Retrieve the object
      place = response.Placemark[0];

      // Retrieve the latitude and longitude
      point = new GLatLng(place.Point.coordinates[1],
                          place.Point.coordinates[0]);

      // Center the map on this point
      map.setCenter(point, 14);

      // Create a marker
      marker = new GMarker(point);

      // Add the marker to map
      map.addOverlay(marker);

      // Add address information to marker
      // marker.openInfoWindowHtml(place.address);
   }

-->


