function columnWidthChanged(id) {
	var selectableColumnWidths = document.getElementById(id);
	var selectedColumnWidth    = selectableColumnWidths.options[selectableColumnWidths.selectedIndex].value;

	if (id == 'cstKolom1Width') {
		selectableColumnWidths = document.getElementById('cstKolom2Width');
	} else {
		selectableColumnWidths = document.getElementById('cstKolom1Width');
	}

	for(i = 0;i < selectableColumnWidths.length;i++) {
      if(selectableColumnWidths.options[i].value == (100 - selectedColumnWidth)) {
      	selectableColumnWidths.selectedIndex = i
      }
	 }
}

function nrOfColumnsChanged(id) {
	var selectableNrOfColumns = document.getElementById(id);
	var selectedNrOfColumns   = selectableNrOfColumns.options[selectableNrOfColumns.selectedIndex].value;

  if (selectedNrOfColumns == 1) {
  	hideElement('cstKolom1WidthBlock');
  	hideElement('cstKolom2WidthBlock');
  } else {
  	showElement('cstKolom1WidthBlock');
  	showElement('cstKolom2WidthBlock');
  }
}

function showElement(id) {
	document.getElementById(id).style.display = 'block';
}

function hideElement(id) {
	document.getElementById(id).style.display = 'none';
}

function resetForm(form) {
	var formObject = document.getElementById(form);

	formObject.reset();

  return false;
}
function resizeFrame() {
  f = document.getElementById('realNextFrame');
	f.style.height = f.contentWindow.document.documentElement.scrollHeight + "px";
}
function resize_iframe()
{
	var height=window.innerWidth;//Firefox
	if (document.body.clientHeight)
	{
		height=document.body.clientHeight;//IE
	}
	//resize the iframe according to the size of the
	//window (all these should be on the same line)
	document.getElementById("realNextFrame").style.height=parseInt(height-
	document.getElementById("realNextFrame").offsetTop-8)+"px";
}
function getElement(aID)
{
    return (document.getElementById) ?
        document.getElementById(aID) : document.all[aID];
}
function getIFrameDocument(aID){ 
    var rv = null; 
    var frame=getElement(aID);
    alert('een');
    // if contentDocument exists, W3C compliant (e.g. Mozilla) 
    if (frame.contentDocument) {
    alert('twee');
        rv = frame.contentDocument;
        alert(rv);
    }
    else { // bad IE  ;)
    alert('drie');
        rv = document.frames[aID].document.Height;
    }    
    alert(rv);

    return rv;
}
function adjustMyFrameHeight()
{   var frame = getElement("realNextFrame");
    var frameDoc = getIFrameDocument("realNextFrame");
    frame.height = frameDoc.body.offsetHeight;
}
function clearFormElement(formElementId,formElementValue) {
	o = document.getElementById(formElementId);
	if (o.value == formElementValue) o.value = '';
}
function NewWindow(windowX,windowY,windowUrl,windowName,windowMode) {
   if (document.windowref) document.windowref.close();

   if (windowMode == 'resize')    var windowFeatures = "left=0,screenx=0,top=0,screeny=0,resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,status=no";
   else if (windowMode == 'full') var windowFeatures = "left=0,screenx=0,top=0,screeny=0,resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=yes,status=yes";
   else                           var windowFeatures = "left=0,screenx=0,top=0,screeny=0,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,status=no";

   if (window.screen) {
      switch(windowX) {
         case 'max': var aw = screen.availWidth - 10;break
         case 'min': var aw = 100;break
         default   : var aw = windowX;
      }

      switch(windowY) {
         case 'max': var ah = screen.availHeight - 20;break
         case 'min': var ah = 100;break
         default   : var ah = windowY;
      }

      windowFeatures += ",height=" + ah;
      windowFeatures += ",innerHeight=" + ah;
      windowFeatures += ",width=" + aw;
      windowFeatures += ",innerWidth=" + aw;
   }
   else {
      windowFeatures += ",resizable";
   }

   document.windowref = window.open(windowUrl,windowName,windowFeatures);
   document.windowref.focus();
}
/*
An object-oriented Typing Text script, to allow for multiple instances.
A script that causes any text inside any text element to be "typed out", one letter at a time. Note that any HTML tags will not be included in the typed output, to prevent them from causing problems. Tested in Firefox v1.5.0.1, Opera v8.52, Konqueror v3.5.1, and IE v6.
Browsers that do not support this script will simply see the text fully displayed from the start, including any HTML tags.

Functions defined:
  TypingText(element, [interval = 100,] [cursor = "",] [finishedCallback = function(){return}]):
    Create a new TypingText object around the given element.  Optionally
    specify a delay between characters of interval milliseconds.
    cursor allows users to specify some HTML to be appended to the end of
    the string whilst typing.  Optionally, can also be a function which
    accepts the current text as an argument.  This allows the user to
    create a "dynamic cursor" which changes depending on the latest character
    or the current length of the string.
    finishedCallback allows advanced scripters to supply a function
    to be executed on finishing.  The function must accept no arguments.

  TypingText.run():
    Run the effect.

  static TypingText.runAll():
    Run all TypingText-enabled objects on the page.
*/

TypingText = function(element, interval, cursor, finishedCallback) {
  if((typeof document.getElementById == "undefined") || (typeof element.innerHTML == "undefined")) {
    this.running = true;	// Never run.
    return;
  }
  this.element = element;
  this.finishedCallback = (finishedCallback ? finishedCallback : function() { return; });
  this.interval = (typeof interval == "undefined" ? 100 : interval);
  this.origText = this.element.innerHTML;
  this.unparsedOrigText = this.origText;
  this.cursor = (cursor ? cursor : "");
  this.currentText = "";
  this.currentChar = 0;
  this.element.typingText = this;
  if(this.element.id == "") this.element.id = "typingtext" + TypingText.currentIndex++;
  TypingText.all.push(this);
  this.running = false;
  this.inTag = false;
  this.tagBuffer = "";
  this.inHTMLEntity = false;
  this.HTMLEntityBuffer = "";
}
TypingText.all = new Array();
TypingText.currentIndex = 0;
TypingText.runAll = function() {
  for(var i = 0; i < TypingText.all.length; i++) TypingText.all[i].run();
}
TypingText.prototype.run = function() {
  if(this.running) return;
  if(typeof this.origText == "undefined") {
    setTimeout("document.getElementById('" + this.element.id + "').typingText.run()", this.interval);	// We haven't finished loading yet.  Have patience.
    return;
  }
  if(this.currentText == "") this.element.innerHTML = "";
//  this.origText = this.origText.replace(/<([^<])*>/, "");     // Strip HTML from text.
  if(this.currentChar < this.origText.length) {
    if(this.origText.charAt(this.currentChar) == "<" && !this.inTag) {
      this.tagBuffer = "<";
      this.inTag = true;
      this.currentChar++;
      this.run();
      return;
    } else if(this.origText.charAt(this.currentChar) == ">" && this.inTag) {
      this.tagBuffer += ">";
      this.inTag = false;
      this.currentText += this.tagBuffer;
      this.currentChar++;
      this.run();
      return;
    } else if(this.inTag) {
      this.tagBuffer += this.origText.charAt(this.currentChar);
      this.currentChar++;
      this.run();
      return;
    } else if(this.origText.charAt(this.currentChar) == "&" && !this.inHTMLEntity) {
      this.HTMLEntityBuffer = "&";
      this.inHTMLEntity = true;
      this.currentChar++;
      this.run();
      return;
    } else if(this.origText.charAt(this.currentChar) == ";" && this.inHTMLEntity) {
      this.HTMLEntityBuffer += ";";
      this.inHTMLEntity = false;
      this.currentText += this.HTMLEntityBuffer;
      this.currentChar++;
      this.run();
      return;
    } else if(this.inHTMLEntity) {
      this.HTMLEntityBuffer += this.origText.charAt(this.currentChar);
      this.currentChar++;
      this.run();
      return;
    } else {
      this.currentText += this.origText.charAt(this.currentChar);
    }
    this.element.innerHTML = this.currentText;
    this.element.innerHTML += (this.currentChar < this.origText.length - 1 ? (typeof this.cursor == "function" ? this.cursor(this.currentText) : this.cursor) : "");
    this.currentChar++;
    setTimeout("document.getElementById('" + this.element.id + "').typingText.run()", this.interval);
  } else {
	this.currentText = "";
	this.currentChar = 0;
        this.running = false;
        this.finishedCallback();
  }
}
function resizeContainer() {
	var divNavigatie = document.getElementById('lyNavigatie');
	var divContent   = document.getElementById('lyContent');
	var divKader     = document.getElementById('lyKader');

  var dh  = 0;
  var dhn = 0;
  var dhc = 0;
  var dhk = 0;
  
  if (divNavigatie) dhn  = divNavigatie.offsetHeight;
  if (divContent)   dhc  = divContent.offsetHeight;
  if (divKader)     dhk  = divKader.offsetHeight;

  if (dhn > dh) dh = dhn;
  if (dhc > dh) dh = dhc;
  if (dhk > dh) dh = dhk;  

document.getElementById('lyContainer2').style.height = dh + 'px';
}
